/* Look of TakeiViewer/ui/dist/style.css (tokens copied). Fonts come from
   /fonts/, which the server mounts from ui/dist/fonts (--fonts). */
@font-face {
  font-family: "Google Sans";
  src: url("/fonts/GoogleSans-vietnamese.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Google Sans";
  src: url("/fonts/GoogleSans-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Google Sans";
  src: url("/fonts/GoogleSans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0F1218;
  --card: #161A22;
  --card-border: #252B37;
  --field: #0F1218;
  --field-border: #333B4A;
  --raised: #1F2531;
  --raised-hover: #283041;
  --text: #E6E9EF;
  --text-strong: #FFFFFF;
  --text-muted: #9AA3B5;
  --text-soft: #C9D0DD;
  --accent: #2F5BD3;
  --accent-hover: #3D6AE6;
  --accent-text: #7FA3FF;
  --on-accent: #FFFFFF;
  --ok: #3DD26B;
  --warn: #F5B841;
  --danger: #FF5A63;
  --danger-text: #FF9EA3;
  --danger-bg: #2A1416;
  --danger-border: #5A2328;
  --radius: 12px;
  --radius-sm: 10px;
  --font: "Google Sans", system-ui, sans-serif;
  --code: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Connect screen */
.connect { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 24px 26px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card h1 { margin: 0; font-size: 20px; font-weight: 600; color: var(--text-strong); }
.sub { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-soft); }
.input { height: 44px; padding: 0 14px; border: 1px solid var(--field-border); border-radius: var(--radius-sm); background: var(--field); color: var(--text-strong); font-size: 15px; }
.input.id { font-size: 20px; font-weight: 600; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.input:focus { outline: none; border: 2px solid var(--accent); padding: 0 13px; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.btn { height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline { background: var(--raised); border-color: var(--field-border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--raised-hover); }
.btn-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-lg { height: 48px; border-radius: var(--radius-sm); font-size: 16px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.lang-toggle { flex: none; width: 40px; height: 32px; border: 1px solid var(--field-border); border-radius: 8px; background: var(--raised); color: var(--text-soft); font-size: 12px; font-weight: 600; cursor: pointer; }
.msg { margin: 0; min-height: 20px; font-size: 13px; color: var(--text-muted); }
.msg.error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); }
.msg:empty { display: none; }
.note { margin: 0; font-size: 12px; color: var(--text-muted); }

/* Session screen */
.session { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.bar { flex: none; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--card); border-bottom: 1px solid var(--card-border); overflow-x: auto; }
.bar > .btn { flex: none; }
.bar .title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--text-soft); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar .title b { color: var(--text-strong); font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--warn); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }
.stage-row { flex: 1; min-height: 0; display: flex; }
.stage { position: relative; flex: 1; min-width: 0; min-height: 0; }
video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; outline: none; cursor: default; touch-action: none; }
.stats { position: absolute; top: 10px; right: 10px; margin: 0; padding: 10px 12px; max-width: calc(100% - 20px); border-radius: var(--radius-sm); background: rgba(15, 18, 24, .88); border: 1px solid var(--card-border); color: var(--text-soft); font: 600 12px/1.5 var(--code); white-space: pre; pointer-events: none; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); pointer-events: none; }
:fullscreen .bar { display: none; }

/* Account pages */
.link { align-self: center; font-size: 13px; color: var(--accent-text); text-decoration: none; }
.link:hover { text-decoration: underline; }
a.btn { text-decoration: none; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.page { max-width: 880px; margin: 0 auto; padding: 32px 24px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; color: var(--text-strong); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg.ok { padding: 10px 12px; border-radius: var(--radius-sm); background: #12261A; border: 1px solid #22553A; color: #9BE3B4; }
.devices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.device { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); }
.device .dot { width: 10px; height: 10px; background: var(--text-muted); }
.device .dot.ok { background: var(--ok); }
.device .dot.bad { background: var(--danger); }
.device-main { flex: 1; min-width: 0; }
.device-name { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-meta { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.device-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.device.revoked .device-name { color: var(--text-muted); text-decoration: line-through; }
.empty { margin: 24px 0; text-align: center; color: var(--text-muted); }
.found { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--raised); border: 1px solid var(--field-border); }
.found p { margin: 0; }
.found-title { font-size: 12px; color: var(--text-muted); }
.found-name { margin-top: 4px !important; font-size: 17px; font-weight: 600; color: var(--text-strong); }
.dialog { padding: 0; border: none; background: transparent; color: var(--text); }
.dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog .card { width: min(420px, calc(100vw - 32px)); }
.dialog h1 { font-size: 18px; }
@media (max-width: 560px) {
  .device { flex-wrap: wrap; }
  .device-actions { width: 100%; justify-content: flex-start; }
}
/* Session tools (M4) */
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.btn[aria-pressed="true"] { background: #1B2A4D; border-color: var(--accent); color: var(--text-strong); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.screens { flex: none; display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--field); border: 1px solid var(--field-border); }
.seg { height: 26px; padding: 0 10px; border: none; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer; white-space: nowrap; }
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); padding: 8px 14px; border-radius: var(--radius-sm); background: #2B2412; border: 1px solid #6B5320; color: #F5D58A; font-size: 13px; pointer-events: none; }
.notes { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100% - 20px)); }
.note-card { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: var(--radius-sm); background: rgba(22, 26, 34, .95); border: 1px solid var(--card-border); color: var(--text-soft); font-size: 13px; }
.note-card > span { flex: 1; }
.files { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow-y: auto; }
.file-card { padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(22, 26, 34, .95); border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 6px; }
.file-card p { margin: 0; }
.file-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: var(--text-muted); }
.file-card.done .file-meta { color: #9BE3B4; }
.file-card.error .file-meta, .file-card.rejected .file-meta, .file-card.canceled .file-meta { color: var(--danger-text); }
.progress { height: 4px; border-radius: 2px; background: var(--field-border); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.file-card.done .progress > span { background: var(--ok); }
.file-actions { display: flex; gap: 6px; justify-content: flex-end; }
.drop-hint { position: absolute; inset: 10px; display: none; align-items: center; justify-content: center; border: 2px dashed var(--accent-text); border-radius: var(--radius); background: rgba(47, 91, 211, .12); color: var(--text-strong); font-size: 16px; font-weight: 600; pointer-events: none; }
.stage.drop .drop-hint { display: flex; }
.side { flex: none; width: 320px; display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--card-border); }
.side-head { flex: none; height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 14px; border-bottom: 1px solid var(--card-border); }
.side-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 85%; display: flex; flex-direction: column; gap: 2px; }
.chat-msg.out { align-self: flex-end; align-items: flex-end; }
.chat-msg .who { font-size: 11px; color: var(--text-muted); }
.chat-msg p { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--raised); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.out p { background: #1B2A4D; }
.chat-form { flex: none; display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--card-border); }
.chat-form .input { flex: 1; min-width: 0; height: 36px; font-size: 14px; }
.chat-form .input:focus { padding: 0 13px; }
.textarea { height: auto; padding: 10px 14px; resize: vertical; font: 400 14px/1.45 var(--code); }
.textarea:focus { padding: 9px 13px; }
@media (max-width: 760px) {
  .side { position: absolute; inset: 44px 0 0 auto; width: min(320px, 100%); z-index: 2; }
}
