.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 68px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; min-width: 0; }
.logo { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 2px 8px rgba(14, 42, 77, .12); }
.logo img { width: 30px; height: 32px; object-fit: contain; display: block; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 18px; }
.brand-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.clock { color: var(--muted); font-size: 14px; margin-inline-end: 6px; white-space: nowrap; }
.user-chip { border: 0; padding: 2px; border-radius: 50%; background: none; cursor: pointer; }
.user-chip:focus-visible { outline: none; box-shadow: var(--focus); }

main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.page-loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }

/* ---------- login ---------- */
.login-wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; min-height: calc(100vh - 170px); }
.login-hero h1, .hero h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: -.01em; }
.lead { font-size: 17px; color: var(--muted); margin: 12px 0 20px; max-width: 58ch; }
.features { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.features li { display: flex; align-items: center; gap: 12px; }
.features li .ic { color: var(--brand); background: var(--brand-50); padding: 7px; border-radius: 10px; width: 34px; height: 34px; }
.art-wrap { max-width: 520px; }
.art { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 30px rgba(16, 24, 40, .18)); }
.login-hero .art-wrap { display: none; }
.login-card { padding: 32px; display: grid; gap: 16px; max-width: 440px; width: 100%; justify-self: end; }
.login-card h2 { font-size: 24px; }
.login-card > p { margin: 0; }
.stack { display: grid; gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check.sm { font-size: 13px; color: var(--muted); gap: 8px; }
.check.sm .switch { transform: scale(.85); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.error { color: var(--danger); min-height: 1.5em; margin: 0; font-weight: 500; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.gbtn { min-height: 44px; display: flex; justify-content: center; }

/* ---------- dashboard ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; margin-bottom: 36px; }
.eyebrow { margin: 0 0 8px; font-weight: 600; color: var(--brand); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.code-form { position: relative; display: flex; align-items: center; gap: 4px; flex: 1; min-width: 260px; max-width: 380px; }
.code-form .input { height: 48px; padding-inline-start: 44px; }
.code-ic { position: absolute; inset-inline-start: 14px; color: var(--muted); pointer-events: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--text); }
.section-title { font-size: 18px; margin: 8px 0 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 56px 16px; color: var(--muted); }
.empty p { max-width: 52ch; margin: 0; }

.m-card { padding: 16px; display: grid; gap: 12px; transition: box-shadow .15s, transform .15s; }
.m-card:hover { box-shadow: var(--shadow-2); }
.m-card.link { color: inherit; text-decoration: none !important; }
.m-head { display: flex; align-items: flex-start; gap: 12px; }
.m-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-50); color: var(--brand); flex: none; }
.m-title { min-width: 0; flex: 1; }
.m-title h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.m-meta { font-size: 13.5px; min-height: 22px; }
.m-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.r-card { overflow: hidden; display: grid; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #1b2230; color: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; opacity: .5; }
.thumb .dur { position: absolute; bottom: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.75); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; direction: ltr; }
.thumb .dur.warn { background: var(--gold); color: #1b1b1b; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; background: rgba(0,0,0,.3); transition: opacity .15s; }
.thumb:hover .play { opacity: 1; }
.thumb[aria-disabled="true"] { pointer-events: none; }
.r-body { padding: 12px 14px 10px; display: grid; gap: 4px; }
.r-body h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-body p { margin: 0; font-size: 13px; }
.r-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.spacer { flex: 1; }

.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.end { text-align: end; }

.link-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--surface-2); font-family: ui-monospace, Consolas, monospace; font-size: 14px; direction: ltr; }
.link-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- watch page ---------- */
.watch { max-width: 1000px; margin: 0 auto; display: grid; gap: 16px; }
.watch video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 16 / 9; }
.watch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.watch-head h1 { font-size: 22px; }

@media (max-width: 900px) {
  .login-wrap, .hero { grid-template-columns: 1fr; gap: 28px; }
  .login-card { justify-self: stretch; max-width: none; }
  .hero .art-wrap { display: none; }
  .clock { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 16px; height: 60px; }
  main { padding: 20px 16px 48px; }
  .brand-text small { display: none; }
  .login-card { padding: 22px; }
  .code-form { max-width: none; min-width: 0; width: 100%; }
  .hero-actions > .btn { width: 100%; }
  .grid { grid-template-columns: 1fr; }
}
