: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 ---------- */
.hdr {
  flex: 0 0 auto;
  padding: 22px 28px 14px;
  border-bottom: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
}
.hdr h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

/* ---------- Home ---------- */
.home-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 28px 26px;
}

.ball {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #3a3a4a 0%, #18181f 46%, #050507 100%);
  box-shadow:
    inset 0 -18px 40px rgba(0,0,0,0.8),
    inset 0 10px 30px rgba(255,255,255,0.06),
    0 0 38px rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.ball.shaking { animation: shake 0.5s ease-in-out; }

.ball-gloss {
  position: absolute;
  top: 26px; left: 44px;
  width: 96px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(255,255,255,0.28), rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.window {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #0a1230 0%, #050a1c 100%);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* downward-pointing triangle window */
.triangle {
  width: 0; height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-top: 104px solid #14306e;
  position: relative;
  transition: border-top-color 0.3s ease;
}
.ans-text {
  position: absolute;
  top: -92px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  text-align: center;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.04;
  text-shadow: 0 0 10px rgba(0,212,255,0.55);
}

/* idle state: big 8 */
.window.idle .ans-text { font-size: 64px; top: -78px; }
.window.idle .triangle { border-top-color: #14306e; }

/* revealed answer */
.window.revealed .ans-text { font-size: 13px; letter-spacing: 0.2px; }
.window.fade .ans-text { opacity: 0; }
.window .ans-text { transition: opacity 0.2s ease; opacity: 1; }

/* answer mood colors */
.window.affirm .triangle { border-top-color: #0c5a3a; }
.window.affirm .ans-text { color: var(--accent-secondary); text-shadow: 0 0 10px rgba(0,255,136,0.5); }
.window.negative .triangle { border-top-color: #5e1626; }
.window.negative .ans-text { color: var(--danger); text-shadow: 0 0 10px rgba(255,68,102,0.5); }
.window.neutral .triangle { border-top-color: #5a4a0c; }
.window.neutral .ans-text { color: #ffcc44; text-shadow: 0 0 10px rgba(255,204,68,0.5); }

.hint {
  font-size: 18px;
  color: var(--text-secondary);
  min-height: 24px;
  text-align: center;
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  min-height: 64px;
  border-radius: var(--radius-md);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
}
.btn-primary {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(135deg, #0d3b52, #135e74);
}
.btn-primary:focus { background: linear-gradient(135deg, #11506e, #1880a0); }
.btn-ghost {
  flex: 1 1 0;
  background: var(--bg-tertiary);
}
.row {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

/* ---------- History ---------- */
.list-main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 24px;
}
.hist-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.hist-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
}
.hist-item.affirm { border-left-color: var(--accent-secondary); }
.hist-item.negative { border-left-color: var(--danger); }
.hist-item.neutral { border-left-color: #ffcc44; }
.hist-ans { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.hist-time { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.empty { color: var(--text-secondary); font-size: 18px; text-align: center; margin-top: 40px; }

/* ---------- About ---------- */
.about-main {
  flex: 1 1 auto;
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.about-main p { font-size: 18px; color: var(--text-secondary); line-height: 1.5; }
.about-main .muted { color: var(--text-muted); font-size: 16px; }
.about-points { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.about-points li {
  font-size: 18px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
}
.about-points strong { color: var(--accent); }

/* ---------- Footer nav ---------- */
.footer-nav {
  flex: 0 0 auto;
  display: flex;
  gap: 14px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
}
.footer-nav .btn-primary { max-width: none; }

@keyframes shake {
  0% { transform: translate(0,0) rotate(0); }
  15% { transform: translate(-12px,6px) rotate(-5deg); }
  30% { transform: translate(11px,-7px) rotate(5deg); }
  45% { transform: translate(-9px,8px) rotate(-4deg); }
  60% { transform: translate(8px,-5px) rotate(3deg); }
  75% { transform: translate(-5px,4px) rotate(-2deg); }
  100% { transform: translate(0,0) rotate(0); }
}
