:root{
  --bg:#0b1020;
  --panel:#111a33;
  --panel2:#0f1730;
  --text:#e8ecff;
  --muted:#aab3d6;
  --border:rgba(255,255,255,.12);
  --accent:#7aa2ff;
  --good:#4ade80;
  --bad:#fb7185;
  --warn:#fbbf24;
  --mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  background:radial-gradient(1200px 600px at 20% -10%, rgba(122,162,255,.25), transparent 70%),
             radial-gradient(900px 500px at 90% 0%, rgba(74,222,128,.18), transparent 65%),
             var(--bg);
  color:var(--text);
}

.header{
  padding:18px 16px 10px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(to bottom, rgba(17,26,51,.9), rgba(17,26,51,.55));
  position:sticky;
  top:0;
  backdrop-filter:blur(10px);
}
.header__bar{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.header__title{font-weight:800; font-size:18px; letter-spacing:.2px}
.header__subtitle{margin-top:6px; color:var(--muted); font-size:13px; line-height:1.25}
.header__actions{display:flex; gap:10px; align-items:center}

.main{padding:14px 14px 24px; max-width:920px; margin:0 auto}
.grid{
  display:grid;
  gap:12px;
  grid-template-columns:1fr;
  margin-top:12px;
}
@media (min-width: 760px){
  .grid{grid-template-columns:1fr 1fr}
}

.card{
  background:linear-gradient(180deg, rgba(17,26,51,.85), rgba(15,23,48,.85));
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  box-shadow:0 14px 50px rgba(0,0,0,.35);
}
.card__title{
  margin:0 0 10px;
  font-size:14px;
  color:var(--muted);
  font-weight:700;
  letter-spacing:.2px;
}

.row{display:flex; gap:10px; align-items:center}
.row--wrap{flex-wrap:wrap}
.row--space{justify-content:space-between}

.btn{
  appearance:none;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:700;
  font-size:14px;
}
.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.45}
.btn--primary{
  border-color:rgba(122,162,255,.45);
  background:linear-gradient(180deg, rgba(122,162,255,.22), rgba(122,162,255,.10));
}
.btn--big{width:100%; padding:12px 14px; font-size:16px}

.iconBtn{
  display:grid;
  place-items:center;
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  color:var(--text);
  background:rgba(255,255,255,.06);
  text-decoration:none;
}
.iconBtn:active{transform:translateY(1px)}
.iconBtn[disabled]{opacity:.45}
.iconBtn--solid{
  border-color:rgba(122,162,255,.30);
  background:linear-gradient(180deg, rgba(122,162,255,.18), rgba(122,162,255,.08));
}

.view[hidden]{display:none}

.homeTop{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.homeTitle{font-weight:800; font-size:16px; letter-spacing:.2px}
.homeSub{margin-top:6px; color:var(--muted); font-size:13px; line-height:1.25}
.homeBottom{display:flex; gap:12px; align-items:center; margin-top:12px}
.menuLink{color:var(--muted); text-decoration:none; font-weight:700}
.menuLink:active{transform:translateY(1px)}

.pill{
  font-size:12px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.12);
  color:var(--muted);
}
.pill--good{color:var(--good); border-color:rgba(74,222,128,.35); background:rgba(74,222,128,.08)}
.pill--bad{color:var(--bad); border-color:rgba(251,113,133,.40); background:rgba(251,113,133,.08)}
.pill--warn{color:var(--warn); border-color:rgba(251,191,36,.40); background:rgba(251,191,36,.08)}

.help{margin-top:10px; color:var(--muted); font-size:13px; line-height:1.35}
.help b{color:var(--text)}

.kv{
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px 10px;
  align-items:baseline;
}
.kv__k{color:var(--muted); font-size:13px}
.kv__v{
  font-family:var(--mono);
  font-size:13px;
  color:var(--text);
  text-align:right;
}

code{font-family:var(--mono); font-size:12px}
.notes{margin:0; padding-left:18px; color:var(--muted); line-height:1.35; font-size:13px}
.notes b{color:var(--text)}

.scene{
  margin-top:12px;
  width:100%;
  aspect-ratio: 16 / 10;
  min-height:180px;
  border-radius:14px;
  border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,247,255,.98));
  display:grid;
  place-items:center;
  perspective: 800px;
  overflow:hidden;
}
.scene--tall{aspect-ratio: 3 / 4; min-height:320px}

.smiley__eye{
  position:absolute;
  top:44px;
  width:16px;
  height:22px;
  border-radius:999px;
  background:rgba(15,23,48,.9);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08);
}
.smiley__eye--left{left:44px}
.smiley__eye--right{right:44px}

.smiley__mouth{
  position:absolute;
  left:50%;
  bottom:30px;
  width:62px;
  height:38px;
  transform:translateX(-50%);
  border-bottom:8px solid rgba(15,23,48,.9);
  border-left:8px solid transparent;
  border-right:8px solid transparent;
  border-radius:0 0 80px 80px;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.10));
}

.robotCanvas{
  width:100%;
  height:100%;
  display:block;
  touch-action:none;
}

/* Surprised expression */
.smiley--surprised .smiley__eye{
  width:18px;
  height:26px;
  top:40px;
  background:rgba(15,23,48,.95);
}
.smiley--surprised .smiley__mouth{
  width:30px;
  height:30px;
  bottom:32px;
  border:0;
  border-radius:999px;
  background:rgba(15,23,48,.92);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.10);
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.12));
}

/* Skull mode (10s easter egg) */
.smiley--skull{
  border-color: rgba(255,255,255,.16);
  background:
    radial-gradient(50px 42px at 35% 28%, rgba(255,255,255,.45), rgba(255,255,255,0) 65%),
    radial-gradient(180px 160px at 55% 58%, rgba(245,245,245,.92) 0%, rgba(209,213,219,.62) 52%, rgba(107,114,128,.28) 100%),
    radial-gradient(240px 200px at 70% 78%, rgba(0,0,0,.38), rgba(0,0,0,0) 60%);
  box-shadow:
    0 22px 80px rgba(0,0,0,.48),
    0 10px 20px rgba(0,0,0,.25),
    inset -14px -18px 28px rgba(0,0,0,.26),
    inset 10px 12px 18px rgba(255,255,255,.12);
}

.smiley--skull .smiley__eye{
  width:22px;
  height:22px;
  top:44px;
  border-radius:8px;
  background:
    linear-gradient(45deg, rgba(15,23,48,.95) 0 18%, transparent 18% 82%, rgba(15,23,48,.95) 82% 100%),
    linear-gradient(-45deg, rgba(15,23,48,.95) 0 18%, transparent 18% 82%, rgba(15,23,48,.95) 82% 100%);
  box-shadow:none;
}

.smiley--skull .smiley__mouth{
  width:74px;
  height:30px;
  bottom:28px;
  border:0;
  border-radius:10px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(15,23,48,.92) 0 7px,
      rgba(255,255,255,.08) 7px 9px
    );
  box-shadow: inset 0 0 0 3px rgba(15,23,48,.45);
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.10));
}
