#stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 20px;
  background: radial-gradient(ellipse at 50% 63%, #101924 0, #05070d 66%);
  --experiment-width: 870px;
}
.stage-head, .cup-stats, .experiment-controls { width: min(100%, var(--experiment-width)); }
.stage-head { text-align: center; }
.stage-head h2 { margin: 0; font-size: 18px; font-weight: 650; color: #edf3fa; }
.stage-head p { margin: 4px 0 0; color: #a9b9c9; font-size: 12px; }
.cup-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: clamp(18px, 5vh, 46px); }
.cup-stat { text-align: center; }
.cup-stat .temperature {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  border: 1px solid #2a3d52;
  border-radius: 7px;
  background: #101925;
  color: #bdcbda;
  font-size: 12px;
}
.temperature strong { color: var(--temperature); font-size: 18px; font-variant-numeric: tabular-nums; }
.cup-stat p { margin: 7px 0 3px; color: #a9b6c5; font-size: 12px; }
.variation { color: #ffd0ec; font-variant-numeric: tabular-nums; }
.variation-track { width: min(52%, 120px); height: 3px; margin: 0 auto; border-radius: 3px; background: #263041; }
.variation-track span { display: block; width: clamp(0%, var(--variation, 0%), 100%); height: 100%; border-radius: inherit; background: #ed72bd; }

#cups { width: min(100%, var(--experiment-width)); flex: 1 1 auto; min-height: 0; max-height: 505px; touch-action: none; }
#cups:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.field-key { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 2px 0 0; color: #b3c1d1; font-size: 12px; }
.field-key i { width: 92px; height: 6px; border-radius: 4px; background: linear-gradient(90deg, #1b3349, #dd2c8f); border: 1px solid #ffffff29; }
.stage-hint { margin: 7px 0 14px; text-align: center; font-size: 12px; color: #b3c1d1; }
.experiment-controls {
  max-width: 620px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #27384c;
  border-radius: 12px;
  background: #101825;
}
.experiment-controls button, #panel .seg button, #panel .small {
  min-height: 42px;
  padding: 4px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--accent);
  border: 1px solid #6b562a;
  background: #171c25;
  cursor: pointer;
}
.experiment-controls button { border-radius: 7px; }
#panel .seg button { border-left-width: 0; }
#panel .seg button:first-child { border-left-width: 1px; }
#panel .seg button.on, .experiment-controls #play { background: var(--accent); border-color: var(--accent); color: #221a0a; font-weight: 650; }
#play { min-width: 84px; }
.experiment-controls button:hover, #panel button:hover { border-color: var(--accent); }
.timeline { min-width: 0; display: flex; align-items: center; gap: 8px; margin-left: 5px; color: #b3c1d1; font-size: 12px; }
.timeline span { white-space: nowrap; }
.timeline input { min-width: 0; height: 36px; margin: 0; }
.timeline output { min-width: 58px; white-space: nowrap; color: #d3dde9; }
#panel h1 { margin-bottom: 0; }
#panel .note { color: #a9b6c6; }
#panel .slider { grid-template-columns: 44px minmax(0, 1fr) 54px; min-height: 42px; }
#panel input[type=range] { height: 35px; margin: 0; }
#panel .switch { min-height: 42px; gap: 8px; }
#panel .ratio { display: flex; justify-content: space-between; padding: 8px 10px; background: #192436; border-radius: 7px; }
#ratio { color: var(--accent); }
#shareLink { width: 100%; background: #172134; color: var(--text); border: 1px solid var(--line); margin-top: 8px; min-height: 32px; }
#panelToggle { color: var(--accent); border-color: #6b562a; }
@media (max-width: 760px) {
  #stage { padding: 68px 12px 12px; }
  #stage #panelToggle, #stage .learn-fab { top: 10px; min-height: 42px; display: grid; place-items: center; }
  #stage .learn-fab { left: 12px; right: auto; }
  .stage-head h2, .temperature strong { font-size: 16px; }
  .cup-stats { margin-top: clamp(12px, 5vh, 40px); }
  #cups { max-height: min(43vh, 74vw, 465px); }
  .stage-hint { margin-bottom: 12px; }
  .experiment-controls { grid-template-columns: 1fr 1fr; gap: 3px 8px; }
  .timeline { grid-column: span 2; margin-inline: 5px; }
  .experiment-controls button { min-height: 42px; }
}
@media (min-width: 761px) and (max-height: 590px) {
  #stage { padding-block: 16px; }
  .cup-stats { margin-top: 12px; }
}
@media (max-width: 760px) and (max-height: 585px) {
  #stage { padding-top: 56px; padding-bottom: 6px; }
  .stage-head p { display: none; }
  .cup-stats { margin-top: 6px; }
  .stage-hint { margin: 4px 0 5px; }
}
@media (prefers-reduced-motion: reduce) {
  #panel { transition: none; }
}
#stage .learn-fab { display: none; }
@media (max-width: 760px) {
  #stage .learn-fab { display: grid; bottom: auto; transform: none; color: var(--accent); border-color: #6b562a; }
}
