/* Mio Games — follows the Vrizor Mio visual language (vrizor.su/mio) */
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #050507;
  --fg: #ececee;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-hi: rgba(255, 255, 255, 0.10);
  --line: rgba(255, 255, 255, 0.10);
  --line-hi: rgba(255, 255, 255, 0.20);
  --line-soft: rgba(255, 255, 255, 0.05);
  --muted: rgba(255, 255, 255, 0.50);
  --faint: #525252;     /* neutral-600 */
  --dim: #737373;       /* neutral-500 */
  --indigo: #818cf8;    /* indigo-400 */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gap: 12px;
  --side: 380px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* static smoke, rendered once (bg.js) */
.bg { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; pointer-events: none; z-index: 0; }

/* ---------- primitives ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.3), 0 4px 6px -4px rgba(0,0,0,.3);
  border-radius: 16px;
}
.logo { border-radius: 22%; flex: none; display: block; }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-3 { width: 12px; height: 12px; }
.i-35 { width: 14px; height: 14px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 16px; border-radius: 24px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.3), 0 4px 6px -4px rgba(0,0,0,.3);
  max-width: 95vw;
}
.pill-title { font-weight: 700; letter-spacing: -0.025em; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.pill-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

.icon-btn { color: var(--muted); padding: 4px; border-radius: 8px; display: inline-flex; transition: color .2s, background .2s; }
.icon-btn:hover:not(:disabled) { color: #fff; }
.icon-btn:disabled { opacity: .3; }

.btn-glass {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  transition: background .2s; white-space: nowrap;
}
.btn-glass:hover { background: rgba(255,255,255,.15); }

.btn-white, .btn-pill-white {
  background: #fff; color: #000; font-weight: 500; transition: background .2s, opacity .2s;
}
.btn-white:hover:not(:disabled), .btn-pill-white:hover:not(:disabled) { background: #e5e5e5; }
.btn-white:disabled, .btn-pill-white:disabled { opacity: .3; }
.btn-white { height: 40px; border-radius: 12px; font-size: 14px; }
.btn-white.wide { width: 100%; }
.btn-pill-white { height: 30px; padding: 0 14px; border-radius: 999px; font-size: 11px; white-space: nowrap; }

.link-btn { font-size: 10px; color: var(--dim); transition: color .2s; }
.link-btn:hover { color: #fff; }

.hero {
  margin: 0; font-weight: 300; letter-spacing: -0.025em; line-height: 1.05;
  font-size: clamp(40px, 6vw, 72px); color: rgba(255,255,255,.95); text-align: center;
}
.hero span { color: rgba(255,255,255,.4); }
.hero-sub { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--dim); }

/* ---------- login ---------- */
.login { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; padding: 12px 16px; overflow-y: auto; }
.pill-top { flex: none; }
.login-inner { flex: 1; width: 100%; max-width: 380px; display: flex; flex-direction: column; justify-content: center; padding: 32px 0; animation: rise .7s var(--ease) both; }
.login-card { margin-top: 36px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.field input {
  height: 40px; padding: 0 12px; border-radius: 12px; outline: none;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 14px; color: #fff;
  transition: border-color .2s, background .2s;
}
.field input::placeholder { color: rgba(255,255,255,.3); }
.field input:focus { border-color: var(--line-hi); background: rgba(255,255,255,.07); }
.field input.code { font-family: ui-monospace, "Geist Mono", monospace; letter-spacing: .4em; text-transform: uppercase; text-align: center; font-size: 16px; }
.err { min-height: 16px; font-size: 12px; color: #f87171; }
.note { margin: 14px 0 0; text-align: center; font-size: 10px; color: var(--faint); }
@keyframes rise { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- app ---------- */
.app { position: relative; z-index: 1; height: 100%; }
.side {
  position: fixed; top: var(--gap); bottom: var(--gap); left: var(--gap); width: var(--side);
  display: flex; flex-direction: column; z-index: 3;
}
.side-head { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
.side-school { flex: 1; min-width: 0; font-size: 12px; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.messages { flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; }
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.welcome { display: flex; flex-direction: column; gap: 4px; }
.welcome-label { margin: 0 0 6px; padding: 0 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 12px; font-size: 12px;
  background: var(--glass); border: 1px solid var(--line); color: rgba(255,255,255,.6);
  transition: background .3s, border-color .3s, color .3s, transform .3s;
}
.item:hover { background: var(--glass-hi); border-color: var(--line-hi); color: #fff; transform: scale(1.02); }

.msg { margin-bottom: 24px; animation: msgIn .4s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.msg-user { display: flex; justify-content: flex-end; }
.bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 16px 4px 16px 16px;
  background: #fff; color: #000; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.msg-bot { display: flex; gap: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.3); color: var(--indigo); }
.bot-body { flex: 1; min-width: 0; padding-top: 4px; }
.bot-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: rgba(165,180,252,.7); margin-bottom: 8px; }
.bot-text { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.6; color: #a3a3a3; }
.bot-text.ok { color: #e5e5e5; }
.bot-text.fail { color: #f87171; }

.composer { padding: 8px 12px 12px; }
.input-cap { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 16px; box-shadow: none; }
.input-cap textarea {
  flex: 1; min-height: 28px; max-height: 160px; padding: 7px 0; resize: none; outline: none;
  background: transparent; border: 0; font-size: 14px; color: #fff; line-height: 1.4;
}
.input-cap textarea::placeholder { color: rgba(255,255,255,.3); }
.btn-send { width: 36px; height: 36px; border-radius: 12px; background: #fff; color: #000; display: grid; place-items: center; flex: none; transition: background .2s, opacity .2s; }
.btn-send:hover:not(:disabled) { background: #e5e5e5; }
.btn-send:disabled { opacity: .3; }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 12px 2px 0; font-size: 10px; color: var(--dim); }

/* stage */
.stage {
  position: fixed; top: var(--gap); bottom: var(--gap); right: var(--gap); left: calc(var(--side) + var(--gap) * 2);
  display: flex; flex-direction: column; align-items: center; gap: var(--gap); min-width: 0;
}
.toolbar { flex: none; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dim); white-space: nowrap; }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state.busy { color: #a5b4fc; }
.state.busy .state-dot { animation: blink 1.2s ease-in-out infinite; }
.state.ok { color: #34d399; }
.state.bad { color: #f87171; }
@keyframes blink { 50% { opacity: .3; } }

.frame { position: relative; flex: 1; width: 100%; min-height: 0; overflow: hidden; }
.frame:fullscreen { border-radius: 0; border: 0; background: #000; }
#preview { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; opacity: 0; transition: opacity .4s; }
#preview.on { opacity: 1; background: #000; }
.idle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; pointer-events: none; animation: rise .7s var(--ease) both; }
.build {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px;
  background: rgba(12,12,17,.85); border: 1px solid rgba(255,255,255,.15);
  font-size: 12px; color: rgba(255,255,255,.8); pointer-events: none;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.6);
}
.build .i { width: 14px; height: 14px; }

.share { flex: none; width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px; }
.share-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.share a { flex: 1; min-width: 0; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share a:hover { text-decoration: underline; }

/* ---------- mobile ---------- */
@media (max-width: 767px) {
  :root { --gap: 8px; }
  .side { top: auto; height: 46%; right: var(--gap); width: auto; }
  .stage { left: var(--gap); bottom: calc(46% + var(--gap) * 2); }
  .pill { height: 48px; padding: 0 12px; border-radius: 999px; }
  .toolbar .pill-title { max-width: 90px; }
  .toolbar .state { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
