/* ============================================================
   ROHN-X — Dual-theme design system (light default · midnight dark)
   (legacy var names --gold* kept as aliases for the brand blue)
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f6f7fa;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #eef2f8;
  --line: #e7eaf1;
  --line2: #d8dee9;
  --gold: #2563eb;
  --gold-soft: #1d4ed8;
  --gold-deep: #1e40af;
  --gold-grad: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --gold-dim: rgba(37, 99, 235, 0.07);
  --tile-border: rgba(37, 99, 235, 0.16);
  --text: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --green: #15803d;
  --red: #dc2626;
  --amber: #d97706;
  --ghost-bg: #ffffff;
  --bar-bg: #e9edf5;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05);
  --glow: 0 0 0 1px rgba(37, 99, 235, 0.15), 0 8px 24px rgba(37, 99, 235, 0.10);
  --btn-glow: rgba(37, 99, 235, 0.25);
  --tabbar-bg: rgba(255, 255, 255, 0.92);
  --overlay: rgba(16, 24, 40, 0.45);
  --toast-bg: #101828;
  --toast-text: #ffffff;
  --toast-accent: #93b4f8;
  --toast-border: transparent;
  --logo-grad: linear-gradient(135deg, #101828 30%, #2563eb 80%, #60a5fa 100%);
  --aur1: rgba(37, 99, 235, 0.13);
  --aur2: rgba(59, 130, 246, 0.09);
  --aur3: rgba(147, 197, 253, 0.12);
  --scroll: #cfd6e2;
  --radius: 15px;
  --tabbar-h: 66px;
  --maxw: 660px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c12;
  --bg2: #0e1119;
  --card: #12151f;
  --card2: #181c2a;
  --line: rgba(255, 255, 255, 0.07);
  --line2: rgba(255, 255, 255, 0.13);
  --gold: #3b82f6;
  --gold-soft: #8ab0fa;
  --gold-deep: #2563eb;
  --gold-dim: rgba(59, 130, 246, 0.12);
  --tile-border: rgba(96, 165, 250, 0.22);
  --text: #eef1f8;
  --muted: #8b93a7;
  --faint: #5c6478;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --ghost-bg: rgba(255, 255, 255, 0.04);
  --bar-bg: rgba(255, 255, 255, 0.07);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25);
  --glow: 0 0 0 1px rgba(96, 165, 250, 0.25), 0 8px 30px rgba(59, 130, 246, 0.15);
  --btn-glow: rgba(59, 130, 246, 0.4);
  --tabbar-bg: rgba(12, 14, 21, 0.85);
  --overlay: rgba(4, 6, 12, 0.7);
  --toast-bg: #1a1f2e;
  --toast-text: #eef1f8;
  --toast-accent: #8ab0fa;
  --toast-border: rgba(96, 165, 250, 0.4);
  --logo-grad: linear-gradient(135deg, #ffffff 25%, #93b4f8 60%, #3b82f6 100%);
  --aur1: rgba(59, 130, 246, 0.30);
  --aur2: rgba(37, 99, 235, 0.22);
  --aur3: rgba(147, 197, 253, 0.14);
  --scroll: #232838;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(800px 400px at 50% -120px, var(--aur2), transparent 70%),
    radial-gradient(600px 500px at 105% 105%, var(--aur3), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
b { font-weight: 700; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: var(--text); }
svg { display: inline-block; vertical-align: middle; }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; font-weight: 600; font-size: 15px;
  padding: 12px 22px; transition: transform .12s ease, box-shadow .25s ease, background .2s, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn-gold {
  background: var(--gold-grad); color: #ffffff;
  box-shadow: 0 4px 18px var(--btn-glow);
}
.btn-gold:hover { box-shadow: 0 6px 26px var(--btn-glow); }
.btn-ghost {
  background: var(--ghost-bg); border: 1px solid var(--line2); color: var(--text);
  box-shadow: var(--shadow-card);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-soft); }
.btn-lg { padding: 15px 34px; font-size: 16px; border-radius: 13px; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }

.input {
  width: 100%; background: var(--ghost-bg); border: 1px solid var(--line2);
  border-radius: 12px; padding: 13px 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.input-lg { font-size: 18px; padding: 16px 18px; text-align: center; }
.input::placeholder { color: var(--faint); }
select.input { appearance: none; }
select.input option { background: var(--card); color: var(--text); }

/* ---------- Icon tiles (shared) ---------- */
.track-icon, .ch-icon, .c-ic, .qr-icon, .fire {
  display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--gold-dim); color: var(--gold-soft);
  border: 1px solid var(--tile-border);
}
.track-icon, .ch-icon { width: 48px; height: 48px; border-radius: 13px; }
.c-ic { width: 44px; height: 44px; border-radius: 12px; }
.qr-icon { width: 60px; height: 60px; border-radius: 50%; }
.fire { width: 54px; height: 54px; border-radius: 15px; background: rgba(245,158,11,.12); color: var(--amber); border-color: rgba(245,158,11,.25); }

/* ---------- Onboarding ---------- */
#onboarding {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.ob-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(700px 450px at 50% 0%, var(--aur1), transparent 65%);
}
.ob-step { position: relative; width: 100%; max-width: 500px; padding: 32px 26px; animation: fadeUp .5s ease both; }
.ob-center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.ob-logo {
  font-size: clamp(54px, 14vw, 76px); font-weight: 800; letter-spacing: 2px; line-height: 1.05;
  background: var(--logo-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ob-mini-logo { font-size: 18px; font-weight: 800; letter-spacing: 3px; color: var(--text); margin-bottom: 6px; }
.ob-note { font-size: 12.5px; color: var(--faint); }
.ob-step h2 { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
#ob-2 .input-lg { max-width: 340px; }

.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin: 6px 0 10px; }
.goal-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; transition: all .18s ease;
  box-shadow: var(--shadow-card);
}
.goal-card .g-icon { display: flex; justify-content: center; color: var(--gold-soft); margin-bottom: 10px; }
.goal-card .g-title { font-weight: 700; font-size: 16px; }
.goal-card .g-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.goal-card.sel { border-color: var(--gold); background: var(--gold-dim); box-shadow: var(--glow); }

/* ---------- Welcome hero ---------- */
.ob-hero { max-width: 680px; }
.hero-aurora i {
  position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: -1;
}
.hero-aurora i:nth-child(1) { width: 400px; height: 400px; top: -140px; left: -100px; background: var(--aur1); animation: aur1 16s ease-in-out infinite alternate; }
.hero-aurora i:nth-child(2) { width: 340px; height: 340px; bottom: -120px; right: -80px; background: var(--aur2); animation: aur2 20s ease-in-out infinite alternate; }
.hero-aurora i:nth-child(3) { width: 240px; height: 240px; top: 45%; left: 62%; background: var(--aur3); animation: aur3 24s ease-in-out infinite alternate; }
@keyframes aur1 { to { transform: translate(70px, 50px) scale(1.15); } }
@keyframes aur2 { to { transform: translate(-60px, -40px) scale(1.1); } }
@keyframes aur3 { to { transform: translate(-50px, 30px) scale(0.9); } }

.hero > * { animation: fadeUp .7s ease both; }
.hero > *:nth-child(1) { animation-delay: .05s; }
.hero > *:nth-child(2) { animation-delay: .15s; }
.hero > *:nth-child(3) { animation-delay: .28s; }
.hero > *:nth-child(4) { animation-delay: .4s; }
.hero > *:nth-child(5) { animation-delay: .52s; }
.hero > *:nth-child(6) { animation-delay: .64s; }

.hero-badge {
  font-size: 10.5px; letter-spacing: 4px; color: var(--gold-soft); font-weight: 700;
  border: 1px solid var(--tile-border); border-radius: 999px; padding: 7px 16px;
  background: var(--gold-dim);
}
.hero .ob-logo { background-size: 200% auto; animation: fadeUp .7s ease both, shine 6s linear 1s infinite; animation-delay: .15s, 1s; }
@keyframes shine { to { background-position: 200% center; } }
.hero-sub { font-size: 18px; color: var(--muted); line-height: 1.7; font-weight: 300; }
.hero-sub b { color: var(--text); font-weight: 600; }
.hero-br { display: none; }
@media (min-width: 560px) { .hero-br { display: inline; } }

.hero-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 470px; margin-top: 4px; }
.feat {
  display: flex; align-items: center; gap: 10px;
  background: var(--ghost-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; font-size: 13.5px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow-card);
}
.feat svg { width: 18px; height: 18px; color: var(--gold-soft); flex: none; }

.hero-cta { margin-top: 6px; animation: fadeUp .7s ease both, ctaGlow 3s ease-in-out 1.4s infinite; animation-delay: .52s, 1.4s; }
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 4px 18px var(--btn-glow); }
  50% { box-shadow: 0 4px 36px var(--btn-glow); }
}
.hero-stats { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; letter-spacing: .4px; flex-wrap: wrap; justify-content: center; }
.hero-stats i { width: 3px; height: 3px; border-radius: 50%; background: var(--line2); }

/* ---------- Shell / topbar / tabbar ---------- */
#shell { position: relative; z-index: 1; }
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 14px 18px 10px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.tb-logo { font-size: 18px; font-weight: 800; letter-spacing: 2px; color: var(--text); }
.tb-logo span { color: var(--gold); }
.tb-right { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted);
  box-shadow: var(--shadow-card);
}
.pill b { color: var(--text); }
.pill-xp b { color: var(--gold-soft); }
.pill-streak svg { color: var(--amber); }
.pill-toggle { cursor: pointer; padding: 5px 11px; transition: border-color .15s; }
.pill-toggle svg { color: var(--muted); }
.pill-toggle:hover { border-color: var(--gold); }
.pill-toggle:hover svg { color: var(--gold-soft); }

#main {
  max-width: var(--maxw); margin: 0 auto;
  padding: 6px 18px calc(var(--tabbar-h) + 28px);
  position: relative; z-index: 1;
}
.screen { display: none; animation: fadeUp .35s ease both; }
.screen.active { display: block; }

#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw); height: var(--tabbar-h); z-index: 30;
  display: flex; align-items: stretch;
  background: var(--tabbar-bg); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: .3px;
  transition: color .18s;
}
.tab svg { width: 21px; height: 21px; fill: currentColor; }
.tab.active { color: var(--gold-soft); }
.tab-ai .ai-orb {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--gold-grad); margin-top: -26px;
  box-shadow: 0 4px 20px var(--btn-glow), 0 0 0 5px var(--bg);
  transition: transform .15s;
}
.tab-ai .ai-orb svg { fill: #ffffff; width: 22px; height: 22px; }
.tab-ai.active .ai-orb { transform: scale(1.07); }
.tab-ai.active { color: var(--gold-soft); }

/* ---------- Cards & common ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.card-gold {
  background: linear-gradient(150deg, var(--gold-dim), transparent 60%), var(--card);
  border: 1px solid var(--tile-border);
}
.section-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: 2px; color: var(--faint);
  margin: 26px 0 10px; text-transform: uppercase;
}
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }

.bar { height: 6px; border-radius: 99px; background: var(--bar-bg); overflow: hidden; }
.bar > div { height: 100%; border-radius: 99px; background: var(--gold-grad); transition: width .5s ease; }

/* ---------- Home ---------- */
.greet h1 { font-size: 26px; font-weight: 700; letter-spacing: -.6px; margin-top: 6px; }
.greet p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.level-card .lvl-num {
  width: 50px; height: 50px; border-radius: 14px; flex: none;
  background: var(--gold-grad); color: #ffffff; font-weight: 800; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px var(--btn-glow);
}
.lvl-label { font-size: 11px; color: var(--muted); letter-spacing: 1.2px; font-weight: 600; }
.lvl-name { font-weight: 700; font-size: 16.5px; }
.lvl-next { font-size: 12px; color: var(--muted); margin-top: 6px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; text-align: left; transition: border-color .18s, transform .12s, box-shadow .2s;
  box-shadow: var(--shadow-card);
}
.quick:hover { border-color: var(--tile-border); box-shadow: var(--glow); }
.quick:active { transform: scale(.98); }
.quick .q-icon { display: inline-flex; color: var(--gold-soft); }
.quick .q-title { font-weight: 700; font-size: 14.5px; margin-top: 10px; }
.quick .q-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; text-align: center; box-shadow: var(--shadow-card); }
.stat .s-num { font-size: 22px; font-weight: 800; letter-spacing: -.5px; color: var(--gold-soft); }
.stat .s-label { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Academy ---------- */
.track-card { transition: border-color .18s, transform .12s, box-shadow .2s; cursor: pointer; }
.track-card:hover { border-color: var(--tile-border); box-shadow: var(--glow); }
.track-card:active { transform: scale(.995); }
.track-pillar { font-size: 10.5px; font-weight: 700; letter-spacing: 2px; color: var(--gold-soft); }
.track-title { font-weight: 700; font-size: 16px; margin-top: 1px; }
.track-title .title-cert { color: var(--gold-soft); margin-left: 2px; }
.track-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.track-meta { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; justify-content: space-between; }

/* lesson list inside sheet */
.lesson-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 10px; transition: border-color .18s;
  box-shadow: var(--shadow-card);
}
.lesson-item:hover { border-color: var(--tile-border); }
.lesson-check {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent; font-weight: 800;
}
.lesson-item.done .lesson-check { background: var(--gold-grad); border-color: transparent; color: #ffffff; }
.lesson-t { font-weight: 600; font-size: 15px; }
.lesson-m { font-size: 12px; color: var(--muted); }

/* lesson content */
.lesson-sec {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 12px; font-size: 15px; line-height: 1.75;
  animation: fadeUp .4s ease both;
  box-shadow: var(--shadow-card);
}

/* quiz */
.quiz-q { font-size: 19px; font-weight: 700; margin: 10px 0 16px; line-height: 1.5; letter-spacing: -.3px; }
.quiz-progress { font-size: 11.5px; letter-spacing: 2px; color: var(--gold-soft); font-weight: 700; margin-top: 8px; }
.quiz-opt {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1.5px solid var(--line2); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; font-size: 15px; color: var(--text);
  transition: all .15s;
  box-shadow: var(--shadow-card);
}
.quiz-opt:hover { border-color: var(--gold); background: var(--gold-dim); }
.quiz-opt.correct { border-color: var(--green); background: rgba(74, 222, 128, .1); }
.quiz-opt.wrong { border-color: var(--red); background: rgba(248, 113, 113, .08); }
.quiz-opt:disabled { pointer-events: none; opacity: .92; }
.quiz-result { text-align: center; padding: 28px 10px; animation: fadeUp .4s ease both; }
.quiz-result h3 { font-size: 26px; letter-spacing: -.5px; margin: 12px 0 4px; }

/* ---------- AI chat ---------- */
#screen-ai.active { display: flex; flex-direction: column; height: calc(100dvh - 62px - var(--tabbar-h) - 34px); }
.mode-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; flex: none; }
.mode-chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 999px;
  padding: 8px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: all .15s;
  box-shadow: var(--shadow-card);
}
.chip svg { color: currentColor; }
.chip.active { background: var(--gold-grad); border-color: transparent; color: #ffffff; box-shadow: 0 2px 12px var(--btn-glow); }
#chat-msgs { flex: 1; overflow-y: auto; padding: 6px 2px 12px; }
.msg { max-width: 86%; margin-bottom: 12px; animation: fadeUp .3s ease both; }
.msg .m-bubble {
  padding: 12px 16px; border-radius: 16px; font-size: 14.5px; line-height: 1.6;
  word-wrap: break-word; overflow-wrap: break-word;
}
.msg.user { margin-left: auto; }
.msg.user .m-bubble { background: var(--gold-grad); color: #ffffff; border-bottom-right-radius: 5px; }
.msg.ai .m-bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: var(--shadow-card); }
.m-bubble p { margin-bottom: 8px; } .m-bubble p:last-child { margin-bottom: 0; }
.m-bubble ul, .m-bubble ol { margin: 4px 0 8px 20px; }
.m-bubble li { margin-bottom: 4px; }
.m-bubble code { background: var(--gold-dim); border-radius: 5px; padding: 1px 6px; font-size: 13px; }
.msg.ai .m-bubble b, .msg.ai .m-bubble strong { color: var(--gold-soft); }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); opacity: .4; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.composer { display: flex; gap: 10px; flex: none; padding-top: 8px; }
.composer input { flex: 1; }
.composer .send-btn {
  width: 48px; height: 48px; border-radius: 12px; flex: none;
  background: var(--gold-grad); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px var(--btn-glow); transition: transform .12s, box-shadow .2s;
}
.composer .send-btn:active { transform: scale(.94); }
.composer .send-btn svg { width: 20px; height: 20px; fill: #ffffff; }
.ai-empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.demo-note { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0 2px; flex: none; }
.demo-note a { color: var(--gold-soft); cursor: pointer; text-decoration: underline; }

/* ---------- Challenges ---------- */
.streak-hero { display: flex; align-items: center; gap: 16px; }
.streak-hero .s-count { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.streak-hero .s-sub { color: var(--muted); font-size: 13px; }
.ch-title { font-weight: 700; font-size: 15px; }
.ch-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ch-xp { font-size: 12px; font-weight: 700; color: var(--gold-soft); flex: none; }
.ch-done-tag {
  font-size: 12px; font-weight: 700; color: var(--green); flex: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.ch-card.done { opacity: .55; }

/* ---------- Work Hub ---------- */
.seg-control {
  display: flex; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; padding: 5px; margin-top: 14px; margin-bottom: 4px;
  overflow-x: auto; scrollbar-width: none;
  box-shadow: var(--shadow-card);
}
.seg-control::-webkit-scrollbar { display: none; }
.seg {
  flex: 1; padding: 9px 8px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); white-space: nowrap; transition: all .15s;
}
.seg.active { background: var(--gold-dim); color: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--tile-border); }
.job-best { font-size: 12px; color: var(--gold-soft); margin-top: 4px; }
a.btn { text-decoration: none; }
.form-grid { display: grid; gap: 10px; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.status-select { width: auto; padding: 7px 10px; font-size: 12.5px; border-radius: 9px; flex: none; }
.status-select.st-won { color: var(--green); border-color: rgba(74,222,128,.5); }
.status-select.st-lost { color: var(--red); border-color: rgba(248,113,113,.45); }
.status-select.st-talking { color: var(--gold-soft); border-color: var(--tile-border); }
.status-select.st-pitched { color: var(--amber); border-color: rgba(245,158,11,.45); }
.x-btn { color: var(--faint); font-size: 14px; padding: 6px 9px; border-radius: 8px; flex: none; transition: all .15s; }
.x-btn:hover { color: var(--red); background: rgba(248,113,113,.08); }
.earn-amt { color: var(--green); font-weight: 800; font-size: 15px; flex: none; }
.prop-out { min-height: 220px; resize: vertical; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }

/* ---------- Profile ---------- */
.id-card {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #2f6ff5 0%, #2563eb 55%, #1e3a8a 100%);
  border: none; border-radius: 20px; padding: 22px;
  color: #ffffff;
  box-shadow: 0 12px 36px rgba(37,99,235,.3);
}
.id-card::after {
  content: "ROHN·X"; position: absolute; right: -14px; bottom: -26px;
  font-size: 74px; font-weight: 800; letter-spacing: 3px; color: rgba(255,255,255,.07);
  pointer-events: none;
}
.avatar {
  width: 60px; height: 60px; border-radius: 50%; flex: none;
  background: #ffffff; color: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
}
.id-name { font-size: 20px; font-weight: 800; color: #ffffff; letter-spacing: -.2px; }
.id-sub { font-size: 12.5px; color: rgba(255,255,255,.78); margin-top: 2px; }
.id-code { font-size: 12px; letter-spacing: 2px; color: rgba(255,255,255,.92); font-weight: 700; margin-top: 8px; }

.skill-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-chip {
  background: var(--gold-dim); border: 1px solid var(--tile-border); color: var(--gold-soft);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600;
}
.skill-empty { color: var(--muted); font-size: 13.5px; }

.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge-cell { text-align: center; padding: 12px 4px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-card); }
.badge-cell .b-ic {
  width: 42px; height: 42px; margin: 0 auto 7px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-dim); border: 1px solid var(--tile-border); color: var(--gold-soft);
}
.badge-cell .b-name { font-size: 10.5px; font-weight: 600; color: var(--text); line-height: 1.25; }
.badge-cell.locked { opacity: .38; filter: grayscale(1); }

.cert-item { display: flex; align-items: center; gap: 12px; }
.cert-t { font-weight: 700; font-size: 14.5px; }
.cert-d { font-size: 12px; color: var(--muted); }

.invite-code {
  font-size: 21px; font-weight: 800; letter-spacing: 4px; text-align: center;
  color: var(--gold-soft); background: var(--gold-dim); border: 1px dashed var(--tile-border);
  border-radius: 12px; padding: 14px; margin: 12px 0;
}
.settings-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .8px; margin: 14px 0 6px; }
.settings-help { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.settings-help a { color: var(--gold-soft); }

/* ---------- Sheet ---------- */
#sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); animation: slideUp .28s ease both; }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-inner { max-width: var(--maxw); margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px; flex: none; }
.btn-back {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--bg2); border: 1px solid var(--line2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.btn-back:hover { border-color: var(--gold); }
.btn-back svg { width: 18px; height: 18px; }
.sheet-title { font-weight: 700; font-size: 17px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 18px 40px; }

/* ---------- Modal ---------- */
#modal {
  position: fixed; inset: 0; z-index: 60; background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(6px); animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--bg2); border: 1px solid var(--tile-border); border-radius: 20px;
  padding: 30px 26px; max-width: 440px; width: 100%; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
  animation: pop .35s cubic-bezier(.2,1.4,.4,1) both;
  max-height: 90dvh; overflow-y: auto;
}
@keyframes pop { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card h3 { font-size: 21px; margin: 10px 0 4px; letter-spacing: -.3px; }
.modal-card .md-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.modal-card canvas { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line2); margin-bottom: 16px; }

/* ---------- Toasts ---------- */
#toasts {
  position: fixed; bottom: calc(var(--tabbar-h) + 16px); left: 50%; transform: translateX(-50%);
  z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: 92vw; pointer-events: none;
}
.toast {
  background: var(--toast-bg); border: 1px solid var(--toast-border); color: var(--toast-text);
  border-radius: 999px; padding: 10px 20px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,.3);
  animation: toastIn .3s ease both;
}
.toast b { color: var(--toast-accent); }
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.out { transition: opacity .4s, transform .4s; opacity: 0; transform: translateY(8px); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 420px) {
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   DESKTOP — sidebar layout (≥1024px)
   ============================================================ */
@media (min-width: 1024px) {
  :root, :root[data-theme="dark"] { --tabbar-h: 0px; --maxw: 860px; }

  /* sidebar */
  #tabbar {
    left: 0; top: 0; bottom: 0; transform: none;
    width: 232px; height: 100vh; max-width: none;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 4px; padding: 86px 14px 20px;
    background: var(--bg2);
    border-top: none; border-right: 1px solid var(--line);
  }
  #tabbar::before {
    content: "ROHN·X";
    position: absolute; top: 28px; left: 28px;
    font-size: 20px; font-weight: 800; letter-spacing: 2.5px; color: var(--text);
  }
  #tabbar::after {
    content: "THE INTELLIGENT GROWTH OS";
    position: absolute; top: 58px; left: 28px;
    font-size: 8.5px; letter-spacing: 1.8px; color: var(--faint); font-weight: 600;
  }
  .tab {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 11px 14px; border-radius: 11px; font-size: 14px; letter-spacing: 0;
    color: var(--muted);
  }
  .tab:hover { color: var(--text); background: var(--gold-dim); }
  .tab.active { background: var(--gold-dim); color: var(--gold-soft); }
  .tab svg { width: 20px; height: 20px; }
  .tab-ai .ai-orb {
    width: 30px; height: 30px; margin: -5px 0 -5px -5px;
    box-shadow: 0 2px 10px var(--btn-glow);
  }
  .tab-ai .ai-orb svg { width: 16px; height: 16px; }

  /* content offset */
  #topbar {
    margin-left: 232px; max-width: none; padding: 26px 48px 10px;
    justify-content: flex-end;
  }
  .tb-logo { display: none; }
  #main {
    margin-left: 232px; max-width: none;
    padding: 4px 48px 60px;
  }
  #main .screen { max-width: 760px; }
  .greet h1 { font-size: 30px; }

  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .badge-grid { grid-template-columns: repeat(6, 1fr); }

  #screen-ai.active { height: calc(100vh - 120px); max-width: 760px; }

  #sheet { left: 232px; border-left: 1px solid var(--line); }
  .sheet-inner { max-width: 800px; padding: 0 24px; }

  #toasts { bottom: 28px; left: calc(50% + 116px); }
}
