/* Ganiam Academy — AI Lab. Dark neon, phone-first (360px up). */
:root {
  --bg: #0b0f2a;
  --bg2: #121741;
  --card: #171d4f;
  --card2: #1f2766;
  --line: #2c3580;
  --text: #eef0ff;
  --muted: #9aa3d9;
  --neon: #22f2d1;      /* teal */
  --neon2: #a46bff;     /* purple */
  --hot: #ff4fa3;       /* pink */
  --gold: #ffd166;
  --danger: #ff5c7a;
  --ok: #3ddc97;
  --radius: 16px;
  --tabbar: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 16px/1.45 var(--font); color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, #2a1a6b 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 20%, #0d3b5a 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
}
a { color: var(--neon); text-decoration: none; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Layout */
.page { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(var(--tabbar) + 24px); }
.page.bare { padding-bottom: 24px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(11, 15, 42, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-weight: 800; color: var(--text); letter-spacing: .5px; }
.logo { color: var(--neon); text-shadow: 0 0 10px var(--neon); }
.meters { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .85rem; white-space: nowrap; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14, 18, 52, .96); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .72rem; color: var(--muted); gap: 2px; }
.tabbar a span { font-size: 1.35rem; filter: grayscale(.6); }
.tabbar a.on { color: var(--neon); }
.tabbar a.on span { filter: none; transform: translateY(-1px); }

/* Cards & UI */
.card { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.glow { border-color: var(--neon); box-shadow: 0 0 0 1px rgba(34,242,209,.25), 0 0 28px rgba(34,242,209,.15); }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 18px;
  border: 0; border-radius: 14px; font: 700 1rem var(--font); color: #071022; cursor: pointer;
  background: linear-gradient(90deg, var(--neon), #6ef7ff); box-shadow: 0 6px 20px rgba(34,242,209,.25);
  -webkit-tap-highlight-color: transparent; transition: transform .08s;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.alt { background: linear-gradient(90deg, var(--neon2), var(--hot)); color: #fff; box-shadow: 0 6px 20px rgba(164,107,255,.3); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input, textarea, select {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: #0e1238; color: var(--text);
  font: 16px var(--font); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--neon); }
textarea { min-height: 96px; resize: vertical; }
.pin { letter-spacing: 8px; font-size: 1.4rem; text-align: center; }
.flash { background: var(--card2); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.error { color: var(--danger); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--card2); border: 1px solid var(--line); }
.pill.neon { color: var(--neon); border-color: var(--neon); }
.pill.gold { color: var(--gold); border-color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: 600 .85rem var(--font); cursor: pointer; }
.chips button.on { border-color: var(--neon); color: var(--neon); background: rgba(34,242,209,.08); }

/* XP bar */
.bar { height: 10px; background: #0e1238; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--neon2), var(--neon)); border-radius: 999px; transition: width .6s; }

/* Today */
.mission-hero { position: relative; overflow: hidden; }
.mission-hero .day { font-family: var(--display); font-size: .85rem; color: var(--neon); letter-spacing: 2px; text-transform: uppercase; }
.mission-hero h1 { font-size: 1.8rem; margin: 4px 0 6px; }
.countdown { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; color: var(--gold); }
.locked-ico { font-size: 2.4rem; }
.path { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.node { aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem;
  background: #0e1238; border: 2px solid var(--line); color: var(--muted); }
.node.done { background: var(--neon); border-color: var(--neon); color: #071022; }
.node.part { border-color: var(--neon); color: var(--neon); }
.node.now { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 14px rgba(255,209,102,.5); animation: pulse 1.6s infinite; }
.node.boss { border-style: dashed; }
@keyframes pulse { 50% { box-shadow: 0 0 2px rgba(255,209,102,.2); } }

/* Mission player */
.player-top { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0; display: flex; gap: 10px; align-items: center; }
.player-top .bar { flex: 1; }
.x { font-size: 1.4rem; color: var(--muted); padding: 4px 8px; }
.story { position: relative; border-radius: 20px; overflow: hidden; background: var(--card); border: 1px solid var(--line); min-height: 60vh; display: flex; flex-direction: column; }
.story .art { aspect-ratio: 1; width: 100%; object-fit: cover; background: linear-gradient(135deg, #2a1a6b, #0d3b5a); display: flex; align-items: center; justify-content: center; font-size: 5rem; }
.story .txt { padding: 18px; flex: 1; }
.story .txt h2 { font-size: 1.45rem; }
.story .dots { display: flex; gap: 4px; padding: 10px 14px 0; }
.story .dots i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); }
.story .dots i.on { background: var(--neon); }
.step-title { font-family: var(--display); color: var(--neon); text-transform: uppercase; letter-spacing: 2px; font-size: .8rem; margin-bottom: 6px; }
.q { margin-bottom: 18px; }
.opt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: 16px var(--font); cursor: pointer; }
.opt.on { border-color: var(--neon); background: rgba(34,242,209,.08); }
.opt.right { border-color: var(--ok); background: rgba(61,220,151,.12); }
.opt.wrong { border-color: var(--danger); background: rgba(255,92,122,.1); }
.why { font-size: .9rem; color: var(--muted); margin-top: 4px; }
.done-screen { text-align: center; padding: 40px 10px; }
.done-screen .big { font-size: 4rem; }

/* Chat widget */
.chatbox { display: flex; flex-direction: column; gap: 8px; }
.msgs { display: flex; flex-direction: column; gap: 8px; min-height: 160px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(90deg, var(--neon2), #7a5cff); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--card2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: transparent; color: var(--gold); font-size: .9rem; text-align: center; }
.msg.typing { color: var(--muted); }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 140px; }
.composer .btn { min-width: 56px; }

/* Image widget / gallery */
.result-img { width: 100%; border-radius: 16px; border: 1px solid var(--line); display: block; }
.rendering { aspect-ratio: 1; border-radius: 16px; border: 1px dashed var(--neon); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--neon); gap: 8px;
  background: repeating-linear-gradient(45deg, rgba(34,242,209,.05) 0 12px, transparent 12px 24px); }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(34,242,209,.2); border-top-color: var(--neon); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; border: 2px solid transparent; }
.gallery .pick.on img { border-color: var(--neon); }
.gallery button.pick { padding: 0; border: 0; background: none; cursor: pointer; }

/* Studio tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line); color: var(--text); min-height: 120px; }
.tile .ico { font-size: 2rem; }
.tile.locked { opacity: .5; }
.tile .lock { position: absolute; top: 10px; right: 12px; font-size: .75rem; color: var(--muted); }

/* Me */
.avatar { width: 96px; height: 96px; border-radius: 24px; object-fit: cover; border: 2px solid var(--neon); background: var(--card2); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { text-align: center; font-size: .72rem; color: var(--muted); }
.badge .b { font-size: 1.8rem; display: block; width: 52px; height: 52px; margin: 0 auto 4px; line-height: 52px; border-radius: 50%; background: var(--card2); border: 1px solid var(--line); }
.badge.off .b { filter: grayscale(1); opacity: .35; }

/* Toasts & modals */
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--card2); border: 1px solid var(--neon); color: var(--text); padding: 12px 16px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .3s ease-out; }
.toast.err { border-color: var(--danger); }
@keyframes pop { from { transform: translateY(-10px) scale(.95); opacity: 0; } }
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(5,7,20,.8); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal .card { max-width: 380px; width: 100%; text-align: center; animation: pop .35s ease-out; }
.modal .big { font-size: 4rem; }

/* Boot sequence */
.boot { position: fixed; inset: 0; z-index: 200; background: #05071a; display: flex; flex-direction: column; justify-content: center; padding: 28px; font-family: ui-monospace, Consolas, monospace; color: var(--neon); }
.boot p { margin: 0 0 8px; white-space: pre-wrap; text-shadow: 0 0 8px rgba(34,242,209,.6); min-height: 1.4em; }
.boot .btn { margin-top: 24px; opacity: 0; transition: opacity .4s; }
.boot .btn.show { opacity: 1; }

/* Auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.auth .hero { text-align: center; margin-bottom: 18px; }
.auth .hero .logo { font-size: 3rem; display: block; }

/* Admin */
.admin table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin th, .admin td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin .page { max-width: 1000px; }
.admin nav.sub { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.scroll-x { overflow-x: auto; }
.copy { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; word-break: break-all; }

/* Community feed */
.feed { display: flex; flex-direction: column; gap: 10px; padding-bottom: 80px; }
.post { display: flex; gap: 10px; align-items: flex-start; }
.post .av { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; object-fit: cover; background: var(--card2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.post-body { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 8px 12px; }
.post.mine .post-body { background: linear-gradient(160deg, #2b2370, #231c5e); border-color: var(--neon2); }
.post.coach .post-body { border-color: var(--gold); }
.post.intro .post-body { border-style: dashed; border-color: var(--neon); }
.post-head { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.post-head .more, .entry-meta .more { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0 4px; }
.post-text { white-space: pre-wrap; word-wrap: break-word; margin-top: 2px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 999px; padding: 1px 8px; font-size: .8rem; cursor: pointer; }
.react.on { border-color: var(--neon); }
.msg-menu { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg-menu button { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 10px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; }
.msg-menu button.small { font-size: .8rem; }
.sticky-composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 25; padding: 8px 12px; background: rgba(11,15,42,.96); border-top: 1px solid var(--line); max-width: 560px; margin: 0 auto; }
.dm-feed { max-height: none; padding-bottom: 80px; }

/* Arena */
.entries { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.entry { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.entry.winner { border-color: var(--gold); box-shadow: 0 0 18px rgba(255,209,102,.2); }
.entry img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.entry-text { padding: 12px; min-height: 110px; font-size: .9rem; white-space: pre-wrap; }
.entry-meta { display: flex; align-items: center; gap: 6px; padding: 8px; }
.entry details { padding: 0 8px 8px; }
.entry summary { cursor: pointer; color: var(--neon); }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vote { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hot); background: transparent; color: var(--hot); font-size: 1.3rem; cursor: pointer; flex: 0 0 40px; }
.vote.on { background: var(--hot); color: #fff; box-shadow: 0 0 14px rgba(255,79,163,.5); }
.lb-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.lb-row.me { color: var(--neon); }
.tabbar a { position: relative; }
.tabbar .dot { position: absolute; top: 8px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--hot); }
