:root {
  color-scheme: light;
  --bg-top: #FFFFFF;
  --bg-bottom: #FAF7F2;
  --aura: rgba(255, 214, 150, 0.28);
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(29, 34, 40, 0.065);
  --ink-1: #1D2228;
  --ink-2: #606872;
  --ink-3: #969FA8;
  --amber-1: #FFB424;
  --amber-2: #FF7A18;
  --amber-deep: #E56500;
  --ice-bg: #E8F6FF;
  --ice-bg-2: #D6EEFF;
  --ice-ink: #0284C7;
  --pill-track: rgba(29, 34, 40, 0.065);
  --ring-track: rgba(29, 34, 40, 0.09);
  --pill-dark: #1D2228;
  --pill-dark-ink: #FFFFFF;
  --sheet-bg: #FFFFFF;
  --sheet-sec: #F7F6F3;
  --shadow-soft: 0 10px 28px rgba(24, 30, 38, 0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg-top: #141619;
    --bg-bottom: #111215;
    --aura: rgba(255, 160, 48, 0.14);
    --card-bg: rgba(28, 30, 34, 0.92);
    --card-border: rgba(255, 255, 255, 0.08);
    --ink-1: #F2F3F5;
    --ink-2: #A6ADB6;
    --ink-3: #767E88;
    --ice-bg: rgba(14, 165, 233, 0.16);
    --ice-bg-2: rgba(14, 165, 233, 0.24);
    --ice-ink: #38BDF8;
    --pill-track: rgba(255, 255, 255, 0.08);
    --ring-track: rgba(255, 255, 255, 0.11);
    --pill-dark: #2A2E35;
    --pill-dark-ink: #FFFFFF;
    --sheet-bg: #1C1E22;
    --sheet-sec: #25282E;
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-top: #141619;
  --bg-bottom: #111215;
  --aura: rgba(255, 160, 48, 0.14);
  --card-bg: rgba(28, 30, 34, 0.92);
  --card-border: rgba(255, 255, 255, 0.08);
  --ink-1: #F2F3F5;
  --ink-2: #A6ADB6;
  --ink-3: #767E88;
  --ice-bg: rgba(14, 165, 233, 0.16);
  --ice-bg-2: rgba(14, 165, 233, 0.24);
  --ice-ink: #38BDF8;
  --pill-track: rgba(255, 255, 255, 0.08);
  --ring-track: rgba(255, 255, 255, 0.11);
  --pill-dark: #2A2E35;
  --pill-dark-ink: #FFFFFF;
  --sheet-bg: #1C1E22;
  --sheet-sec: #25282E;
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--ink-1);
  background: var(--bg-bottom);
  user-select: none;
}

button, input { font: inherit; color: inherit; }

/* Full-bleed edge-to-edge Protocol 2 App Container */
.app {
  --safe-top: max(env(safe-area-inset-top, 0px), var(--xb-safe-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--xb-safe-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--xb-safe-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--xb-safe-left, 0px));
  --capsule-clear: max(56px, calc(var(--xb-capsule-width, 48px) + var(--xb-capsule-right, 4px) + 8px));

  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(380px 300px at 50% 24%, var(--aura), transparent 72%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  overflow: hidden;
}

/* Protocol 2 Navigation Bar (symmetrically clears right 48×48dp host menu) */
.nav-bar {
  position: relative;
  z-index: 15;
  flex-shrink: 0;
  padding-top: var(--safe-top);
  height: calc(var(--safe-top) + 48px);
  padding-left: max(calc(var(--safe-left) + 56px), var(--capsule-clear));
  padding-right: max(calc(var(--safe-right) + 56px), var(--capsule-clear));
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-back {
  position: absolute;
  left: calc(var(--safe-left) + 4px);
  top: var(--safe-top);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-1);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.nav-back:active { background: var(--pill-track); }

.nav-voice {
  position: absolute;
  left: calc(var(--safe-left) + 16px);
  top: calc(var(--safe-top) + 9px);
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.nav-voice.shifted { left: calc(var(--safe-left) + 52px); }
.nav-voice.on {
  color: var(--amber-deep);
  border-color: rgba(255, 122, 24, 0.28);
  background: rgba(255, 245, 232, 0.9);
}

:root[data-theme="dark"] .nav-voice.on {
  background: rgba(255, 122, 24, 0.16);
  color: #FFB424;
}

.nav-title {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Voice Broadcast Toast */
.voice-toast {
  position: absolute;
  top: calc(var(--safe-top) + 54px);
  left: 50%;
  transform: translate(-50%, -10px) scale(0.96);
  width: min(calc(100% - 32px), 380px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(29, 34, 40, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #FFFFFF;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 10px 26px rgba(20, 24, 30, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.voice-toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.voice-bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 14px;
  flex-shrink: 0;
}

.voice-bars i {
  display: block;
  width: 2.5px;
  height: 6px;
  border-radius: 2px;
  background: #FFB424;
  animation: vBar 0.7s ease-in-out infinite;
}

.voice-bars i:nth-child(2) { animation-delay: 0.15s; height: 12px; }
.voice-bars i:nth-child(3) { animation-delay: 0.30s; height: 8px; }

@keyframes vBar {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.25); }
}

/* One style choice follows the egg through all three screens. */
.egg-style-picker {
  align-self: center;
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  margin: 3px 0 2px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--pill-track);
}
.egg-style-picker label { position: relative; cursor: pointer; }
.egg-style-picker input {
  position: absolute;
  inset: -6.5px 0;
  width: 100%;
  height: calc(100% + 13px);
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.egg-style-picker span {
  display: block;
  min-width: 65px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}
.egg-style-picker input:checked + span {
  color: var(--ink-1);
  background: var(--sheet-bg);
  box-shadow: 0 1px 4px rgba(35, 27, 19, 0.14);
}
.egg-style-picker input:focus-visible + span {
  outline: 2px solid var(--amber-deep);
  outline-offset: 1px;
}

/* Main Stage */
.stage {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  padding: 4px calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 18px) calc(var(--safe-left) + 20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Screen 1: Setup */
.egg-stage {
  position: relative;
  flex: 1;
  min-height: 218px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0 10px;
}

.egg-ambient-glow {
  position: absolute;
  width: 204px;
  height: 204px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 174, 38, 0.28) 0%, rgba(255, 174, 38, 0) 72%);
  filter: blur(10px);
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.egg-canvas-wrap {
  position: relative;
  width: clamp(184px, 52vw, 230px);
  aspect-ratio: 420 / 408;
  display: grid;
  place-items: center;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.egg-canvas-wrap[data-egg-style="cartoon"] { width: clamp(176px, 46vw, 214px); }
.egg-canvas-wrap.wobble { transform: scale(1.028) rotate(-1.1deg); }

.egg-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.egg-model {
  cursor: grab;
  touch-action: pan-y;
  filter: drop-shadow(2px 5px 4px rgba(89, 61, 37, 0.16));
}
.egg-model:active { cursor: grabbing; }
.egg-model:focus-visible, .egg-shell-toggle:focus-visible {
  outline: 2px solid var(--amber-deep);
  outline-offset: 2px;
}

.egg-view-tools {
  position: absolute;
  inset: auto -12px 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-2);
  font-size: 11px;
  pointer-events: none;
}
.egg-shell-toggle {
  position: relative;
  pointer-events: auto;
  padding: 7px 11px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.egg-shell-toggle::before { content: ''; position: absolute; inset: -7px -2px; }

.time-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--pill-dark);
  color: var(--pill-dark-ink);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 20px rgba(29, 34, 40, 0.16);
}

.time-pill small {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.72;
}

.doneness-caption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.doneness-tag {
  font-weight: 600;
  color: var(--amber-deep);
}

/* Cards & Controls Dock */
.controls-dock {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.slider-card { padding: 15px 16px 13px; }

.ruler-ticks {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 14px;
  padding: 0 8px;
  margin-bottom: 6px;
}

.ruler-tick {
  width: 1.5px;
  height: 6px;
  border-radius: 2px;
  background: rgba(120, 128, 138, 0.26);
  transition: background 0.16s ease;
}

.ruler-tick.major { height: 12px; width: 2px; background: rgba(120, 128, 138, 0.48); }
.ruler-tick.passed { background: rgba(255, 132, 20, 0.72); }

.slider-track-wrap {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 2px;
}

.slider-bg {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 8px;
  border-radius: 999px;
  background: var(--pill-track);
  overflow: hidden;
}

.slider-fill {
  height: 100%;
  width: 54%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF7A18 0%, #FFB424 65%, #FFE07A 100%);
}

input[type="range"].egg-slider {
  position: relative;
  z-index: 4;
  width: 100%;
  height: 30px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: grab;
  outline: none;
}

input[type="range"].egg-slider:active { cursor: grabbing; }

input[type="range"].egg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #FFF7EA 60%, #F2D8AE 100%);
  border: 2.5px solid #FF8A18;
  box-shadow: 0 4px 12px rgba(255, 122, 24, 0.34), 0 0 0 4px rgba(255, 180, 36, 0.18);
}

.slider-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 6px;
  text-align: center;
}

.slider-label-btn {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.18s ease;
}

.slider-label-btn.active { color: var(--ink-1); font-weight: 600; }

/* Parameters Card */
.params-card {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.param-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

.seg-control {
  position: relative;
  display: grid;
  background: var(--pill-track);
  border-radius: 999px;
  padding: 3px;
  width: 184px;
}

.seg-control.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg-control.cols-2 { grid-template-columns: repeat(2, 1fr); }

.seg-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  border-radius: 999px;
  background: var(--sheet-bg);
  box-shadow: 0 2px 8px rgba(24, 30, 38, 0.10);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.seg-control.cols-3 .seg-indicator { width: calc((100% - 6px) / 3); }
.seg-control.cols-2 .seg-indicator { width: calc((100% - 6px) / 2); }

.seg-btn {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 7px 0;
  border-radius: 999px;
  cursor: pointer;
}

.seg-btn.active { color: var(--ink-1); font-weight: 600; }

/* Primary CTA */
.cta-primary {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #FFAE1E 0%, #FF7A18 100%);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(255, 122, 24, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.14s ease, filter 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cta-primary:active { transform: scale(0.98); }
.cta-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.25);
  box-shadow: none;
}

/* Screen 2: Boiling Timer */
.timer-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-readout-top { text-align: center; margin-bottom: 12px; }

.chrono-digits {
  font-size: 42px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink-1);
  line-height: 1.05;
}

.timer-sub {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.chrono-wrap {
  position: relative;
  width: clamp(224px, 60vw, 252px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.chrono-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.chrono-inner {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
}

.timer-egg-stage {
  position: relative;
  width: 152px;
  height: 148px;
  display: grid;
  place-items: center;
}

.timer-egg-canvas {
  width: 148px;
  height: 144px;
  position: relative;
  z-index: 2;
}

.simmer-glow {
  position: absolute;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 180, 36, 0.24) 0%, rgba(255, 180, 36, 0) 72%);
  animation: simmerPulse 2.4s ease-in-out infinite;
  pointer-events: none;
}

.paused .simmer-glow,
.paused .bubble { animation-play-state: paused !important; }

@keyframes simmerPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 1; }
}

.timer-bubbles { position: absolute; inset: 0; pointer-events: none; }

.bubble { animation: riseBubble 1.8s ease-in infinite; opacity: 0; }
.bubble.b2 { animation-delay: 0.55s; animation-duration: 1.5s; }
.bubble.b3 { animation-delay: 1.1s; animation-duration: 2.0s; }
.bubble.b4 { animation-delay: 0.25s; animation-duration: 1.65s; }

@keyframes riseBubble {
  0% { transform: translateY(10px) scale(0.6); opacity: 0; }
  30% { opacity: 0.85; }
  100% { transform: translateY(-22px) scale(1.1); opacity: 0; }
}

.live-stage-pill {
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.live-stage-pill strong { color: var(--amber-deep); font-weight: 600; }

.stepper {
  width: 100%;
  padding: 0 18px;
  margin: 18px 0 8px;
}

.stepper-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.stepper-line {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: 2px;
  background: var(--ring-track);
  transform: translateY(-50%);
  z-index: 1;
}

.stepper-line-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FFB424, #FF7A18);
  transition: width 0.25s linear;
}

.step-dot {
  position: relative;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-bottom);
  border: 2px solid var(--ring-track);
}

.step-dot.done { background: #FF8A18; border-color: #FF8A18; }
.step-dot.active {
  background: #FFFFFF;
  border: 3px solid #FF8A18;
  box-shadow: 0 0 0 5px rgba(255, 138, 24, 0.20);
}

.stepper-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
}

.stepper-labels span.active { color: var(--ink-1); font-weight: 600; }

.timer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-soft {
  height: 50px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--ink-1);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-soft);
}

.btn-soft.warm {
  background: linear-gradient(180deg, #FFF5E6 0%, #FFE6C4 100%);
  border-color: rgba(255, 122, 24, 0.28);
  color: #B44E00;
}

:root[data-theme="dark"] .btn-soft.warm {
  background: rgba(255, 122, 24, 0.18);
  color: #FFB424;
}

/* Screen 3: Done */
.done-hero {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.done-glow { opacity: 0.9; }
.done-egg-wrap { width: 196px; aspect-ratio: 420 / 408; display: grid; place-items: center; }

.sparkle {
  position: absolute;
  color: #FFB424;
  animation: twinkle 2.4s ease-in-out infinite;
  pointer-events: none;
}

.sparkle.s1 { top: 24px; left: 48px; }
.sparkle.s2 { top: 48px; right: 48px; animation-delay: 0.7s; }
.sparkle.s3 { bottom: 84px; left: 42px; animation-delay: 1.3s; }

@keyframes twinkle {
  0%, 100% { transform: scale(0.8) rotate(0deg); opacity: 0.4; }
  50% { transform: scale(1.18) rotate(18deg); opacity: 1; }
}

.done-badge {
  margin-top: 6px;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--pill-dark);
  color: var(--pill-dark-ink);
  font-size: 13.5px;
  font-weight: 600;
}

.done-sub { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); text-align: center; }

.tip-card {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tip-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--ice-bg), var(--ice-bg-2));
  color: var(--ice-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tip-text { flex: 1; font-size: 12.5px; line-height: 1.5; color: var(--ink-1); }

.ice-btn {
  border: none;
  background: var(--ice-bg);
  color: var(--ice-ink);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.text-link-btn {
  width: 100%;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--amber-deep);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Bottom Sheet (V2 Spec: 20px top radius, 36×4 grabber, safe-bottom) */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(18, 18, 23, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-panel {
  width: 100%;
  max-width: 440px;
  max-height: 80dvh;
  overflow-y: auto;
  background: var(--sheet-bg);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(var(--safe-bottom) + 18px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  animation: sheetIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-grabber {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--ring-track);
  margin: 0 auto 12px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-head h2 { font-size: 16px; font-weight: 600; color: var(--ink-1); }

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--pill-track);
  color: var(--ink-2);
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sheet-section {
  background: var(--sheet-sec);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 4px 12px;
  margin-bottom: 11px;
  transition: opacity 0.2s ease;
}

.sheet-section.muted { opacity: 0.45; pointer-events: none; }

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--card-border);
  font-size: 13.5px;
  color: var(--ink-1);
  gap: 12px;
}

.sheet-row:last-child { border-bottom: none; }
.sheet-row small { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.ios-switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: var(--ring-track);
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.ios-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.ios-switch.on { background: #FF8A18; }
.ios-switch.on::after { transform: translateX(18px); }

.sheet-seg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  gap: 10px;
  font-size: 13.5px;
  border-bottom: 0.5px solid var(--card-border);
}

.sheet-seg-row:last-child { border-bottom: none; }

.sheet-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--pill-track);
  padding: 2.5px;
  border-radius: 999px;
  width: 196px;
}

.sheet-seg button {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 6px 0;
  border-radius: 999px;
  cursor: pointer;
}

.sheet-seg button.active {
  background: var(--sheet-bg);
  color: var(--ink-1);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(24, 30, 38, 0.10);
}

.sheet-select {
  width: 196px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--sheet-bg);
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.sheet-test-btn {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 122, 24, 0.28);
  background: linear-gradient(180deg, #FFF7EC 0%, #FFEBD4 100%);
  color: var(--amber-deep);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

:root[data-theme="dark"] .sheet-test-btn {
  background: rgba(255, 122, 24, 0.16);
  color: #FFB424;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
