/* 咖啡拉花 —— 界面做成一台意式咖啡机的台面：上面是拉丝不锈钢的滴水盘，下面是黑色控制面板。 */

:root {
  --steel-hi: #e2e5e7;
  --steel: #c2c6c9;
  --steel-lo: #9da2a7;
  --etch: #2c3033; /* 刻在钢板上的字 */
  --panel: #1a1c1e;
  --panel-2: #232629;
  --panel-3: #2e3235;
  --ink: #eceef0;
  --ink-2: #a5abb1;
  --ink-3: #737a81;
  --lamp: #ffb23e; /* 机器上的琥珀色指示灯：只用在“亮着/进行中”的状态 */
  --lamp-ink: #1d1405;
  --needle: #e0452c;
  --cn: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "Helvetica Neue", Arial, var(--cn);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --gl: max(16px, env(safe-area-inset-left, 0px)); /* 两侧留白：至少 16px，并让开侧边的系统栏 */
  --gr: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
  --brushed: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, rgba(0, 0, 0, 0.025) 1px 2px, transparent 2px 4px);
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--panel);
}
body {
  font-family: var(--cn);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template: "rail" auto "stage" minmax(0, 1fr) "deck" auto / 100%;
}

/* ---------- 顶部钢条 ---------- */
.rail {
  grid-area: rail;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--sat) + 7px) var(--gr) 7px var(--gl);
  background: var(--brushed), linear-gradient(180deg, var(--steel-hi), var(--steel) 70%, var(--steel-lo));
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.4);
  z-index: 2;
}
.badge {
  margin: 0;
  padding: 9px 6px 9px 14px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.34em;
  color: var(--etch);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.14));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.38), 0 1px 0 rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}
.rail-keys {
  display: flex;
  gap: 2px;
  margin-right: -6px; /* 图标自带留白，视觉上对齐到右侧留白线 */
}
.key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 46px;
  padding: 4px 4px 3px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--etch);
  font-size: 11px;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.key svg,
.act svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.key:active {
  background: rgba(0, 0, 0, 0.1);
}

/* ---------- 滴水盘 ---------- */
.stage {
  grid-area: stage;
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='68' height='36'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23636a70'/%3E%3Cstop offset='1' stop-color='%23868d93'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill='url(%23g)'%3E%3Crect x='6' y='6' width='40' height='6' rx='3'/%3E%3Crect x='40' y='24' width='40' height='6' rx='3'/%3E%3Crect x='-28' y='24' width='40' height='6' rx='3'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.55' stroke-width='1'%3E%3Cpath d='M9 12.700h34'/%3E%3Cpath d='M43 30.700h25M0 30.700h9'/%3E%3C/g%3E%3C/svg%3E"),
    var(--brushed),
    radial-gradient(120% 90% at 30% 10%, var(--steel-hi), var(--steel) 55%, var(--steel-lo));
}
#cup {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
  cursor: crosshair;
}
#app[data-mode="present"] #cup,
#app[data-mode="replay"] #cup {
  cursor: default;
}

/* 说明牌 */
.hint {
  position: absolute;
  left: calc(var(--sal) + 10px);
  top: 10px;
  max-width: min(64%, 320px);
  margin: 0;
  padding: 7px 11px 8px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--etch);
  border-radius: 7px;
  background: linear-gradient(180deg, #eef0f1, #d6d9dc);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: opacity 0.25s;
}
.hint:empty {
  opacity: 0;
}

/* 杯量表 */
.gauge {
  position: absolute;
  right: calc(var(--sar) + 10px);
  top: 8px;
  width: 62px;
  text-align: center;
  pointer-events: none;
}
.gauge svg {
  display: block;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4f5f6, #8c9196);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.g-face {
  fill: #17191b;
}
.g-arc {
  fill: none;
  stroke: #5b6168;
  stroke-width: 1.4;
}
.g-full {
  fill: none;
  stroke: var(--needle);
  stroke-width: 3;
}
.g-ticks {
  stroke: #d8dcdf;
  stroke-width: 1.3;
  stroke-linecap: round;
}
.g-needle {
  fill: var(--needle);
  transform-origin: 32px 32px;
  transform: rotate(-120deg);
  transition: transform 0.18s linear;
}
.g-hub {
  fill: #c9cdd0;
}
.g-label {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px 3px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--etch);
  border-radius: 5px;
  background: linear-gradient(180deg, #eef0f1, #d6d9dc);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.g-label b {
  font: 600 13px var(--num);
}
#app[data-fill="free"] .gauge {
  display: none;
}

/* 倒奶方向的箭头，贴在杯沿外 */
.spout {
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2f3336, #17191b);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  padding: 0;
  border: 0;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.3s;
}
/* 把手指好按的范围放大一圈 */
.spout::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
}
.spout.is-held {
  cursor: grabbing;
  box-shadow: 0 0 0 3px rgba(255, 178, 62, 0.45), 0 1px 3px rgba(0, 0, 0, 0.5);
}
#app[data-mode="present"] .spout,
#app[data-mode="replay"] .spout {
  pointer-events: none;
}
.spout svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--lamp);
}
#app[data-mode="present"] .spout,
#app[data-mode="present"] .gauge,
#app[data-mode="present"] .hint {
  opacity: 0;
}

.replay-bar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: rgba(23, 25, 27, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  font-size: 13.5px;
  white-space: nowrap;
}
.replay-bar button {
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--lamp);
  color: var(--lamp-ink);
  font-weight: 600;
}

/* ---------- 控制面板 ---------- */
.deck,
.served {
  grid-area: deck;
  padding: 12px var(--gr) calc(var(--sab) + 12px) var(--gl);
  background: linear-gradient(180deg, #26292c, var(--panel) 60%);
  border-top: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11);
}
.deck {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
}
#app[data-hand="left"] .deck {
  grid-template-columns: minmax(0, 1fr) auto;
}
#app[data-hand="left"] .lever {
  order: 2;
}
#app[data-mode="present"] .deck {
  visibility: hidden;
}
#app[data-mode="replay"] .deck {
  opacity: 0.45;
  pointer-events: none;
}

/* 抬高拨杆 */
.lever {
  position: relative;
  display: grid;
  grid-template-rows: minmax(64px, 1fr) auto;
  justify-items: center;
  gap: 8px;
  width: 112px;
  padding: 12px 6px 10px;
  border: 1px solid #000;
  border-radius: 14px;
  background: linear-gradient(180deg, #2c2f32, #1f2224);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 2px 0 rgba(0, 0, 0, 0.5);
  text-align: center;
  touch-action: none;
}
.lever-slot {
  position: relative;
  width: 36px;
  height: 100%;
  border-radius: 18px;
  background: #0b0c0d;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.09);
}
.lever-paddle {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 30px;
  border-radius: 15px;
  background: linear-gradient(180deg, #f1f3f4, #b4b9bd 55%, #8d9398);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.7), inset 0 1px 0 #fff;
  transition: bottom 0.13s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.lever[aria-pressed="true"] .lever-paddle {
  bottom: calc(100% - 33px);
}
.lever-lamp {
  position: absolute;
  right: 11px;
  top: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b2c13;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
}
.lever[aria-pressed="true"] .lever-lamp {
  background: var(--lamp);
  box-shadow: 0 0 8px 1px rgba(255, 178, 62, 0.75);
}
.lever-text b {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
}
.lever-text small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink-2);
}

.lever-text .lever-kbd {
  display: none;
  color: var(--ink-3);
}
@media (hover: hover) and (pointer: fine) {
  .lever-text .lever-kbd {
    display: block;
  }
}

.dials {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 4px;
  min-width: 0;
}
.slide {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.slide output {
  text-align: right;
  color: var(--ink);
  font: 600 15px var(--num);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  touch-action: none;
  --p: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #c98a2b var(--p), #0b0c0d var(--p));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.08);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #c98a2b var(--p), #0b0c0d var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 35% 30%, #fff, #c5cacd 45%, #858b90);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 35% 30%, #fff, #c5cacd 45%, #858b90);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.acts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-self: end;
  margin-top: 4px;
}
.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0 6px;
  border: 1px solid #000;
  border-radius: 10px;
  background: linear-gradient(180deg, #2f3235, #212426);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  font-size: 12px;
  line-height: 1.2;
}
.act:active:not(:disabled) {
  background: #1a1c1e;
}
.act:disabled {
  opacity: 0.36;
}
.act-go:not(:disabled) {
  color: var(--lamp-ink);
  background: linear-gradient(180deg, #ffc86e, #f0a334);
  border-color: #71470a;
  font-weight: 600;
}

/* ---------- 上桌 ---------- */
.served {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  z-index: 1;
}
.served-line {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}
.served-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn {
  padding: 11px 16px;
  border: 1px solid #000;
  border-radius: 10px;
  background: linear-gradient(180deg, #2f3235, #212426);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  font-size: 14.5px;
}
.btn-main {
  color: var(--lamp-ink);
  background: linear-gradient(180deg, #ffc86e, #f0a334);
  border-color: #71470a;
  font-weight: 600;
}

/* ---------- 弹层 ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(6, 7, 8, 0.58);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  max-height: 88%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px max(18px, env(safe-area-inset-right, 0px)) calc(var(--sab) + 22px) max(18px, env(safe-area-inset-left, 0px));
  border-radius: 18px 18px 0 0;
  background: var(--panel-2);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
  -webkit-user-select: text;
  user-select: text;
}
@keyframes rise {
  from {
    transform: translateY(28px);
    opacity: 0;
  }
}
.sheet-head {
  position: sticky;
  top: -6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -18px 4px;
  padding: 14px 18px 10px;
  background: var(--panel-2);
}
.sheet-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.sheet-x {
  padding: 7px 13px;
  border: 1px solid #000;
  border-radius: 999px;
  background: var(--panel-3);
  font-size: 13.5px;
  color: var(--ink-2);
}
.sheet-lead {
  margin: 0 0 14px;
  max-width: 34em;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

.steps {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: s;
  max-width: 36em;
}
.steps li {
  position: relative;
  counter-increment: s;
  padding: 0 0 14px 38px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
}
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--lamp);
  color: var(--lamp-ink);
  font: 600 14px/24px var(--num);
  text-align: center;
}
.steps b {
  color: var(--ink);
  font-weight: 600;
}
.notes {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  max-width: 36em;
  font-size: 14px;
  line-height: 1.6;
}
.notes dt {
  color: var(--ink);
  font-weight: 600;
}
.notes dd {
  margin: 0;
  color: var(--ink-2);
}

.demo-list {
  display: grid;
  gap: 10px;
}
.demo {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 10px;
  border: 1px solid #000;
  border-radius: 14px;
  background: linear-gradient(180deg, #2c2f32, #222527);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: left;
}
.demo img {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #111;
}
.demo b {
  display: block;
  font-size: 16.500px;
  font-weight: 600;
}
.demo small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}
.demo i {
  font-style: normal;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--lamp);
  color: var(--lamp-ink);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.opts {
  display: grid;
  gap: 16px;
}
.opt {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.opt legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seg button {
  padding: 9px 13px;
  border: 1px solid #000;
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink-2);
  font-size: 14px;
}
.seg button[aria-pressed="true"] {
  color: var(--lamp-ink);
  background: var(--lamp);
  border-color: #71470a;
  font-weight: 600;
}
.swatches {
  display: flex;
  gap: 12px;
}
.swatches button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.25);
}
.swatches button[aria-pressed="true"] {
  outline: 2px solid var(--lamp);
  outline-offset: 2px;
}
.opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.opt-row legend {
  float: left;
  width: 100%;
}
.tog {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
}
.tog input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 42px;
  height: 25px;
  margin: 0;
  border: 1px solid #000;
  border-radius: 13px;
  background: #0b0c0d;
  transition: background 0.15s;
}
.tog input::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f1f3f4, #9aa0a5);
  transition: transform 0.15s;
}
.tog input:checked {
  background: var(--lamp);
}
.tog input:checked::after {
  transform: translateX(17px);
}

.sheet-photo img {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: 58vh;
  object-fit: contain;
  margin: 0 auto 12px;
  border-radius: 12px;
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
}
.sheet-photo .sheet-lead {
  text-align: center;
  max-width: none;
}
.sheet-photo .served-acts {
  justify-content: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sab) + 190px);
  z-index: 20;
  transform: translateX(-50%);
  max-width: 86%;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(16, 17, 19, 0.94);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}
.fatal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 32px;
  background: var(--panel);
  font-size: 16px;
  line-height: 1.7;
  text-align: center;
}

/* ---------- 横屏 / 桌面：面板挪到右侧 ---------- */
@media (min-width: 760px) and (min-aspect-ratio: 11/10) {
  #app {
    grid-template: "rail rail" auto "stage deck" minmax(0, 1fr) / minmax(0, 1fr) 348px;
  }
  .deck,
  .served {
    border-top: 0;
    border-left: 1px solid #000;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.09);
    padding: 22px max(22px, env(safe-area-inset-right, 0px)) calc(var(--sab) + 22px) 22px;
  }
  .deck {
    grid-template-columns: 100%;
    grid-template-rows: minmax(150px, 220px) auto;
    align-content: start;
    gap: 22px;
  }
  #app[data-hand="left"] .deck {
    grid-template-columns: 100%;
  }
  #app[data-hand="left"] .lever {
    order: 0;
  }
  .lever {
    width: 100%;
    grid-template-rows: minmax(90px, 1fr) auto;
  }
  .dials {
    gap: 14px;
  }
  .acts {
    margin-top: 8px;
  }
  .served {
    justify-content: flex-start;
  }
  .sheet {
    left: 50%;
    right: auto;
    bottom: 50%;
    width: min(560px, 92vw);
    transform: translate(-50%, 50%);
    border-radius: 18px;
    padding-bottom: 24px;
    animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
  }
  @keyframes pop {
    from {
      transform: translate(-50%, calc(50% + 16px));
      opacity: 0;
    }
  }
  .toast {
    bottom: 36px;
  }
  .hint {
    font-size: 14.5px;
    left: 16px;
    top: 16px;
  }
  .gauge {
    right: 16px;
    top: 14px;
  }
}

/* 矮屏（横着拿手机）：压缩顶部钢条和面板 */
@media (max-height: 460px) {
  .rail {
    padding-top: calc(var(--sat) + 3px);
    padding-bottom: 3px;
  }
  .badge {
    padding: 6px 4px 6px 11px;
    font-size: 15px;
  }
  .key span {
    display: none;
  }
  .deck,
  .served {
    padding-top: 10px;
    padding-bottom: calc(var(--sab) + 10px);
    overflow-y: auto;
  }
  .deck {
    grid-template-rows: minmax(84px, 1fr) auto;
    gap: 10px;
  }
  .lever {
    grid-template-rows: minmax(40px, 1fr) auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .dials {
    gap: 4px;
  }
  .acts {
    margin-top: 2px;
  }
  .hint {
    top: 6px;
    font-size: 12.5px;
    padding: 5px 9px 6px;
  }
  .gauge {
    top: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
