/* Телефон-компаньон (ADR-233). Вид — как у клиента: значения из client/Assets/ReLich/UI/Theme.cs (поверхности, линии,
   ледяной акцент, скругления окна 12 и кнопки 8, виды кнопок ThemeButtons.cs) и цвета каналов из ChatWindow.cs.
   Шрифты клиента: Fira Sans Condensed — текст, Spectral — заголовки (OFL, урезаны до латиницы и кириллицы). */
@font-face { font-family: "Fira Sans Condensed"; src: url("FiraSansCondensed-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fira Sans Condensed"; src: url("FiraSansCondensed-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("Spectral-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  /* Theme.Page / S1 / S2 / S3 / Well */
  --page: #07090c;
  --s1: #0c1015;
  --s2: #11161c;
  --s3: #171d25;
  --well: #05070a;
  /* Theme.Line / Line2 / Line3 — LineBase (#d6e8f5) с прозрачностью */
  --line: rgba(214, 232, 245, .08);
  --line2: rgba(214, 232, 245, .14);
  --line3: rgba(214, 232, 245, .22);
  --title: #edf2f5;
  --text: #b6c1c9;
  --dim: #76838d;
  --accent: #7fd8f2;
  --accent-hi: #a7e6f8;
  --accent-ink: #04141b;
  --good: #7fd4a0;
  --warn: #e8c477;
  --bad: #f08a7e;
  /* ChatWindow: цвета источников */
  --c-say: #ffffff; --c-yell: #ff4040; --c-whisper: #ff80ff; --c-emote: #ff8040; --c-party: #aaaaff; --c-raid: #ff8000;
  --c-guild: #40ff40; --c-officer: #40bf40; --c-channel: #ffbfbf; --c-system: #ffff00; --c-npc: #ffff9e; --c-loot: #99d9ff;
  --gap: 10px;
  font-family: "Fira Sans Condensed", system-ui, sans-serif;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: 100dvh; overflow: hidden; background: var(--page); color: var(--text); }
body {
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { font-family: "Spectral", Georgia, serif; font-weight: 500; color: var(--title); }

/* Кнопки — ThemeButtons: второстепенная тихая (белый 3 %, линия Line3), главная ледяная, опасная — красная линия. */
button, input, select { font: inherit; color: inherit; }
button {
  font-weight: 500; color: var(--title);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line3); border-radius: 8px;
  padding: 8px 14px; min-height: 44px; touch-action: manipulation;
  transition: background-color .12s, border-color .12s;
}
button:active { background: rgba(255, 255, 255, .08); border-color: rgba(214, 232, 245, .34); }
button:disabled { opacity: .4; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:active { background: var(--accent-hi); border-color: var(--accent-hi); }
button.danger { background: rgba(240, 138, 126, .06); border-color: rgba(240, 138, 126, .45); color: var(--bad); }
button.link { background: none; border: none; color: var(--dim); text-decoration: underline; min-height: 32px; padding: 6px; font-weight: 400; }
/* Вкладка: без рамки, выбранная — белый текст и ледяная черта снизу. */
button.tab {
  background: none; border: none; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0;
  color: var(--dim); padding: 5px 12px; min-height: 36px; white-space: nowrap;
}
button.tab.on { color: var(--title); border-bottom-color: var(--accent); }
input, select {
  background: var(--well); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; min-height: 44px; width: 100%;
  color: var(--title);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--dim); }

/* Шапка — как полоса окна: имя героя заголовочным шрифтом, экраны — вкладками. */
#bar { position: sticky; top: 0; background: var(--page); border-bottom: 1px solid var(--line2); z-index: 2; }
#who { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px 4px; gap: 8px; }
#name { font-family: "Spectral", Georgia, serif; font-weight: 500; font-size: 18px; color: var(--title); }
#state { color: var(--dim); font-size: 14px; }
#state.bad { color: var(--bad); }
#tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 6px; scrollbar-width: none; }

/* Сетка 4 × 8 на весь экран под шапкой — та же, что в окне «Телефон» игры. */
#screen { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 8px; padding: 8px; }
/* Плитка — Theme.Window: S1, кромка Line2, скругление 12. */
.tile { background: rgba(12, 16, 21, .94); border: 1px solid var(--line2); border-radius: 12px; padding: 10px; min-width: 0; min-height: 0;
  overflow: hidden; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); display: flex; flex-direction: column; }
.tile h2 { margin: 0 0 8px; font-size: 15px; }
.tile.button { padding: 0; border: none; background: none; box-shadow: none; }
.tile.button button { width: 100%; height: 100%; min-height: 0; font-size: 15px; white-space: normal; overflow-wrap: break-word; hyphens: auto; }
.tile.soon, .soon { color: var(--dim); font-size: 14px; }

.bar { height: 8px; background: var(--well); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--good); width: 0; transition: width .2s; }
.bar.low > i { background: var(--bad); }
.hero-line { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--title); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge { font-size: 13px; padding: 2px 8px; border-radius: 6px; background: var(--s3); color: var(--text); border: 1px solid var(--line); }
.badge.combat { color: var(--bad); border-color: rgba(240, 138, 126, .45); }
.badge.afk { color: var(--warn); }

.timer { text-align: center; }
.timer .big { font-size: 46px; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--accent); line-height: 1.1; }
.timer .sub { color: var(--dim); font-size: 14px; }
.timer.done .big { color: var(--dim); }

.roster { display: flex; flex-direction: column; gap: 8px; }
.member { display: grid; grid-template-columns: 1fr 80px; gap: 8px; align-items: center; color: var(--title); }
.member .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.off { opacity: .45; }
.member .flag { color: var(--accent); margin-left: 4px; font-size: 12px; }

/* Чат — как окно чата клиента: вкладки игрока сверху, строки цветами источников, ввод с выбором канала. */
.chat { padding: 0 0 10px; overflow: hidden; background: rgba(17, 22, 28, .97); }
.chat .ctabs { display: flex; gap: 2px; overflow-x: auto; padding: 4px 6px 0; border-bottom: 1px solid var(--line2); scrollbar-width: none; }
.chat .log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; line-height: 1.35; overscroll-behavior: contain; }
.chat .row { word-wrap: break-word; color: var(--c-say); }
.chat .say { color: var(--c-say); } .chat .yell { color: var(--c-yell); } .chat .emote { color: var(--c-emote); }
.chat .party { color: var(--c-party); } .chat .raid { color: var(--c-raid); } .chat .guild { color: var(--c-guild); }
.chat .officer { color: var(--c-officer); } .chat .whisper, .chat .whisper_to { color: var(--c-whisper); }
.chat .channel { color: var(--c-channel); } .chat .system { color: var(--c-system); } .chat .npc { color: var(--c-npc); }
.chat .loot { color: var(--c-loot); }
.chat .send { display: grid; grid-template-columns: 112px 1fr auto; gap: 6px; padding: 0 10px; }
.chat .send.whisper { grid-template-columns: 112px 92px 1fr auto; }
.chat .send select, .chat .send input { padding: 7px 8px; }

#pair { padding: 18px; display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin: 0 auto; width: 100%; }
#pair h1 { margin: 6px 0 0; font-size: 24px; }
#pair label { display: flex; flex-direction: column; gap: 6px; color: var(--dim); font-size: 14px; }
#pair-go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.msg { min-height: 1.2em; color: var(--accent); }
.msg.bad { color: var(--bad); }
.hint { color: var(--dim); font-size: 13px; }
#foot { padding: 6px 10px 14px; text-align: center; }
/* Кнопка действия: название, перезарядка поверх, доступность — как у кнопок панелей (тусклая — нельзя, синяя — нет ресурса, красная — далеко). */
.tile.action button { position: relative; overflow: hidden; }
.tile.action .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--title);
  background: rgba(5, 7, 10, .62); }
.tile.action button.nopower { color: #8fb5ff; border-color: rgba(143, 181, 255, .5); }
.tile.action button.far { color: var(--bad); border-color: rgba(240, 138, 126, .5); }
.tile.action button.unusable { opacity: .45; }

/* Голос */
.voice .vrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.voice .vrow button { flex: 1 1 auto; }
.voice .ptt { touch-action: none; user-select: none; -webkit-user-select: none; }
.sub.warn { color: var(--warn); margin-top: 6px; }

/* Проверка готовности и приглашение — полоса под шапкой */
#prompt { position: sticky; top: 0; z-index: 3; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px;
  background: var(--s2); border-bottom: 1px solid var(--accent); }
#prompt .q { flex: 1 1 100%; color: var(--title); font-weight: 500; }
#prompt button { flex: 1 1 0; }

/* Осмотр — лист снизу, как окно (S1, кромка Line2) */
#sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow-y: auto; z-index: 5; padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  background: rgba(12, 16, 21, .98); border-top: 1px solid var(--line2); border-radius: 12px 12px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .5); }
#sheet .sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#sheet h2 { margin: 0; font-size: 20px; }
#sheet .ilvl { color: var(--accent); margin: 6px 0; }
#sheet .spec { color: var(--text); margin-bottom: 8px; }
#sheet .items { display: flex; flex-direction: column; gap: 4px; }
#sheet .item { display: flex; justify-content: space-between; gap: 8px; }
#sheet .item .lvl { color: var(--dim); }
/* Качество вещи — цвета 3.3.5 */
.q0 { color: #9d9d9d; } .q1 { color: #ffffff; } .q2 { color: #1eff00; } .q3 { color: #0070dd; } .q4 { color: #a335ee; } .q5 { color: #ff8000; } .q6, .q7 { color: #e6cc80; }
#foot { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

[hidden] { display: none !important; }

/* Ожидание подтверждения в игре: цифры сверки — крупно, это не код для ввода */
.match { font-size: 56px; font-weight: 500; letter-spacing: 10px; text-align: center; color: var(--accent); font-variant-numeric: tabular-nums; margin: 8px 0 16px; }
#pair-wait { display: flex; flex-direction: column; gap: 6px; }
#pair-form { display: flex; flex-direction: column; gap: 14px; }

/* Кнопка умения: иконка на всю клетку, перезарядка — тёмный сектор и секунды поверх. */
.tile.action button { padding: 0; display: block; }
.tile.action .ic { position: absolute; inset: 3px; border-radius: 8px; background-size: cover; background-position: center; }
.tile.action .an { padding: 4px; font-size: 13px; line-height: 1.15; }
.tile.action .sweep { position: absolute; inset: 3px; border-radius: 8px; }
.tile.action .cd { background: none; font-size: 22px; text-shadow: 0 1px 3px #000; }
.tile.action button:active { transform: scale(.96); }

/* Джойстик */
.tile.joy { padding: 6px; align-items: center; justify-content: center; }
.joy .base { position: relative; width: min(100%, 100%); aspect-ratio: 1; max-height: 100%; border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 216, 242, .10), rgba(5, 7, 10, .6)); border: 1px solid var(--line3); touch-action: none; }
.joy .base.on { border-color: var(--accent); }
.joy .knob { position: absolute; left: 30%; top: 30%; width: 40%; height: 40%; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(127, 216, 242, .18); transition: transform .05s; }
.jump { width: 100%; height: 100%; font-size: 15px; touch-action: none; }

.voice.compact { padding: 4px; justify-content: center; }
.voice.compact .vrow { margin-top: 0; height: 100%; }
.voice.compact .vrow button { min-height: 0; height: 100%; padding: 4px 8px; font-size: 13px; }

/* Камера — второй джойстик: та же форма, другой цвет ручки, чтобы не спутать с движением. */
.joy.cam .knob { background: var(--warn); box-shadow: 0 0 0 4px rgba(232, 196, 119, .18); }
