:root {
  --font-family-main: "Inter", "Montserrat", "Segoe UI", sans-serif;
  --font-scale: 1;

  --bg-main: #07182b;
  --bg-accent-top: rgba(76, 131, 194, 0.35);
  --bg-accent-bottom: rgba(32, 82, 134, 0.38);

  --panel-bg: rgba(8, 20, 36, 0.94);
  --panel-border: rgba(116, 162, 210, 0.45);
  --panel-shadow: rgba(5, 11, 20, 0.5);

  --radio-shell-color: #9eaab6;
  --radio-shell-color-dark: #7b8793;
  --radio-shell-border: rgba(195, 210, 226, 0.55);

  --screen-bg: #c6dda1;
  --screen-bg-deep: #a9c67a;
  --screen-border: rgba(88, 109, 52, 0.55);
  --screen-text: #1a1a1a;
  --screen-message-bg: rgba(221, 236, 182, 0.85);
  --screen-message-border: rgba(89, 110, 55, 0.42);
  --screen-inner-bg: rgba(228, 240, 194, 0.94);
  --screen-inner-border: rgba(103, 126, 64, 0.48);

  --btn-face: #e8edf3;
  --btn-face-deep: #c9d3de;
  --btn-border: rgba(39, 56, 75, 0.55);
  --btn-text: #122233;

  --lang-face: #e5edcc;
  --lang-face-deep: #cfdcb0;
  --lang-border: rgba(72, 93, 40, 0.5);
  --lang-text: #1a1a1a;

  --danger-face: #f26161;
  --danger-face-deep: #d73f3f;
  --success-face: #3dc778;
  --success-face-deep: #1da45a;

  --status-ok: #8cf2be;
  --status-err: #ff9f9f;

  --arrow-bg: rgba(8, 22, 40, 0.95);
  --arrow-border: rgba(170, 192, 220, 0.45);
  --arrow-text: #d8e9ff;

  --theme-active: #42db95;
  --theme-active-text: #0a2518;

  --dialog-bg: rgba(8, 20, 36, 0.98);
  --dialog-border: rgba(112, 153, 199, 0.48);
  --dialog-text: #e6f1ff;
  --dialog-note: #b5cae6;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

body[data-theme="day"] {
  --bg-main: #f6fbff;
  --bg-accent-top: rgba(255, 255, 255, 0.82);
  --bg-accent-bottom: rgba(202, 220, 242, 0.52);

  --panel-bg: rgba(255, 255, 255, 0.97);
  --panel-border: rgba(138, 160, 185, 0.56);
  --panel-shadow: rgba(90, 122, 154, 0.2);

  --radio-shell-color: #ecf2f8;
  --radio-shell-color-dark: #d9e2ec;
  --radio-shell-border: rgba(133, 154, 176, 0.58);

  --screen-bg: #f5fae7;
  --screen-bg-deep: #e8f2d0;
  --screen-border: rgba(115, 136, 79, 0.5);
  --screen-inner-bg: rgba(233, 244, 206, 0.98);
  --screen-inner-border: rgba(112, 135, 72, 0.45);

  --btn-face: #f2f6fa;
  --btn-face-deep: #dbe3ed;
  --btn-border: rgba(109, 132, 156, 0.6);
  --btn-text: #182636;

  --lang-face: #f4f9e6;
  --lang-face-deep: #e3edcb;
  --lang-border: rgba(103, 124, 67, 0.56);

  --status-ok: #194f32;
  --status-err: #9b1d1d;

  --arrow-bg: rgba(231, 239, 248, 0.98);
  --arrow-border: rgba(132, 154, 178, 0.55);
  --arrow-text: #17304a;

  --dialog-bg: rgba(251, 254, 255, 0.99);
  --dialog-border: rgba(130, 154, 182, 0.55);
  --dialog-text: #16283a;
  --dialog-note: #3d5877;
}

body[data-theme="night"] {
  --bg-main: #010205;
  --bg-accent-top: rgba(255, 255, 255, 0.05);
  --bg-accent-bottom: rgba(26, 54, 92, 0.18);

  --panel-bg: rgba(4, 6, 10, 0.97);
  --panel-border: rgba(92, 114, 148, 0.46);
  --panel-shadow: rgba(0, 0, 0, 0.78);

  --radio-shell-color: #10151d;
  --radio-shell-color-dark: #080b11;
  --radio-shell-border: rgba(94, 118, 155, 0.52);

  --screen-bg: #0d1117;
  --screen-bg-deep: #06090e;
  --screen-border: rgba(92, 113, 146, 0.48);
  --screen-text: #f3f7ff;
  --screen-message-bg: rgba(16, 22, 30, 0.9);
  --screen-message-border: rgba(92, 114, 146, 0.48);
  --screen-inner-bg: rgba(28, 39, 53, 0.92);
  --screen-inner-border: rgba(106, 130, 168, 0.45);

  --btn-face: #101722;
  --btn-face-deep: #0a111b;
  --btn-border: rgba(102, 124, 161, 0.56);
  --btn-text: #edf4ff;

  --lang-face: #121a27;
  --lang-face-deep: #0b121d;
  --lang-border: rgba(103, 127, 165, 0.56);
  --lang-text: #f3f8ff;

  --status-ok: #98f5be;
  --status-err: #ff9ea7;

  --arrow-bg: rgba(8, 11, 18, 0.98);
  --arrow-border: rgba(98, 122, 158, 0.52);
  --arrow-text: #e4eeff;

  --dialog-bg: rgba(6, 10, 16, 0.99);
  --dialog-border: rgba(94, 120, 161, 0.56);
  --dialog-text: #edf5ff;
  --dialog-note: #bfd1ea;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-family-main);
  color: #e7f1fe;
  background:
    radial-gradient(circle at 10% 0%, var(--bg-accent-top), transparent 48%),
    radial-gradient(circle at 100% 100%, var(--bg-accent-bottom), transparent 58%),
    var(--bg-main);
}

body[data-theme="day"] {
  color: #1b2b3c;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.panel-track {
  position: absolute;
  inset: 0;
  display: flex;
  width: 300vw;
  height: 100vh;
  touch-action: pan-y;
  transform: translateX(-100vw);
  transition: transform 0.3s ease-out;
}

.panel-track[data-panel="design"] {
  transform: translateX(0);
}

.panel-track[data-panel="radio"] {
  transform: translateX(-100vw);
}

.panel-track[data-panel="settings"] {
  transform: translateX(-200vw);
}

.surface-panel {
  width: 100vw;
  height: 100vh;
  flex: 0 0 100vw;
  display: grid;
  place-items: center;
  padding-top: max(10px, var(--safe-top));
  padding-bottom: max(10px, var(--safe-bottom));
  padding-left: max(12px, var(--safe-left));
  padding-right: max(12px, var(--safe-right));
}

.panel-radio {
  grid-template-rows: 1fr auto;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.incoming-history-drawer {
  position: absolute;
  left: max(12px, var(--safe-left));
  right: max(12px, var(--safe-right));
  bottom: max(8px, var(--safe-bottom));
  max-height: min(54vh, 420px);
  border: 1px solid rgba(112, 144, 189, 0.5);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10, 20, 36, 0.96), rgba(6, 14, 28, 0.94));
  box-shadow: 0 18px 28px rgba(2, 8, 16, 0.52);
  padding: 8px 10px 10px;
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.2s ease;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  z-index: 16;
}

.incoming-history-drawer.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.incoming-history-drawer.full {
  top: max(10px, var(--safe-top));
  bottom: max(8px, var(--safe-bottom));
  max-height: none;
  border-radius: 16px;
}

.incoming-history-handle {
  width: 56px;
  height: 5px;
  border-radius: 999px;
  margin: 2px auto 0;
  background: rgba(151, 177, 214, 0.6);
}

.incoming-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.incoming-history-head h3 {
  margin: 0;
  font-size: calc(0.92rem * var(--font-scale));
  color: #d9e9ff;
}

.incoming-history-hint {
  margin: 0;
  font-size: calc(0.76rem * var(--font-scale));
  color: rgba(177, 201, 232, 0.9);
}

.incoming-history-list {
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.incoming-history-empty {
  border: 1px dashed rgba(126, 157, 196, 0.5);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: rgba(177, 201, 232, 0.94);
  font-size: calc(0.8rem * var(--font-scale));
}

.incoming-history-item {
  border: 1px solid rgba(103, 136, 181, 0.45);
  border-radius: 12px;
  background: rgba(12, 24, 42, 0.7);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.incoming-history-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: #d7e8ff;
  font-size: calc(0.76rem * var(--font-scale));
}

.incoming-history-peer {
  font-weight: 700;
}

.incoming-history-subline {
  color: rgba(171, 197, 231, 0.9);
  font-size: calc(0.72rem * var(--font-scale));
  line-height: 1.32;
}

.incoming-history-subline > div {
  margin-top: 2px;
}

.incoming-history-pin {
  font-size: calc(0.72rem * var(--font-scale));
  vertical-align: middle;
}

.incoming-history-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.incoming-history-actions .tiny-btn {
  min-height: 34px;
  font-size: calc(0.74rem * var(--font-scale));
  padding: 6px;
}

.history-card-menu {
  position: absolute;
  z-index: 19;
  background: rgba(8, 16, 31, 0.98);
  border: 1px solid rgba(130, 162, 206, 0.6);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transform: translate(-10%, -90%);
}

.history-card-menu[hidden] {
  display: none;
}

.history-player-box {
  display: grid;
  gap: 8px;
}

.history-player-box textarea {
  min-height: 92px;
  resize: vertical;
}

.history-player-seek-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.history-player-seek-row span {
  font-size: calc(0.74rem * var(--font-scale));
  color: rgba(175, 201, 234, 0.94);
}

body[data-theme="day"] .incoming-history-drawer {
  background: linear-gradient(180deg, rgba(242, 248, 255, 0.98), rgba(231, 241, 253, 0.98));
  border-color: rgba(114, 145, 184, 0.46);
  box-shadow: 0 16px 26px rgba(29, 56, 90, 0.22);
}

body[data-theme="day"] .history-card-menu {
  background: rgba(244, 249, 255, 0.98);
  border-color: rgba(132, 161, 199, 0.7);
}

body[data-theme="day"] .incoming-history-head h3 {
  color: #173b62;
}

body[data-theme="day"] .incoming-history-hint {
  color: rgba(53, 84, 122, 0.9);
}

body[data-theme="day"] .incoming-history-item {
  background: rgba(249, 252, 255, 0.96);
  border-color: rgba(111, 142, 182, 0.42);
}

body[data-theme="day"] .incoming-history-meta {
  color: #173b62;
}

body[data-theme="day"] .incoming-history-subline {
  color: rgba(60, 91, 130, 0.9);
}

.edge-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 78px;
  border: 1px solid var(--arrow-border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--arrow-bg), rgba(6, 16, 30, 0.96));
  color: var(--arrow-text);
  font-size: calc(1.1rem * var(--font-scale));
  font-weight: 800;
  z-index: 12;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.edge-left {
  left: calc(-16px + var(--safe-left));
  padding-left: 12px;
}

.edge-right {
  right: calc(-16px + var(--safe-right));
  padding-right: 12px;
}

.edge-arrow:active {
  transform: translateY(-50%) scale(0.97);
}

.radio-frame,
.settings-card,
.design-card {
  width: min(94vw, 430px);
  height: min(calc(100vh - var(--safe-top) - var(--safe-bottom) - 26px), 760px);
}

.about-card {
  gap: 12px;
}

.about-text {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(14, 30, 48, 0.6);
  color: #d9e8fb;
  padding: 12px;
  line-height: 1.42;
  font-size: calc(0.93rem * var(--font-scale));
  white-space: pre-wrap;
}

body[data-theme="day"] .about-text {
  background: rgba(235, 243, 250, 0.95);
  color: #1c2c3d;
}

.radio-frame {
  border-radius: 36px;
  border: 2px solid var(--radio-shell-border);
  background:
    linear-gradient(165deg, var(--radio-shell-color), var(--radio-shell-color-dark)),
    var(--radio-shell-color);
  box-shadow:
    inset 0 -8px 24px rgba(24, 34, 44, 0.35),
    0 24px 40px rgba(4, 10, 18, 0.55);
  position: relative;
  padding: 18px 18px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 11px;
}

.settings-card {
  display: flex;
  flex-direction: column;
}

body[data-theme="night"] .radio-frame {
  border-color: rgba(92, 114, 148, 0.56);
  background:
    linear-gradient(165deg, #10151d, #080b11),
    #0a0d12;
}

.radio-frame.local {
  box-shadow:
    inset 0 -8px 24px rgba(24, 34, 44, 0.35),
    0 0 0 1px rgba(80, 150, 235, 0.32),
    0 20px 34px rgba(5, 11, 20, 0.55);
}

.radio-frame.waiting {
  box-shadow:
    inset 0 -8px 24px rgba(24, 34, 44, 0.35),
    0 0 0 1px rgba(235, 84, 84, 0.38),
    0 20px 34px rgba(5, 11, 20, 0.55);
}

.radio-frame.ready {
  box-shadow:
    inset 0 -8px 24px rgba(24, 34, 44, 0.35),
    0 0 0 1px rgba(57, 225, 130, 0.48),
    0 0 28px rgba(57, 225, 130, 0.24),
    0 20px 34px rgba(5, 11, 20, 0.55);
}

.radio-frame.locked {
  filter: saturate(0.6) brightness(0.88);
}

.brand {
  margin: 0;
  text-align: center;
  color: #11263c;
  font-size: calc(1.02rem * var(--font-scale));
  letter-spacing: 0.1em;
  font-weight: 800;
  text-transform: uppercase;
}

body[data-theme="night"] .brand {
  color: #dce9ff;
}

.lamp {
  position: absolute;
  top: 13px;
  right: 15px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(13, 20, 28, 0.45);
}

.lamp.local {
  background: #378dff;
  box-shadow: 0 0 12px rgba(55, 141, 255, 0.95);
}

.lamp.waiting {
  background: #ff4242;
  box-shadow: 0 0 13px rgba(255, 66, 66, 0.96);
}

.lamp.ready {
  background: #2ddd74;
  box-shadow: 0 0 13px rgba(45, 221, 116, 0.96);
}

.side-tab {
  position: absolute;
  top: 116px;
  width: 64px;
  min-height: 128px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border: 1px solid var(--btn-border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--btn-face), var(--btn-face-deep));
  color: var(--btn-text);
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 2px rgba(0, 0, 0, 0.22);
}

.side-tab-left {
  left: -14px;
}

.side-tab-right {
  right: -14px;
}

.side-tab:active {
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4);
}

.screen {
  position: relative;
  border-radius: 18px;
  border: 2px solid var(--screen-border);
  background: linear-gradient(180deg, var(--screen-bg), var(--screen-bg-deep));
  color: var(--screen-text);
  padding: 12px 12px 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  font-family: "Inter", "Lucida Console", "Courier New", monospace;
  min-height: 300px;
}

.channel-mini-btn {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 68px;
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--btn-face), var(--btn-face-deep));
  color: var(--btn-text);
  font-size: calc(1.45rem * var(--font-scale));
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 2px rgba(0, 0, 0, 0.22);
}

.theme-mini-btn {
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 68px;
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--btn-face), var(--btn-face-deep));
  color: var(--btn-text);
  font-size: calc(1.35rem * var(--font-scale));
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 2px rgba(0, 0, 0, 0.22);
}

.theme-mini-btn:active {
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4);
}

.channel-mini-btn:active {
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4);
}

.screen-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin: 0 38px;
}

.screen-mode,
.screen-user,
.screen-message {
  margin: 0;
}

.screen-mode {
  display: none;
}

.screen-user {
  font-size: calc(0.78rem * var(--font-scale));
  opacity: 0.9;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-user.peer {
  text-align: right;
}

.screen-display {
  border: 1px solid var(--screen-inner-border);
  border-radius: 10px;
  background: var(--screen-inner-bg);
  min-height: 0;
  margin: 0 38px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.screen-message {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: calc(0.98rem * var(--font-scale));
  line-height: 1.34;
  display: block;
  color: var(--screen-text);
  width: 100%;
  overflow-wrap: anywhere;
  max-height: 9.2em;
  overflow-y: auto;
}

.screen-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}

.lang-slot {
  display: grid;
  gap: 5px;
}

.lang-caption {
  font-size: calc(0.92rem * var(--font-scale));
  font-weight: 800;
  opacity: 0.9;
}

.lang-btn,
.swap-btn {
  width: 100%;
  border: 1px solid var(--lang-border);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--lang-face), var(--lang-face-deep));
  color: var(--lang-text);
  padding: 12px 8px;
  font-size: calc(1.1rem * var(--font-scale));
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 2px rgba(30, 40, 18, 0.2);
}

.lang-btn:active,
.swap-btn:active {
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42);
}

.swap-slot {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.swap-arrows {
  font-size: calc(1.56rem * var(--font-scale));
  font-weight: 800;
}

.swap-btn {
  min-width: 76px;
}

.ptt-btn {
  justify-self: center;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  border: 0;
  color: #f5fcff;
  font-size: calc(1.65rem * var(--font-scale));
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #ff7a7a, #e64343 65%, #a61f1f);
  box-shadow:
    inset 0 5px 10px rgba(255, 255, 255, 0.18),
    inset 0 -10px 16px rgba(120, 20, 20, 0.28),
    0 14px 28px rgba(128, 24, 24, 0.45);
}

body[data-theme="night"] .ptt-btn {
  color: #06150a;
  background: radial-gradient(circle at 30% 30%, #7dffad, #28d66d 62%, #118243);
  box-shadow:
    inset 0 5px 10px rgba(255, 255, 255, 0.22),
    inset 0 -10px 16px rgba(7, 76, 40, 0.32),
    0 14px 28px rgba(13, 133, 67, 0.45);
}

.ptt-btn.recording {
  background: radial-gradient(circle at 30% 30%, var(--success-face), var(--success-face-deep) 65%, #0f6d41);
  box-shadow:
    inset 0 5px 10px rgba(255, 255, 255, 0.18),
    inset 0 -10px 16px rgba(10, 77, 45, 0.28),
    0 14px 28px rgba(18, 110, 66, 0.45);
  animation: pttPulse 1s infinite;
}

@keyframes pttPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.repeat-btn {
  justify-self: center;
  width: min(74%, 264px);
  border: 1px solid var(--btn-border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--btn-face), var(--btn-face-deep));
  color: var(--btn-text);
  padding: 14px 10px;
  font-size: calc(0.95rem * var(--font-scale));
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 2px rgba(0, 0, 0, 0.2);
}

.settings-card,
.design-card {
  border-radius: 30px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  box-shadow: 0 20px 34px var(--panel-shadow);
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 11px;
}

.settings-card h2,
.design-card h2 {
  margin: 0;
  font-size: calc(1.2rem * var(--font-scale));
}

.settings-line,
.design-note,
.design-label {
  margin: 0;
  font-size: calc(0.94rem * var(--font-scale));
}

.settings-line {
  color: #d0e2f8;
}

.settings-group,
.design-group {
  display: grid;
  gap: 8px;
}

.settings-inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.settings-id-line {
  margin: 8px 2px 2px;
  color: var(--text-soft);
  font-size: calc(0.78rem * var(--font-scale));
  letter-spacing: 0.01em;
}

.billing-actions {
  grid-template-columns: 1fr;
}

.segmented,
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.theme-grid {
  grid-template-columns: 1fr 1fr;
}

.settings-btn,
.seg-btn,
.theme-btn {
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--btn-face), var(--btn-face-deep));
  color: var(--btn-text);
  padding: 12px 10px;
  font-size: calc(0.92rem * var(--font-scale));
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 2px rgba(0, 0, 0, 0.2);
}

.settings-inline-actions .settings-btn {
  padding: 10px 6px;
  min-height: 46px;
  font-size: calc(0.82rem * var(--font-scale));
}

.settings-inline-actions .settings-btn.icon-only {
  padding: 8px;
  font-size: calc(1.08rem * var(--font-scale));
  font-weight: 700;
}

.settings-inline-actions .settings-btn.icon-only svg {
  width: 1.3rem;
  height: 1.3rem;
  display: block;
  margin: 0 auto;
}

.settings-btn:active,
.seg-btn:active,
.theme-btn:active {
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4);
}

.settings-btn.accent {
  background: linear-gradient(180deg, #d6fbe7, #b6e8cf);
  border-color: rgba(66, 175, 117, 0.72);
  color: #0e4129;
}

.reconnect-btn {
  width: 100%;
  min-height: 50px;
  font-size: calc(0.96rem * var(--font-scale));
}

.install-btn {
  width: 100%;
  min-height: 50px;
  margin-top: 10px;
  font-size: calc(0.9rem * var(--font-scale));
  background: linear-gradient(180deg, #d8f0ff, #b8d9ef);
  border-color: rgba(82, 139, 181, 0.74);
  color: #123c5e;
}

body[data-theme="night"] .install-btn {
  background: linear-gradient(180deg, #152438, #0e1928);
  border-color: rgba(109, 144, 188, 0.62);
  color: #ddecff;
}

.settings-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(128, 152, 182, 0.34);
}

.credits-block {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.credits-card {
  border: 1px solid rgba(87, 202, 138, 0.7);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(20, 74, 50, 0.9), rgba(12, 42, 62, 0.92));
  padding: 12px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

body[data-theme="day"] .credits-card {
  border-color: rgba(37, 144, 86, 0.62);
  background: linear-gradient(160deg, rgba(223, 255, 236, 0.98), rgba(207, 235, 255, 0.98));
}

.credits-title,
.credits-value {
  margin: 0;
}

.credits-title {
  font-size: calc(0.9rem * var(--font-scale));
  color: #d7ffe9;
  font-weight: 600;
}

body[data-theme="day"] .credits-title {
  color: #0e4d2c;
}

.credits-value {
  margin-top: 4px;
  font-size: calc(1.46rem * var(--font-scale));
  line-height: 1.05;
  font-weight: 800;
  color: #f2fff8;
}

body[data-theme="day"] .credits-value {
  color: #0e3e63;
}

.credits-topup-btn {
  width: 100%;
}

.seg-btn.active,
.theme-btn.active {
  background: linear-gradient(160deg, var(--theme-active), #1ab770);
  border-color: rgba(29, 164, 90, 0.82);
  color: var(--theme-active-text);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(14, 30, 48, 0.78);
  font-size: calc(0.92rem * var(--font-scale));
}

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(14, 30, 48, 0.78);
  color: #d4e4f9;
  font-size: calc(0.92rem * var(--font-scale));
  transition: opacity 0.2s ease, filter 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.row-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.row-icon {
  font-size: calc(1rem * var(--font-scale));
  line-height: 1;
}

.switch-row:not(.is-on) {
  opacity: 0.58;
  filter: saturate(0.62);
}

.switch-row.is-on {
  opacity: 1;
  filter: saturate(1);
}

#speakerGenderRow,
#speakerGenderRow:not(.is-on) {
  opacity: 1;
  filter: none;
}

.switch-row input[type="checkbox"] {
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(96, 120, 155, 0.7);
  background: linear-gradient(180deg, #3f4b5a, #2b3542);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.switch-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e7f0ff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
  transition: transform 0.2s ease;
}

.switch-row input[type="checkbox"]:checked {
  background: linear-gradient(180deg, #42db95, #1ab770);
  border-color: rgba(29, 164, 90, 0.84);
}

.switch-row input[type="checkbox"]:checked::before {
  transform: translateX(20px);
  background: #f8fffb;
}

body[data-theme="day"] #speakerGenderRow[data-gender="male"] {
  background: linear-gradient(180deg, #e7f2ff, #d4e6fb);
  border-color: rgba(127, 157, 189, 0.68);
  color: #1b3652;
}

body[data-theme="day"] #speakerGenderRow[data-gender="female"] {
  background: linear-gradient(180deg, #ffe7f1, #f8d8e8);
  border-color: rgba(196, 138, 168, 0.68);
  color: #4f1f39;
}

body[data-theme="day"] #speakerGenderRow input[type="checkbox"] {
  border-color: rgba(120, 149, 182, 0.72);
  background: linear-gradient(180deg, #bcd5f2, #93b6df);
}

body[data-theme="day"] #speakerGenderRow input[type="checkbox"]:checked {
  border-color: rgba(189, 130, 162, 0.74);
  background: linear-gradient(180deg, #efb9d5, #d78eb9);
}

body[data-theme="night"] #speakerGenderRow {
  background: rgba(14, 30, 48, 0.78);
  color: #d4e4f9;
}

body[data-theme="night"] #speakerGenderRow input[type="checkbox"],
body[data-theme="night"] #speakerGenderRow input[type="checkbox"]:checked {
  border-color: rgba(100, 124, 160, 0.72);
  background: linear-gradient(180deg, #415163, #2f3d4e);
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
}

#fontSizeRange {
  width: 100%;
}

#shellColorPicker {
  width: 100%;
  height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.radio-dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: transparent;
}

.radio-dialog::backdrop {
  background: rgba(2, 7, 14, 0.76);
}

body.dialog-fallback-lock {
  overflow: hidden;
}

.radio-dialog.dialog-fallback-open {
  position: fixed;
  inset: 0;
  margin: 0;
  border: 0;
  padding: 0;
  background: rgba(2, 7, 14, 0.76);
  display: grid;
  place-items: center;
  z-index: 1300;
}

.dialog-box {
  width: min(372px, calc(100vw - 28px));
  border-radius: 16px;
  border: 1px solid var(--dialog-border);
  background: var(--dialog-bg);
  color: var(--dialog-text);
  padding: 14px;
}

.qr-scan-box {
  width: min(420px, calc(100vw - 28px));
}

.qr-scan-video {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--dialog-border);
  background: rgba(3, 8, 14, 0.9);
  object-fit: cover;
}

.dialog-box h3 {
  margin: 0;
  font-size: calc(1rem * var(--font-scale));
}

.dialog-note {
  margin: 6px 0 9px;
  color: var(--dialog-note);
  font-size: calc(0.85rem * var(--font-scale));
}

.dialog-note.err {
  color: #ff9d9d;
}

.update-progress-box {
  display: grid;
  gap: 10px;
}

.update-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.update-progress-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(158, 180, 212, 0.35);
  border-top-color: rgba(195, 222, 255, 0.95);
  animation: updateSpin 0.72s linear infinite;
}

body[data-theme="day"] .update-progress-spinner {
  border-color: rgba(93, 129, 171, 0.3);
  border-top-color: rgba(35, 79, 128, 0.9);
}

.update-progress-step {
  font-size: calc(0.84rem * var(--font-scale));
  color: var(--dialog-note);
}

@keyframes updateSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.dialog-box label {
  display: block;
  font-size: calc(0.83rem * var(--font-scale));
  color: #c0d5ef;
  margin: 0 0 5px;
}

.dialog-box select,
.dialog-box textarea,
.dialog-box input[type="text"],
.dialog-box input[type="password"] {
  width: 100%;
  border: 1px solid var(--dialog-border);
  border-radius: 10px;
  background: rgba(10, 24, 42, 0.94);
  color: #e8f1fd;
  padding: 10px;
  font-size: calc(0.9rem * var(--font-scale));
  margin-bottom: 9px;
}

body[data-theme="day"] .toggle-row {
  background: rgba(235, 243, 250, 0.98);
  color: #1c2c3d;
}

body[data-theme="day"] .switch-row {
  background: rgba(235, 243, 250, 0.98);
  color: #1c2c3d;
}

body[data-theme="day"] .dialog-box select,
body[data-theme="day"] .dialog-box textarea,
body[data-theme="day"] .dialog-box input[type="text"],
body[data-theme="day"] .dialog-box input[type="password"] {
  background: rgba(242, 248, 253, 0.98);
  color: #1c2d3f;
}

#authDialogStatus {
  min-height: 1.2em;
}

#authDialogStatus.err {
  color: var(--status-err);
}

.auth-password-rules {
  list-style: none;
  margin: -1px 0 10px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.auth-password-rule {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: calc(0.8rem * var(--font-scale));
  color: #ef8f8f;
}

.auth-password-rule::before {
  content: "\2022";
  font-size: 1em;
  color: currentColor;
}

.auth-password-rule.ok {
  color: #6add9e;
}

.auth-password-rule.ok::before {
  content: "\2713";
  font-size: 0.95em;
}

body[data-theme="day"] .auth-password-rule {
  color: #c34f4f;
}

body[data-theme="day"] .auth-password-rule.ok {
  color: #22864f;
}

#authSubmitBtn:disabled {
  border-color: rgba(108, 132, 160, 0.44);
  background: linear-gradient(180deg, #2d465f, #243a51);
  color: #9eb1c8;
  box-shadow: none;
}

body[data-theme="day"] #authSubmitBtn:disabled {
  border-color: rgba(123, 147, 173, 0.48);
  background: linear-gradient(180deg, #d7e3ef, #c9d8e6);
  color: #6f8297;
}

body[data-theme="day"] .tiny-btn,
body[data-theme="day"] .lang-choice {
  background: linear-gradient(180deg, #edf4fb, #d8e5f3);
  color: #1d3147;
}

body[data-theme="day"] .switch-row input[type="checkbox"] {
  border-color: rgba(125, 146, 170, 0.68);
  background: linear-gradient(180deg, #bcc9d7, #9dabb9);
}

body[data-theme="day"] .switch-row input[type="checkbox"]::before {
  background: #f7fbff;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dialog-actions[hidden] {
  display: none !important;
}

.dialog-actions.single {
  justify-content: center;
}

.tiny-btn,
.lang-choice {
  border: 1px solid var(--dialog-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #244568, #173653);
  color: #dbe9fb;
  padding: 9px 13px;
  font-size: calc(0.82rem * var(--font-scale));
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 2px rgba(0, 0, 0, 0.18);
}

.tiny-btn.strong {
  border-color: rgba(66, 230, 145, 0.72);
  color: #bdf8d5;
}

.lang-grid {
  display: grid;
  gap: 8px;
}

.lang-choice {
  text-align: left;
}

#qrImage {
  width: 100%;
  max-width: 285px;
  display: block;
  margin: 4px auto 10px;
  border-radius: 8px;
}

.review-box textarea {
  min-height: 76px;
}

.billing-packs-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.billing-pack-btn {
  width: 100%;
  text-align: left;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

@media (max-height: 770px) {
  .radio-frame,
  .settings-card,
  .design-card {
    height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 20px);
    border-radius: 28px;
  }

  .screen {
    min-height: 255px;
  }

  .screen-head {
    margin: 0 34px;
  }

  .screen-display {
    margin: 0 34px;
  }

  .ptt-btn {
    width: 170px;
    height: 170px;
    font-size: calc(1.38rem * var(--font-scale));
  }
}

@media (max-width: 390px) {
  .edge-arrow {
    width: 42px;
    height: 68px;
  }

  .side-tab {
    width: 56px;
    min-height: 120px;
  }

  .lang-btn,
  .swap-btn {
    font-size: calc(1rem * var(--font-scale));
    padding: 10px 6px;
  }

  .channel-mini-btn {
    width: 40px;
    height: 60px;
    font-size: calc(1.2rem * var(--font-scale));
  }

  .theme-mini-btn {
    width: 40px;
    height: 60px;
    font-size: calc(1.12rem * var(--font-scale));
  }

  .screen-head {
    margin: 0 30px;
  }

  .screen-display {
    margin: 0 30px;
  }
}
