:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---------- Header / Footer ---------- */
.hdr {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
}
.hdr-title { font-size: 34px; font-weight: 700; letter-spacing: 0.5px; }
.hdr-sub { font-size: 18px; color: var(--text-secondary); margin-top: 4px; }
.ftr {
  margin-top: auto;
  padding: 16px 32px;
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ---------- Home ---------- */
.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 20px 40px;
}
.btn {
  width: 100%;
  max-width: 420px;
  min-height: 88px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, #00d4ff22, #00ff8822);
  border-color: #00d4ff55;
  color: var(--accent);
}

/* ---------- Mini cube (home preview) ---------- */
.mini-scene {
  width: 160px; height: 160px;
  perspective: 600px;
  margin-bottom: 8px;
}
.mini-cube {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: spin 9s linear infinite;
}
.mface {
  position: absolute;
  width: 160px; height: 160px;
  border: 2px solid #00d4ff88;
  background: rgba(0, 212, 255, 0.08);
}
.mf-front  { transform: translateZ(80px); }
.mf-back   { transform: rotateY(180deg) translateZ(80px); }
.mf-right  { transform: rotateY(90deg) translateZ(80px); }
.mf-left   { transform: rotateY(-90deg) translateZ(80px); }
.mf-top    { transform: rotateX(90deg) translateZ(80px); }
.mf-bottom { transform: rotateX(-90deg) translateZ(80px); }
@keyframes spin {
  from { transform: rotateX(-20deg) rotateY(0deg); }
  to   { transform: rotateX(-20deg) rotateY(360deg); }
}

/* ---------- Cube screen ---------- */
.scene {
  position: relative;
  width: 100%;
  height: 320px;
  perspective: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
}
.cube {
  width: 200px; height: 200px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  will-change: transform;
}
.face {
  position: absolute;
  width: 200px; height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  border: 2px solid;
  color: #fff;
}
.f-front  { transform: translateZ(100px);              background: rgba(0, 212, 255, 0.16); border-color: #00d4ff; }
.f-back   { transform: rotateY(180deg) translateZ(100px); background: rgba(0, 255, 136, 0.16); border-color: #00ff88; }
.f-right  { transform: rotateY(90deg) translateZ(100px);  background: rgba(255, 68, 102, 0.16); border-color: #ff4466; }
.f-left   { transform: rotateY(-90deg) translateZ(100px); background: rgba(255, 180, 0, 0.16);  border-color: #ffb400; }
.f-top    { transform: rotateX(90deg) translateZ(100px);  background: rgba(180, 120, 255, 0.16); border-color: #b478ff; }
.f-bottom { transform: rotateX(-90deg) translateZ(100px); background: rgba(255, 255, 255, 0.12); border-color: #c0c0d0; }

/* ---------- Readout ---------- */
.readout {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 4px 24px 2px;
}
.ro-item {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  min-width: 120px;
  text-align: center;
}
.ro-lbl { display: block; font-size: 13px; color: var(--text-secondary); letter-spacing: 1px; }
.ro-val { display: block; font-size: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

.status-pill {
  align-self: center;
  margin: 8px 0 4px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 999px;
  padding: 6px 16px;
}
.status-pill.live { color: var(--accent-secondary); border-color: #00ff8855; }
.status-pill.fallback { color: var(--text-muted); }

/* ---------- Cube controls ---------- */
.cube-controls {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 24px 22px;
}
.btn.ctl {
  min-height: 64px;
  font-size: 19px;
  max-width: none;
  width: 100%;
}

/* ---------- About ---------- */
.about-body {
  flex: 1;
  padding: 26px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.about-body p { font-size: 21px; line-height: 1.45; color: var(--text-primary); }
.about-body b { color: var(--accent); }
.about-body .muted { color: var(--text-secondary); font-size: 18px; }
.about-foot { padding: 16px 36px 28px; }
.about-foot .btn { max-width: none; }
