:root {
  --ink: #173229;
  --ink-soft: #31483f;
  --muted: #718078;
  --canvas: #edf2ec;
  --paper: #fffdf8;
  --paper-soft: #f7f9f5;
  --line: #cfd9d1;
  --line-strong: #aebdb2;
  --green: #3f9f76;
  --green-light: #72c39d;
  --green-dark: #176346;
  --red: #d95f63;
  --red-light: #ef8988;
  --red-dark: #97353d;
  --amber: #dca63c;
  --amber-light: #f2ca6b;
  --wood: #8c6a4c;
  --wood-light: #b28e69;
  --wood-dark: #4e382b;
  --shadow: rgba(48, 68, 58, 0.18);
  --cell-size: 54px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background-color: var(--canvas);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.08)),
    repeating-linear-gradient(90deg, rgba(71, 96, 82, 0.025) 0, rgba(71, 96, 82, 0.025) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(0deg, rgba(71, 96, 82, 0.02) 0, rgba(71, 96, 82, 0.02) 1px, transparent 1px, transparent 28px);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: repeating-linear-gradient(112deg, transparent 0, transparent 7px, rgba(23, 50, 41, 0.012) 8px, transparent 9px);
  content: "";
  pointer-events: none;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
.bottle:focus-visible,
.shelf-cell:focus-visible {
  outline: 3px solid rgba(220, 166, 60, 0.82);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.home-screen,
.game-app {
  width: min(100%, 1240px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-inline: 28px;
}

.home-screen {
  display: flex;
  flex-direction: column;
}

.home-header,
.topbar {
  position: relative;
  z-index: 10;
  min-height: 76px;
  margin-inline: -28px;
  padding-inline: 28px;
  border-bottom: 1px solid rgba(174, 189, 178, 0.72);
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-header-actions,
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 10px;
  padding: 6px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-static {
  cursor: default;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #31594b;
  border-radius: 7px;
  color: #fffdf6;
  background: var(--ink);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 3px 8px rgba(23, 50, 41, 0.16);
  font-family: Georgia, serif;
  font-size: 19px;
  line-height: 1;
}

.brand-mark::after {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber-light);
  content: "";
}

.home-progress,
#home-next-level,
.home-footer,
.shelf-heading,
.tray-heading,
.level-divider,
#level-size {
  display: none;
}

.sound-button {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(174, 189, 178, 0.9);
  border-radius: 50%;
  color: var(--green-dark);
  background: rgba(255, 253, 248, 0.76);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.96), inset 0 -2px 4px rgba(40, 74, 57, 0.06), 0 4px 11px rgba(52, 79, 65, 0.09);
  cursor: pointer;
  line-height: 1;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.sound-button:hover {
  border-color: var(--green);
  background: #f8fcf7;
  transform: translateY(-1px);
}

.sound-button:active {
  transform: translateY(1px) scale(0.97);
}

.sound-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.sound-button.is-muted {
  color: #87928c;
}

.sound-button.is-muted .sound-icon {
  opacity: 0.5;
}

.sound-button.is-muted::after {
  position: absolute;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--red-dark);
  box-shadow: 0 0 0 1px rgba(255, 253, 248, 0.75);
  content: "";
  transform: rotate(-45deg);
}

/* 首页 */
.home-stage {
  position: relative;
  display: grid;
  flex: 1;
  grid-template-rows: minmax(330px, 1fr) auto;
  justify-items: center;
  min-height: 650px;
  padding: 34px 0 46px;
}

.home-visual {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 360px;
  place-items: center;
}

.home-visual::before {
  position: absolute;
  bottom: 5%;
  width: min(72vw, 620px);
  height: 32px;
  border-radius: 50%;
  background: rgba(52, 67, 59, 0.14);
  filter: blur(16px);
  content: "";
}

.home-shelf {
  position: relative;
  width: min(68vw, 390px);
  aspect-ratio: 1;
  padding: 19px;
  border: 15px solid var(--wood);
  border-color: var(--wood-light) var(--wood) var(--wood-dark) #9e7956;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), transparent 48%),
    #dfe8df;
  box-shadow:
    inset 5px 0 8px rgba(255, 230, 193, 0.18),
    inset -7px 0 10px rgba(55, 36, 25, 0.22),
    inset 0 0 0 3px rgba(75, 55, 40, 0.3),
    inset 0 18px 28px rgba(71, 91, 78, 0.13),
    0 21px 36px rgba(60, 78, 68, 0.24),
    0 8px 0 #3f2d23;
  transform: perspective(900px) rotateX(1.5deg) rotateY(-0.6deg);
  transform-style: preserve-3d;
}

.home-shelf::before {
  position: absolute;
  z-index: 4;
  top: -22px;
  right: -22px;
  left: -22px;
  height: 12px;
  border: 1px solid #72543d;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(#b8916c, #79583f);
  box-shadow: 0 5px 8px rgba(54, 38, 28, 0.22);
  content: "";
}

.home-shelf::after {
  position: absolute;
  z-index: 4;
  right: -21px;
  bottom: -24px;
  left: -21px;
  height: 14px;
  border: 1px solid #50392b;
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(#76533b, #4b3529);
  box-shadow: 0 8px 12px rgba(45, 34, 27, 0.2);
  content: "";
}

.home-grid {
  position: relative;
  z-index: 2;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  padding: 5px;
  background:
    linear-gradient(90deg, transparent 32%, rgba(76, 95, 83, 0.26) 32%, rgba(76, 95, 83, 0.26) 34%, transparent 34%, transparent 66%, rgba(76, 95, 83, 0.26) 66%, rgba(76, 95, 83, 0.26) 68%, transparent 68%),
    linear-gradient(transparent 32%, rgba(76, 95, 83, 0.26) 32%, rgba(76, 95, 83, 0.26) 34%, transparent 34%, transparent 66%, rgba(76, 95, 83, 0.26) 66%, rgba(76, 95, 83, 0.26) 68%, transparent 68%);
  box-shadow: inset 0 5px 14px rgba(61, 82, 69, 0.12);
}

.home-path {
  position: absolute;
  z-index: 2;
  inset: 34px;
  width: calc(100% - 68px);
  height: calc(100% - 68px);
  overflow: visible;
  filter: drop-shadow(0 2px 1px rgba(113, 76, 18, 0.22));
}

.home-path path {
  fill: none;
  stroke: var(--amber-light);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.home-bottle {
  position: relative;
  z-index: 3;
  display: grid;
  width: 46%;
  height: 68%;
  place-self: center;
  place-items: center;
  border: 1px solid rgba(218, 255, 237, 0.62);
  border-radius: 24% 24% 34% 34% / 14% 14% 12% 12%;
  box-shadow: inset 6px 0 8px rgba(255, 255, 255, 0.26), inset -7px 0 9px rgba(10, 47, 32, 0.22), inset 0 3px 5px rgba(255, 255, 255, 0.17), inset 0 -8px 6px rgba(9, 58, 37, 0.24), 0 7px 10px rgba(28, 58, 43, 0.2);
  backdrop-filter: blur(1.4px) saturate(1.25);
  filter: drop-shadow(0 2px 1px rgba(255, 255, 255, 0.24));
  transform: perspective(180px) rotateX(-1deg);
  transform-style: preserve-3d;
}

.home-bottle::before {
  position: absolute;
  top: -12%;
  width: 49%;
  height: 16%;
  border: 1px solid #64716d;
  border-radius: 3px 3px 2px 2px;
  background: repeating-linear-gradient(90deg, #c9d2cf 0, #c9d2cf 2px, #7f8d88 2px, #7f8d88 4px);
  box-shadow: inset 3px 0 3px rgba(255, 255, 255, 0.58), inset -3px 0 3px rgba(51, 65, 60, 0.22), inset 0 -2px #697772, 0 2px 3px rgba(31, 47, 40, 0.22);
  content: "";
}

.home-bottle::after {
  position: absolute;
  top: 11%;
  left: 16%;
  width: 12%;
  height: 52%;
  border-radius: 50%;
  background: linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.06));
  content: "";
  transform: rotate(5deg);
}

.home-bottle.green {
  background:
    radial-gradient(circle at 30% 15%, rgba(232, 255, 243, 0.52), transparent 24%),
    linear-gradient(180deg, rgba(237, 255, 246, 0.16) 0%, rgba(56, 180, 123, 0.08) 55%, rgba(22, 132, 84, 0.34) 100%),
    linear-gradient(90deg, rgba(8, 74, 48, 0.58) 0%, rgba(99, 218, 164, 0.18) 28%, rgba(41, 164, 108, 0.32) 58%, rgba(5, 67, 44, 0.56) 100%);
}

.home-bottle.red {
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 238, 239, 0.52), transparent 24%),
    linear-gradient(180deg, rgba(255, 241, 242, 0.16) 0%, rgba(218, 85, 94, 0.08) 55%, rgba(174, 42, 55, 0.34) 100%),
    linear-gradient(90deg, rgba(116, 20, 33, 0.58) 0%, rgba(246, 147, 151, 0.18) 28%, rgba(216, 78, 88, 0.32) 58%, rgba(98, 13, 27, 0.56) 100%);
  border-color: rgba(255, 225, 227, 0.62);
  box-shadow: inset 6px 0 8px rgba(255, 255, 255, 0.25), inset -7px 0 9px rgba(78, 12, 23, 0.22), inset 0 3px 5px rgba(255, 255, 255, 0.16), inset 0 -8px 6px rgba(111, 15, 29, 0.24), 0 7px 10px rgba(71, 28, 34, 0.2);
}

.home-bottle i {
  position: relative;
  z-index: 1;
  color: rgba(244, 255, 248, 0.94);
  background: transparent;
  text-shadow: 0 -1px 0 rgba(9, 43, 29, 0.8), 0 1px 0 rgba(226, 255, 239, 0.36), 0 2px 4px rgba(5, 32, 21, 0.42);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 18px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.home-copy {
  position: relative;
  z-index: 5;
  display: grid;
  justify-items: center;
  margin-top: 20px;
}

.home-title-block {
  text-align: center;
}

.home-title-block h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
  text-shadow: 0 2px rgba(255, 255, 255, 0.7);
}

.home-actions {
  display: grid;
  width: min(88vw, 336px);
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.home-primary-button,
.home-secondary-button,
.confirm-button,
.secondary-button,
.danger-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.home-primary-button,
.confirm-button {
  border: 1px solid #12563c;
  color: #fff;
  background: linear-gradient(#267b58, #176346);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 4px 0 #0e4934, 0 8px 16px rgba(23, 99, 70, 0.16);
}

.home-primary-button:hover,
.confirm-button:hover {
  background: linear-gradient(#2e8862, #1b6d4d);
  transform: translateY(-1px);
}

.home-primary-button:active,
.confirm-button:active {
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.15), 0 1px 0 #0e4934;
  transform: translateY(3px);
}

.home-secondary-button,
.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.92), 0 3px 8px rgba(44, 66, 54, 0.06);
}

.home-secondary-button:hover,
.secondary-button:hover {
  border-color: #89a293;
  background: #fffefa;
  transform: translateY(-1px);
}

.home-secondary-button:active,
.secondary-button:active {
  transform: translateY(1px) scale(0.99);
}

/* 游戏页 */
.game-app {
  padding-bottom: 26px;
}

.topbar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  background: rgba(237, 242, 236, 0.9);
  backdrop-filter: blur(14px) saturate(1.15);
}

.level-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.time-readout {
  display: flex;
  min-width: 74px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.time-dot {
  width: 9px;
  height: 9px;
  border: 2px solid #d6eee2;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(63, 159, 118, 0.16);
}

.time-readout.is-urgent {
  color: var(--red-dark);
}

.time-readout.is-urgent .time-dot {
  border-color: #f7d8d8;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 95, 99, 0.16);
  animation: pulse 1s ease-in-out infinite;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
  gap: clamp(26px, 4vw, 48px);
  align-items: start;
  padding-top: 30px;
}

.playfield {
  display: grid;
  min-width: 0;
  min-height: calc(100dvh - 136px);
  place-items: center;
  padding: 16px 0 40px;
}

.shelf-frame {
  position: relative;
  display: grid;
  max-width: 100%;
  justify-items: center;
  padding: 10px;
  overflow: visible;
  border: 18px solid var(--wood);
  border-color: var(--wood-light) var(--wood) var(--wood-dark) #997451;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), transparent 48%),
    #dce5dd;
  box-shadow:
    inset 6px 0 9px rgba(255, 231, 198, 0.16),
    inset -8px 0 11px rgba(54, 35, 24, 0.23),
    inset 0 0 0 3px rgba(64, 48, 37, 0.3),
    inset 0 18px 34px rgba(55, 78, 64, 0.16),
    0 20px 35px rgba(45, 67, 55, 0.23),
    0 8px 0 #3f2d23;
  filter: drop-shadow(0 3px 1px rgba(255, 255, 255, 0.24));
  transform: perspective(1200px) rotateX(0.8deg);
  transform-style: preserve-3d;
  scrollbar-color: #9caf9f transparent;
  scrollbar-width: thin;
}

.shelf-frame::before {
  position: absolute;
  z-index: 4;
  top: -24px;
  right: -24px;
  left: -24px;
  height: 11px;
  border: 1px solid #72543d;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(#bb9570, #76563f);
  box-shadow: 0 5px 8px rgba(54, 38, 28, 0.2);
  content: "";
  pointer-events: none;
}

.shelf-frame::after {
  position: absolute;
  z-index: 4;
  right: -23px;
  bottom: -26px;
  left: -23px;
  height: 13px;
  border: 1px solid #50392b;
  border-radius: 2px 2px 4px 4px;
  background: linear-gradient(#76543d, #4c372a);
  box-shadow: 0 8px 12px rgba(45, 34, 27, 0.18);
  content: "";
  pointer-events: none;
}

.shelf-grid {
  position: relative;
  display: grid;
  width: fit-content;
  grid-template-columns: repeat(var(--columns), var(--cell-size));
  grid-template-rows: repeat(var(--rows), var(--cell-size));
  gap: 6px;
}

.shelf-cell {
  position: relative;
  display: grid;
  width: var(--cell-size);
  height: var(--cell-size);
  place-items: center;
  overflow: visible;
  border: 1px solid rgba(119, 142, 127, 0.52);
  border-radius: 4px;
  background:
    radial-gradient(ellipse at 52% 78%, rgba(67, 89, 75, 0.09), transparent 48%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(226, 237, 229, 0.62)),
    var(--paper-soft);
  box-shadow: inset 5px 6px 10px rgba(57, 79, 65, 0.14), inset -3px -3px 5px rgba(255, 255, 255, 0.78), 0 1px rgba(255, 255, 255, 0.7);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.shelf-cell::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  border-top: 2px solid rgba(72, 95, 79, 0.18);
  border-left: 2px solid rgba(72, 95, 79, 0.12);
  border-radius: inherit;
  box-shadow: inset 0 1px 2px rgba(38, 61, 47, 0.12);
  content: "";
  pointer-events: none;
}

.shelf-cell::after {
  position: absolute;
  right: 7%;
  bottom: 4%;
  left: 7%;
  height: 8%;
  border-radius: 50%;
  background: rgba(48, 69, 57, 0.12);
  filter: blur(2px);
  content: "";
  pointer-events: none;
}

.shelf-cell.is-drop-target {
  z-index: 3;
  border-color: var(--green);
  background: #ddf2e6;
  box-shadow: inset 0 0 0 2px rgba(63, 159, 118, 0.18), 0 0 0 3px rgba(63, 159, 118, 0.12);
  transform: scale(1.045);
}

.shelf-cell.is-selected {
  border-color: var(--amber);
  background: #fff5d9;
  box-shadow: inset 0 0 0 2px rgba(220, 166, 60, 0.16);
}

.solution-path-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.solution-path {
  fill: none;
  opacity: 0;
  stroke: var(--amber-light);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 2px 1px rgba(111, 70, 8, 0.25));
}

.solution-path.is-animating {
  opacity: 0.96;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-solution var(--path-duration, 2200ms) linear forwards;
}

.game-side-panel {
  position: sticky;
  top: 100px;
  display: flex;
  max-height: calc(100dvh - 122px);
  min-height: min(650px, calc(100dvh - 122px));
  flex-direction: column;
  padding-left: 28px;
  border-left: 1px solid rgba(174, 189, 178, 0.82);
}

.bottle-tray {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.bottle-pool {
  display: grid;
  min-height: 184px;
  flex: 1;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  grid-auto-rows: 67px;
  align-content: start;
  gap: 9px;
  padding: 16px 12px;
  overflow: auto;
  border: 1px solid rgba(174, 189, 178, 0.9);
  border-radius: 7px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(247, 250, 246, 0.78)),
    repeating-linear-gradient(0deg, transparent 0, transparent 66px, rgba(147, 165, 153, 0.2) 67px, transparent 68px);
  box-shadow: inset 0 7px 16px rgba(54, 80, 65, 0.07), 0 7px 18px rgba(49, 72, 60, 0.07);
  scrollbar-color: #9caf9f transparent;
  scrollbar-width: thin;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.bottle-pool:empty::after {
  align-self: center;
  justify-self: center;
  color: var(--green-dark);
  content: "✓";
  font-size: 28px;
  font-weight: 900;
  opacity: 0.56;
}

.bottle-pool.is-drop-target {
  border-color: var(--green);
  background: #e4f4e9;
  box-shadow: inset 0 0 0 2px rgba(63, 159, 118, 0.14);
}

/* 瓶子 */
.bottle {
  position: relative;
  z-index: 2;
  display: grid;
  place-self: center;
  place-items: center;
  border: 1px solid rgba(218, 255, 237, 0.62);
  border-radius: 24% 24% 34% 34% / 14% 14% 12% 12%;
  cursor: grab;
  line-height: 1;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(1.4px) saturate(1.25);
  filter: drop-shadow(0 2px 1px rgba(255, 255, 255, 0.22));
  transform: perspective(180px) rotateX(-1deg);
  transform-style: preserve-3d;
  transition: filter 150ms ease, opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.shelf-cell .bottle {
  width: 59%;
  height: 84%;
  min-width: 0;
  min-height: 0;
}

.bottle-pool .bottle {
  width: 37px;
  height: 58px;
  min-width: 37px;
  min-height: 58px;
}

.bottle::before {
  position: absolute;
  top: -12%;
  width: 49%;
  height: 16%;
  border: 1px solid #64716d;
  border-radius: 3px 3px 2px 2px;
  background: repeating-linear-gradient(90deg, #c9d2cf 0, #c9d2cf 2px, #7f8d88 2px, #7f8d88 4px);
  box-shadow: inset 3px 0 3px rgba(255, 255, 255, 0.58), inset -3px 0 3px rgba(51, 65, 60, 0.22), inset 0 -2px #697772, 0 2px 3px rgba(31, 47, 40, 0.22);
  content: "";
}

.bottle::after {
  position: absolute;
  top: 11%;
  left: 16%;
  width: 12%;
  height: 52%;
  border-radius: 50%;
  background: linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.06));
  content: "";
  transform: rotate(5deg);
}

.bottle.green {
  background:
    radial-gradient(circle at 30% 15%, rgba(232, 255, 243, 0.52), transparent 24%),
    linear-gradient(180deg, rgba(237, 255, 246, 0.16) 0%, rgba(56, 180, 123, 0.08) 55%, rgba(22, 132, 84, 0.34) 100%),
    linear-gradient(90deg, rgba(8, 74, 48, 0.58) 0%, rgba(99, 218, 164, 0.18) 28%, rgba(41, 164, 108, 0.32) 58%, rgba(5, 67, 44, 0.56) 100%);
  box-shadow: inset 6px 0 8px rgba(255, 255, 255, 0.26), inset -7px 0 9px rgba(10, 47, 32, 0.22), inset 0 3px 5px rgba(255, 255, 255, 0.17), inset 0 -8px 6px rgba(9, 58, 37, 0.24), 0 7px 10px rgba(28, 58, 43, 0.2);
}

.bottle.red {
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 238, 239, 0.52), transparent 24%),
    linear-gradient(180deg, rgba(255, 241, 242, 0.16) 0%, rgba(218, 85, 94, 0.08) 55%, rgba(174, 42, 55, 0.34) 100%),
    linear-gradient(90deg, rgba(116, 20, 33, 0.58) 0%, rgba(246, 147, 151, 0.18) 28%, rgba(216, 78, 88, 0.32) 58%, rgba(98, 13, 27, 0.56) 100%);
  border-color: rgba(255, 225, 227, 0.62);
  box-shadow: inset 6px 0 8px rgba(255, 255, 255, 0.25), inset -7px 0 9px rgba(78, 12, 23, 0.22), inset 0 3px 5px rgba(255, 255, 255, 0.16), inset 0 -8px 6px rgba(111, 15, 29, 0.24), 0 7px 10px rgba(71, 28, 34, 0.2);
  cursor: default;
}

.bottle-label,
.drag-ghost span {
  position: relative;
  z-index: 2;
  color: rgba(244, 255, 248, 0.95);
  background: transparent;
  text-shadow: 0 -1px 0 rgba(7, 37, 25, 0.82), 0 1px 0 rgba(225, 255, 238, 0.34), 0 2px 4px rgba(5, 29, 20, 0.45);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: clamp(7px, calc(var(--cell-size) / 4), 16px);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.bottle-pool .bottle-label {
  font-size: 14px;
}

.bottle.green:hover {
  filter: saturate(1.08) brightness(1.04);
  transform: perspective(180px) translateY(-3px) rotateX(-4deg) rotateY(2deg);
}

.bottle.is-selected {
  outline: 3px solid var(--amber-light);
  outline-offset: 3px;
  filter: brightness(1.06);
  transform: perspective(180px) translateY(-3px) rotateX(-4deg);
}

.bottle.is-dragging {
  opacity: 0.24;
}

.bottle.is-path-active {
  animation: bottle-path-pop 420ms ease-out;
  filter: saturate(1.2) brightness(1.12);
}

.drag-ghost {
  position: fixed;
  z-index: 40;
  display: grid;
  width: 38px;
  height: 59px;
  place-items: center;
  border: 1px solid rgba(218, 255, 237, 0.66);
  border-radius: 24% 24% 34% 34% / 14% 14% 12% 12%;
  background:
    radial-gradient(circle at 30% 15%, rgba(232, 255, 243, 0.52), transparent 24%),
    linear-gradient(180deg, rgba(237, 255, 246, 0.16) 0%, rgba(56, 180, 123, 0.08) 55%, rgba(22, 132, 84, 0.34) 100%),
    linear-gradient(90deg, rgba(8, 74, 48, 0.58) 0%, rgba(99, 218, 164, 0.18) 28%, rgba(41, 164, 108, 0.32) 58%, rgba(5, 67, 44, 0.56) 100%);
  box-shadow: inset 6px 0 8px rgba(255, 255, 255, 0.26), inset -7px 0 9px rgba(10, 47, 32, 0.22), inset 0 3px 5px rgba(255, 255, 255, 0.17), inset 0 -8px 6px rgba(9, 58, 37, 0.24), 0 16px 25px rgba(27, 63, 44, 0.26);
  backdrop-filter: blur(1.4px) saturate(1.25);
  pointer-events: none;
  transform: translate(-50%, -58%) rotate(4deg) scale(1.06);
}

.drag-ghost::before {
  position: absolute;
  top: -12%;
  width: 49%;
  height: 16%;
  border: 1px solid #64716d;
  border-radius: 3px 3px 2px 2px;
  background: repeating-linear-gradient(90deg, #c9d2cf 0, #c9d2cf 2px, #7f8d88 2px, #7f8d88 4px);
  content: "";
}

.drag-ghost::after {
  position: absolute;
  top: 11%;
  left: 16%;
  width: 12%;
  height: 52%;
  border-radius: 50%;
  background: linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.06));
  content: "";
}

.drag-ghost span {
  font-size: 14px;
}

/* 最初版纯色方块 */
.home-bottle,
.bottle,
.drag-ghost {
  display: grid;
  overflow: visible;
  place-items: center;
  border: 0;
  border-radius: 8px;
  backdrop-filter: none;
  filter: none;
  transform: none;
}

.home-bottle::before,
.home-bottle::after,
.bottle::before,
.bottle::after,
.drag-ghost::before,
.drag-ghost::after {
  display: none;
}

.home-bottle.green,
.bottle.green,
.drag-ghost {
  background: var(--green) !important;
  box-shadow: inset 0 -4px var(--green-dark), 0 4px 7px rgba(30, 83, 57, 0.2);
}

.home-bottle.red,
.bottle.red {
  background: var(--red) !important;
  box-shadow: inset 0 -4px var(--red-dark), 0 4px 7px rgba(120, 42, 42, 0.2);
}

.home-bottle {
  width: 56%;
  height: 56%;
}

.home-bottle i,
.bottle-label,
.drag-ghost span {
  position: relative;
  z-index: 2;
  top: auto;
  left: auto;
  width: auto;
  min-height: 0;
  color: #fff;
  background: transparent;
  text-shadow: none;
  transform: none;
}

.home-bottle i {
  font-size: 17px;
}

.shelf-cell .bottle {
  width: 72%;
  height: 72%;
}

.bottle-pool .bottle {
  width: 47px;
  height: 47px;
  min-width: 47px;
  min-height: 47px;
}

.bottle-pool .bottle-label {
  font-size: 14px;
}

.bottle.green:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.bottle.is-selected {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.drag-ghost {
  width: 47px;
  height: 47px;
  box-shadow: inset 0 -4px var(--green-dark), 0 12px 20px rgba(30, 83, 57, 0.28);
  transform: translate(-50%, -50%);
}

.drag-ghost span {
  font-size: 15px;
}

/* 操作区 */
.controls {
  flex: 0 0 auto;
  padding-top: 18px;
}

.status-message {
  min-height: 22px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.status-message.is-error {
  color: var(--red-dark);
}

.status-message.is-success {
  color: var(--green-dark);
}

.control-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 0.82fr;
  gap: 8px;
}

.control-actions button {
  min-width: 0;
  padding-inline: 9px;
  white-space: nowrap;
}

.confirm-button:disabled,
.secondary-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45);
  opacity: 0.48;
  transform: none;
}

.danger-button {
  border: 1px solid var(--red-dark);
  color: #fff;
  background: linear-gradient(#b84a52, #96353d);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.17), 0 3px 0 #7e2931;
}

.danger-button:hover {
  background: linear-gradient(#c4535b, #a33b44);
  transform: translateY(-1px);
}

.icon-button,
.close-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.icon-button:hover,
.close-button:hover {
  border-color: #8da497;
  background: #fff;
  transform: translateY(-1px);
}

/* 弹窗与关卡记录 */
.dialog-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 37, 30, 0.56);
  backdrop-filter: blur(8px);
  animation: backdrop-in 180ms ease-out;
}

.level-dialog,
.rules-dialog,
.result-dialog,
.confirm-dialog {
  width: min(100%, 560px);
  max-height: min(700px, calc(100dvh - 40px));
  overflow: auto;
  border: 1px solid rgba(196, 209, 199, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 253, 248, 0.96)),
    var(--paper);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.9), 0 24px 70px rgba(12, 31, 24, 0.32);
  animation: dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.level-dialog {
  padding: 24px;
}

.rules-dialog {
  width: min(100%, 640px);
  padding: 24px 26px 26px;
}

.dialog-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
}

.dialog-title-row h1,
.result-dialog h1,
.confirm-dialog h1 {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0;
}

.rules-list {
  border-top: 1px solid var(--line);
}

.rule-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.rule-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rule-visual {
  position: relative;
  display: grid;
  width: 150px;
  height: 94px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c6d3c9;
  border-radius: 6px;
  background: #edf3ee;
  box-shadow: inset 0 4px 9px rgba(48, 74, 59, 0.08);
}

.rule-copy strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.rule-copy p {
  max-width: 34em;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
}

.rule-path-visual svg {
  position: absolute;
  z-index: 1;
  inset: 8px 12px;
  width: calc(100% - 24px);
  height: calc(100% - 16px);
}

.rule-path-visual path {
  fill: none;
  stroke: var(--amber-light);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.rule-mini-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(2, 28px);
  gap: 10px 14px;
}

.rule-mini-grid span,
.rule-block {
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.18), 0 3px 5px rgba(34, 62, 47, 0.14);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px;
  font-weight: 900;
}

.rule-mini-grid .green,
.rule-block.green {
  background: var(--green);
}

.rule-mini-grid .red,
.rule-block.red {
  background: var(--red);
}

.rule-color-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
}

.rule-block {
  position: relative;
  width: 43px;
  height: 43px;
  font-size: 14px;
}

.rule-lock {
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 13px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 3px;
  background: var(--red-dark);
  box-shadow: 0 2px 3px rgba(62, 22, 27, 0.24);
}

.rule-lock::before {
  position: absolute;
  top: -9px;
  left: 1px;
  width: 7px;
  height: 8px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  content: "";
}

.rule-arrow {
  position: relative;
  width: 25px;
  height: 2px;
  background: var(--amber);
}

.rule-arrow::after {
  position: absolute;
  top: -4px;
  right: 0;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--amber);
  border-right: 2px solid var(--amber);
  content: "";
  transform: rotate(45deg);
}

.rule-time-visual {
  grid-template-columns: auto auto;
  align-content: center;
  justify-content: center;
  gap: 15px;
}

.rule-clock {
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.rule-check {
  position: relative;
  width: 37px;
  height: 37px;
  border-radius: 50%;
  background: var(--green-dark);
  box-shadow: 0 4px 8px rgba(23, 99, 70, 0.18);
}

.rule-check::after {
  position: absolute;
  top: 10px;
  left: 9px;
  width: 16px;
  height: 8px;
  border-bottom: 3px solid #fff;
  border-left: 3px solid #fff;
  content: "";
  transform: rotate(-45deg);
}

.records-summary {
  margin: -5px 0 18px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.level-option {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: #f8faf7;
  cursor: pointer;
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.level-option:hover:not(:disabled),
.level-option.is-current {
  border-color: var(--green);
  background: #edf7f0;
  box-shadow: 0 7px 14px rgba(36, 100, 69, 0.1);
  transform: translateY(-2px);
}

.level-option.is-passed {
  background: linear-gradient(145deg, #f8fbf7, #eef6ef);
}

.level-option-copy {
  display: grid;
  place-items: center;
}

.level-option strong {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.level-option small {
  display: none;
}

.level-option:disabled {
  cursor: not-allowed;
  filter: grayscale(0.55);
  opacity: 0.55;
}

.level-star {
  position: absolute;
  top: 6px;
  right: 7px;
  color: var(--amber);
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 1px #fff;
}

.level-lock {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 13px;
  height: 11px;
  border: 2px solid #7b8981;
  border-radius: 3px;
}

.level-lock::before {
  position: absolute;
  top: -9px;
  left: 1px;
  width: 7px;
  height: 8px;
  border: 2px solid #7b8981;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  content: "";
}

.result-dialog {
  padding: 31px;
  text-align: center;
}

.result-emblem {
  position: relative;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border: 1px solid #d9bd74;
  border-radius: 50%;
  background: #fff4cf;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.56), 0 8px 18px rgba(148, 108, 25, 0.13);
}

.result-emblem::before {
  position: absolute;
  top: 17px;
  left: 16px;
  width: 25px;
  height: 13px;
  border-bottom: 5px solid #91701e;
  border-left: 5px solid #91701e;
  content: "";
  transform: rotate(-45deg);
}

#result-dialog[data-state="warning"] .result-emblem {
  border-color: #dc9c9f;
  background: #fff0ef;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.56), 0 8px 18px rgba(133, 45, 52, 0.12);
}

#result-dialog[data-state="warning"] .result-emblem::before {
  top: 16px;
  left: 28px;
  width: 5px;
  height: 23px;
  border: 0;
  border-radius: 4px;
  background: var(--red-dark);
  box-shadow: 0 29px 0 -1px var(--red-dark);
  transform: none;
}

.result-dialog h1 {
  font-size: 29px;
}

.result-dialog p,
.confirm-dialog p {
  margin: 10px 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.result-dialog .result-actions {
  justify-content: center;
}

.confirm-dialog {
  width: min(100%, 430px);
  padding: 28px;
}

@keyframes pulse {
  50% { opacity: 0.35; transform: scale(0.82); }
}

@keyframes draw-solution {
  to { stroke-dashoffset: 0; }
}

@keyframes bottle-path-pop {
  50% { transform: translateY(-3px) scale(1.15); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

@media (max-width: 980px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 26px;
  }

  .game-side-panel {
    padding-left: 22px;
  }
}

@media (max-width: 820px) {
  .home-screen,
  .game-app {
    padding-inline: 16px;
  }

  .game-app {
    padding-bottom: 0;
  }

  .home-header,
  .topbar {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    min-height: 68px;
  }

  #home-button > span:last-child {
    display: none;
  }

  .level-readout {
    justify-content: flex-start;
    padding-left: 12px;
    font-size: 14px;
  }

  .game-layout {
    display: block;
    padding-top: 18px;
  }

  .playfield {
    min-height: 0;
    padding: 22px 0 40px;
  }

  .shelf-frame {
    padding: 4px;
    border-width: 10px;
    box-shadow: inset 0 0 0 2px rgba(64, 48, 37, 0.25), inset 0 12px 22px rgba(66, 88, 74, 0.1), 0 13px 24px rgba(45, 67, 55, 0.18), 0 5px 0 #3f2d23;
  }

  .shelf-frame::before {
    top: -15px;
    right: -14px;
    left: -14px;
    height: 8px;
  }

  .shelf-frame::after {
    right: -13px;
    bottom: -17px;
    left: -13px;
    height: 9px;
  }

  .shelf-grid {
    gap: 4px;
  }

  .game-side-panel {
    position: static;
    display: block;
    max-height: none;
    min-height: 0;
    padding: 0 0 calc(100px + env(safe-area-inset-bottom));
    border-left: 0;
  }

  .bottle-tray {
    display: block;
  }

  .bottle-pool {
    display: grid;
    min-height: 145px;
    max-height: none;
    grid-template-rows: repeat(2, 61px);
    grid-template-columns: none;
    grid-auto-columns: 50px;
    grid-auto-flow: column;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .bottle-pool .bottle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .controls {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 10px 16px calc(11px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(174, 189, 178, 0.88);
    background: rgba(237, 242, 236, 0.94);
    box-shadow: 0 -10px 25px rgba(42, 67, 53, 0.09);
    backdrop-filter: blur(14px) saturate(1.1);
  }

  .status-message {
    min-height: 18px;
    margin-bottom: 6px;
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .home-screen,
  .game-app {
    padding-inline: 13px;
  }

  .home-header,
  .topbar {
    margin-inline: -13px;
    padding-inline: 13px;
  }

  .home-header {
    min-height: 66px;
  }

  .brand {
    gap: 8px;
    font-size: 15px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    font-size: 17px;
  }

  .sound-button {
    width: 34px;
    height: 34px;
  }

  .home-stage {
    grid-template-rows: minmax(300px, 1fr) auto;
    min-height: calc(100dvh - 66px);
    padding: 22px 0 30px;
  }

  .home-visual {
    min-height: 300px;
  }

  .home-shelf {
    width: min(75vw, 330px);
    padding: 14px;
    border-width: 11px;
  }

  .home-shelf::before {
    top: -17px;
    right: -16px;
    left: -16px;
    height: 9px;
  }

  .home-shelf::after {
    right: -15px;
    bottom: -19px;
    left: -15px;
    height: 10px;
  }

  .home-path {
    inset: 25px;
    width: calc(100% - 50px);
    height: calc(100% - 50px);
  }

  .home-bottle i {
    font-size: 14px;
  }

  .home-copy {
    margin-top: 14px;
  }

  .home-title-block h1 {
    font-size: 36px;
  }

  .home-actions {
    width: min(100%, 326px);
    margin-top: 19px;
  }

  .home-primary-button,
  .home-secondary-button {
    min-height: 48px;
    padding-inline: 12px;
  }

  .topbar {
    min-height: 64px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar .sound-button {
    width: 32px;
    height: 32px;
  }

  .time-readout {
    min-width: 64px;
    gap: 6px;
    font-size: 16px;
  }

  .time-dot {
    width: 8px;
    height: 8px;
  }

  .level-readout {
    padding-left: 8px;
    font-size: 13px;
  }

  .game-layout {
    padding-top: 10px;
  }

  .playfield {
    padding: 18px 0 34px;
  }

  .controls {
    margin: 0;
    padding-right: 13px;
    padding-left: 13px;
  }

  .control-actions {
    gap: 7px;
  }

  .control-actions button {
    min-height: 44px;
    padding-inline: 6px;
    font-size: 13px;
  }

  .dialog-backdrop {
    align-items: end;
    padding: 12px;
  }

  .level-dialog,
  .rules-dialog,
  .result-dialog,
  .confirm-dialog {
    width: 100%;
    max-height: calc(100dvh - 24px);
  }

  .level-dialog {
    padding: 20px;
  }

  .rules-dialog {
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  }

  .rule-row {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
    padding: 15px 0;
  }

  .rule-visual {
    width: 108px;
    height: 82px;
  }

  .rule-copy strong {
    font-size: 14px;
  }

  .rule-copy p {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.55;
  }

  .rule-mini-grid {
    grid-template-columns: repeat(3, 23px);
    grid-template-rows: repeat(2, 23px);
    gap: 8px 10px;
  }

  .rule-block {
    width: 37px;
    height: 37px;
  }

  .rule-color-visual {
    gap: 10px;
  }

  .rule-arrow {
    width: 16px;
  }

  .rule-time-visual {
    gap: 9px;
  }

  .rule-clock {
    font-size: 14px;
  }

  .rule-check {
    width: 31px;
    height: 31px;
  }

  .rule-check::after {
    top: 8px;
    left: 7px;
  }

  .level-list {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .result-dialog,
  .confirm-dialog {
    padding: 25px 20px calc(22px + env(safe-area-inset-bottom));
  }

  .result-dialog h1 {
    font-size: 26px;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .result-dialog .result-actions .confirm-button {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .result-actions button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .home-actions {
    grid-template-columns: 1fr;
  }

  .topbar .sound-button {
    width: 30px;
    height: 30px;
  }

  .time-readout {
    min-width: 58px;
    font-size: 15px;
  }

  .level-readout {
    padding-left: 5px;
    font-size: 12px;
  }

  .level-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
