:root {

  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f6f4ee;
  --surface-3: #ece8df;
  --ink: #23262b;
  --ink-soft: #4a5260;
  --sub: #7a8291;
  --line: #e2ddd2;
  --line-soft: #ece8df;

  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --accent-ink: #191207;

  --green: #22c55e;
  --green-ink: #07130c;
  --cyan: #06b6d4;
  --cyan-ink: #083344;
  --red: #ef4444;
  --slate: #64748b;
  --slate-ink: #ffffff;


  --f-display: 64px;
  --f-h1: 30px;
  --f-h2: 20px;
  --f-body: 15px;
  --f-small: 13px;
  --f-micro: 12px;


  --r-xl: 20px;
  --r-lg: 14px;
  --r-md: 10px;
  --r-pill: 999px;


  --shadow: 0 12px 32px rgba(35, 32, 24, 0.10);
  --shadow-sm: 0 4px 14px rgba(35, 32, 24, 0.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }


[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(1100px 520px at 50% -180px, rgba(255, 255, 255, 0.9) 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px 24px 20px;
}


.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.hero-brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(245, 158, 11, 0.28);
  animation: logoFloat 4s ease-in-out infinite;
}
.brand-logo svg { width: 30px; height: 30px; }
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(-3deg); }
}
.hero-title {
  font-size: var(--f-h1);
  font-weight: 800;
  letter-spacing: -0.3px;
}
.hero-sub {
  color: var(--sub);
  font-size: var(--f-small);
  margin-top: 2px;
}
.hero-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.global-text {
  font-size: var(--f-small);
  color: var(--sub);
  max-width: 330px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--f-small);
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.btn-ghost svg { width: 16px; height: 16px; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }


.mode-panel {
  display: flex;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 22px;
}
.mode-tabs {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.mode-tab {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--ink-soft);
}
.mode-tab:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--ink); box-shadow: var(--shadow-sm); }
.mode-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(245, 158, 11, 0.3);
}
.mode-tab-icon svg { width: 20px; height: 20px; }
.mode-tab-name { font-weight: 800; font-size: 15px; }
.mode-tab-desc { font-size: var(--f-micro); opacity: 0.85; }
.mode-tab:not(.active) .mode-tab-desc { color: var(--sub); }

.mode-settings {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px 14px;
}
.setting-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--f-micro);
  font-weight: 700;
  color: var(--sub);
}
.setting-select {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--f-small);
  font-weight: 700;
  padding: 7px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  outline: none;
}
.setting-select:focus { border-color: var(--accent); }


.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}
.test-col { min-width: 0; }


.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}


.test-card { padding: 28px 30px 26px; }
.page-title {
  font-size: var(--f-h2);
  font-weight: 800;
  letter-spacing: -0.2px;
}
.page-sub {
  color: var(--sub);
  font-size: var(--f-body);
  margin: 6px 0 20px;
}


.stage {
  position: relative;
  height: 340px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(23, 18, 7, 0.06);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, box-shadow 0.3s ease, transform 0.15s ease;
  outline: none;
}
.stage:active { transform: scale(0.997); }
.stage-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 0%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
.stage-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 0 24px;
}
.stage-text {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: opacity 0.12s ease, transform 0.12s ease;
  font-variant-numeric: tabular-nums;
}
.stage-sub { font-size: var(--f-small); opacity: 0.85; }


.stage-idle    { background: var(--accent); box-shadow: 0 16px 40px rgba(245, 158, 11, 0.30); }
.stage-waiting { background: var(--cyan);   box-shadow: 0 16px 40px rgba(6, 182, 212, 0.30); }
.stage-go      { background: var(--green);  box-shadow: 0 16px 40px rgba(34, 197, 94, 0.32); }
.stage-done    { background: var(--slate);  box-shadow: 0 16px 40px rgba(100, 116, 139, 0.35); }
.stage-tooSoon { background: var(--red);    box-shadow: 0 16px 40px rgba(239, 68, 68, 0.36); animation: stageFlash 0.5s ease; }

.stage-idle .stage-content,
.stage-waiting .stage-content,
.stage-go .stage-content { color: #171207; }
.stage-done .stage-content,
.stage-tooSoon .stage-content { color: #fff; }
@keyframes stageFlash {
  0% { transform: scale(1); }
  35% { transform: scale(1.02); }
  100% { transform: scale(1); }
}


.mode-extra {
  margin-top: 18px;
  animation: fadeUp 0.4s ease;
}

.mem-input-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.mem-input {
  flex: 1;
  max-width: 260px;
  border: 2px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 6px;
  text-align: center;
  padding: 12px 14px;
  border-radius: var(--r-md);
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mem-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); }
.mem-input.input-error { border-color: var(--red); animation: shakeX 0.4s ease; }
.btn-small {
  flex: none;
  width: auto;
  padding: 13px 24px;
  font-size: 15px;
}


.seq-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  pointer-events: none;
}
.seq-hint {
  color: #171207;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}
.seq-overlay .seq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(232px, 72%);
}
.seq-overlay .seq-cell {
  aspect-ratio: 1;
  border: 2px solid rgba(23, 18, 7, 0.5);
  background: rgba(255, 255, 255, 0.30);
  color: #171207;
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  pointer-events: auto;
  box-shadow: inset 0 -5px 12px rgba(0, 0, 0, 0.10);
}
.seq-overlay .seq-cell:hover { background: rgba(255, 255, 255, 0.5); transform: scale(1.05); }
.seq-overlay .seq-cell.lit {
  background: #ffffff;
  border-color: #ffffff;
  color: #171207;
  box-shadow: 0 0 26px rgba(255, 255, 255, 0.9);
  transform: scale(1.1);
  animation: cellLit 0.45s ease;
}
.seq-overlay .seq-cell.pressed {
  background: rgba(23, 18, 7, 0.7);
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
}

.seq-overlay .seq-cell.picked {
  background: rgba(255, 255, 255, 0.92);
  border-color: #fff;
  color: #14532d;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.6);
}

.seq-confirm {
  pointer-events: auto;
  border: none;
  background: #171207;
  color: #fbbf24;
  font-size: 16px;
  font-weight: 800;
  padding: 11px 30px;
  border-radius: var(--r-pill);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(23, 18, 7, 0.25);
  transition: all 0.2s ease;
}
.seq-confirm:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(23, 18, 7, 0.35); }
.seq-confirm:disabled {
  background: rgba(23, 18, 7, 0.25);
  color: rgba(23, 18, 7, 0.55);
  cursor: not-allowed;
  box-shadow: none;
}
@keyframes cellLit {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.16); }
  100% { transform: scale(1.1); }
}


.live-stats {
  margin-top: 16px;
  text-align: center;
  color: var(--sub);
  font-size: var(--f-small);
  font-weight: 600;
  letter-spacing: 0.4px;
}
.live-stats .dots { color: var(--accent); }


.results {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
  animation: fadeUp 0.45s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.avg-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.avg-num {
  font-size: var(--f-display);
  font-weight: 800;
  letter-spacing: -1.6px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.avg-unit { font-size: 22px; font-weight: 700; color: var(--sub); }
.avg-label { font-size: var(--f-small); color: var(--sub); font-weight: 600; margin-left: auto; }
.best-line { margin-top: 6px; font-size: var(--f-small); color: var(--sub); }
.best-line b { color: var(--accent); }

.round-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 18px 0 22px;
}
.round-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 6px;
  text-align: center;
  animation: fadeUp 0.4s ease backwards;
}
.round-item .ri-round { font-size: var(--f-micro); color: var(--sub); font-weight: 600; display: block; }
.round-item .ri-time { font-size: 19px; font-weight: 800; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.round-item .ri-tag { font-size: var(--f-micro); font-weight: 700; display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: var(--r-pill); }
.tag-top   { color: var(--accent-ink); background: var(--accent); }
.tag-great { color: var(--accent-ink); background: var(--accent); }
.tag-good  { color: var(--green-ink); background: var(--green); }
.tag-ok    { color: #191207; background: #fde047; }
.tag-slow  { color: #fff; background: var(--red); }

.btn-primary {
  display: block;
  width: 100%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 800;
  padding: 15px 20px;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
  box-shadow: 0 10px 26px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(245, 158, 11, 0.4); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }

.btn-primary.btn-small {
  width: auto;
  flex: none;
  padding: 13px 22px;
  font-size: 15px;
  border-radius: var(--r-md);
}


.global-card {
  margin-top: 20px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.global-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.global-icon svg { width: 22px; height: 22px; }
.global-title { font-size: var(--f-small); font-weight: 700; color: var(--ink); }
.global-summary { font-size: var(--f-small); color: var(--sub); margin-top: 2px; }


.robot-col { position: sticky; top: 24px; }
.robot-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 20px 20px 18px;
  text-align: center;
  overflow: visible;
}
.robot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.robot-name {
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.robot-tag {
  font-size: var(--f-micro);
  font-weight: 700;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.12);
  border-radius: var(--r-pill);
  padding: 2px 10px;
}
.sound-toggle {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--sub);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sound-toggle:hover { color: var(--accent); border-color: var(--accent); }
.sound-toggle svg { width: 18px; height: 18px; }
.sound-toggle.muted { color: #b9b4a6; }


.speech-bubble {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 15px;
  min-height: 72px;
  text-align: left;
  font-size: var(--f-small);
  color: var(--ink);
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: var(--surface-2);
}
.speech-bubble::before {
  content: "";
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  border: 11px solid transparent;
  border-top-color: var(--line);
}
.speech-bubble.pop { animation: bubblePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bubblePop {
  0% { transform: scale(0.6) translateY(6px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}


.robot-stage {
  position: relative;
  margin: 0 auto;
  max-width: 264px;
  animation: floatY 4.5s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.robot-stage.breath .robot-svg { animation: breath 3.2s ease-in-out infinite; }
@keyframes breath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.018); }
}


.robot-stage.anim-bounce { animation: bounceIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bounceIn {
  0% { transform: scale(0.72) translateY(26px); opacity: 0; }
  60% { transform: scale(1.08) translateY(-8px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}
.robot-stage.anim-shake { animation: shakeX 0.6s ease; }
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-14px) rotate(-2.5deg); }
  40% { transform: translateX(12px) rotate(2.5deg); }
  60% { transform: translateX(-9px); }
  80% { transform: translateX(6px); }
}

.robot-svg {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
  border-radius: 18px;
  border: 1px solid var(--line);
}


.r-antenna-halo {
  transform-box: fill-box;
  transform-origin: center;
  animation: rPulse 2.6s ease-in-out infinite;
}
@keyframes rPulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.3); }
}
.r-heart {
  transform-box: fill-box;
  transform-origin: center;
  animation: rHeart 1.9s ease-in-out infinite;
}
@keyframes rHeart {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}


.r-eyes-round .r-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: rBlink 4.4s ease-in-out infinite;
}
@keyframes rBlink {
  0%, 93%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}

.em-impressed .r-eyes-round {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(1.12);
}


.r-eyes-happy, .r-eyes-sleepy, .r-eyes-squint { display: none; }
.em-happy .r-eyes-happy,
.em-celebrate .r-eyes-happy { display: block; }
.em-happy .r-eyes-round,
.em-celebrate .r-eyes-round,
.em-tease .r-eyes-round,
.em-sleepy .r-eyes-round { display: none; }
.em-tease .r-eyes-squint { display: block; }
.em-sleepy .r-eyes-sleepy { display: block; }


.r-brows { display: none; }
.em-tease .r-brows { display: block; }


.r-mouths .r-mouth { display: none; }
.r-mouths .r-mouth-neutral { display: block; }
.em-happy .r-mouth-neutral,
.em-celebrate .r-mouth-neutral,
.em-impressed .r-mouth-neutral,
.em-tease .r-mouth-neutral,
.em-sleepy .r-mouth-neutral { display: none; }
.em-happy .r-mouth-smile { display: block; }
.em-celebrate .r-mouth-laugh,
.em-impressed .r-mouth-laugh { display: block; }
.em-tease .r-mouth-smirk { display: block; }
.em-sleepy .r-mouth-yawn { display: block; }


.robot-svg.talking .r-mouths {
  transform-box: fill-box;
  transform-origin: 50% 28%;
  animation: rTalk 0.26s ease-in-out infinite;
}
@keyframes rTalk {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.55); }
}
.robot-svg.talking .r-head {
  transform-box: fill-box;
  transform-origin: 50% 0%;
  animation: rNod 0.3s ease-in-out infinite;
}
@keyframes rNod {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-2deg); }
}


.r-arm {
  transform-box: fill-box;
  transform-origin: 50% 6%;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.em-celebrate .r-arm-left  { transform: rotate(160deg); }
.em-celebrate .r-arm-right { transform: rotate(-160deg); }
.em-impressed .r-arm-left  { transform: rotate(-120deg); }
.em-impressed .r-arm-right { transform: rotate(120deg); }
.em-tease .r-arm-left      { transform: rotate(45deg); }
.em-tease .r-arm-right     { transform: rotate(-45deg); }

.em-happy .r-arm-right {
  animation: rWave 1.3s ease-in-out infinite;
}
@keyframes rWave {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-18deg); }
  60% { transform: rotate(6deg); }
}

.em-tease .r-root { transform: rotate(-3deg); transition: transform 0.4s ease; }


.r-zzz { display: none; }
.em-sleepy .r-zzz { display: block; }
.r-z {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: rZfloat 2.4s ease-in-out infinite;
}
.r-z2 { animation-delay: 0.7s; }
.r-z3 { animation-delay: 1.4s; }
@keyframes rZfloat {
  0% { opacity: 0; transform: translateY(10px) scale(0.7); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px) scale(1.15); }
}


.robot-glow {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0;
  z-index: 0;
  transition: opacity 0.45s ease, background 0.45s ease;
  pointer-events: none;
}
.robot-card.em-neutral .robot-glow    { background: var(--accent); opacity: 0.32; }
.robot-card.em-happy .robot-glow      { background: var(--green); opacity: 0.42; }
.robot-card.em-impressed .robot-glow  { background: var(--cyan); opacity: 0.40; }
.robot-card.em-celebrate .robot-glow  { background: var(--accent); opacity: 0.6; animation: glowPulse 1.2s ease-in-out infinite; }
.robot-card.em-tease .robot-glow      { background: var(--red); opacity: 0.40; }
.robot-card.em-sleepy .robot-glow     { background: #94a3b8; opacity: 0.30; }
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.08); }
}


.robot-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: var(--f-small);
  font-weight: 700;
  color: var(--sub);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b9b4a6;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.robot-card.em-neutral .status-dot    { background: #b9b4a6; }
.robot-card.em-happy .status-dot      { background: var(--green); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.robot-card.em-impressed .status-dot  { background: var(--cyan); box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.18); }
.robot-card.em-celebrate .status-dot  { background: var(--accent); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22); animation: dotPulse 1.2s ease-in-out infinite; }
.robot-card.em-tease .status-dot      { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18); }
.robot-card.em-sleepy .status-dot     { background: #94a3b8; }
@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}


.modal-mask:not([hidden]) {
  position: fixed;
  inset: 0;
  background: rgba(35, 30, 22, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 60px rgba(35, 30, 22, 0.22);
  overflow: hidden;
  animation: modalUp 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
}
@keyframes modalUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-head h2 { font-size: var(--f-h2); font-weight: 800; }
.modal-close {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--sub);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { color: var(--ink); border-color: var(--accent); }
.modal-body { padding: 16px 24px 24px; font-size: var(--f-small); color: var(--sub); }
.modal-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.modal-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 10px; text-align: center; }
.modal-stat b { display: block; font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.modal-stat span { font-size: var(--f-micro); color: var(--sub); font-weight: 600; }
.modal-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: var(--f-small);
}
.modal-row .mr-time { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.modal-empty { text-align: center; padding: 20px 0; color: var(--sub); }


#confettiLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 80;
}
.confetti {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(115vh) rotate(760deg); }
}


.footer {
  margin-top: 26px;
  color: var(--sub);
  font-size: var(--f-small);
  text-align: center;
  line-height: 1.7;
}
.footer code {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  padding: 1px 6px;
  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
}
.footer a {
  text-decoration: none;
  color: inherit;
}


.lb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.lb-tab {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--sub);
  font-size: var(--f-small);
  font-weight: 700;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s ease;
}
.lb-tab:hover { border-color: var(--accent); color: var(--ink); }
.lb-tab.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.28);
}
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: var(--f-small);
  animation: fadeUp 0.35s ease backwards;
}
.lb-row:nth-child(1) { animation-delay: 0ms; }
.lb-row:nth-child(2) { animation-delay: 40ms; }
.lb-row:nth-child(3) { animation-delay: 80ms; }
.lb-row:nth-child(4) { animation-delay: 120ms; }
.lb-row:nth-child(5) { animation-delay: 160ms; }
.lb-row:nth-child(n+6) { animation-delay: 200ms; }
.lb-rank {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--sub);
  background: #ece8df;
}
.lb-row.rank-1 .lb-rank { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
.lb-row.rank-2 .lb-rank { background: #c8ccd3; color: #23262b; box-shadow: 0 0 0 4px rgba(200, 204, 211, 0.25); }
.lb-row.rank-3 .lb-rank { background: #e0a46c; color: #3c2410; box-shadow: 0 0 0 4px rgba(224, 164, 108, 0.22); }
.lb-date {
  flex: 1;
  color: var(--sub);
  font-size: var(--f-micro);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-main {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.lb-score {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
}
.lb-row.rank-1 .lb-score { color: #b45309; }
.lb-row.rank-2 .lb-score { color: #52525b; }
.lb-row.rank-3 .lb-score { color: #9a3412; }


@media (max-width: 960px) {
  .shell { padding: 20px 16px 16px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-side { justify-content: flex-start; }
  .global-text { text-align: left; }
  .mode-panel { flex-direction: column; }
  .mode-settings { justify-content: space-between; }
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .robot-col { position: static; }
  .robot-card { max-width: 440px; margin: 0 auto; }
  .stage { height: 300px; }
  .avg-num { font-size: 52px; }
}
@media (max-width: 520px) {
  .test-card { padding: 20px 16px 18px; }
  .mode-tabs { flex-direction: column; }
  .round-list { grid-template-columns: repeat(3, 1fr); }
  .stage-text { font-size: 24px; }
  .stage { height: 250px; }
  .mem-input-wrap { flex-direction: column; }
  .btn-small { width: 100%; }
}
