:root {
  color-scheme: light;
  font-family: 'SF Pro Rounded', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --bg-top: #dbe6ff;
  --bg-bottom: #edf3ff;
  --card: rgba(255, 255, 255, 0.96);
  --text: #16304d;
  --muted: #61748d;
  --primary: #2c63ff;
  --primary-strong: #1949d7;
  --recording: #ff6f61;
  --success: #26a269;
  --shadow: 0 18px 48px rgba(44, 99, 255, 0.18);
  --soft-shadow: 0 8px 24px rgba(22, 48, 77, 0.08);
  --radius: 28px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, var(--bg-top) 0%, transparent 48%),
    linear-gradient(180deg, #f6f8ff 0%, var(--bg-bottom) 100%);
  color: var(--text);
}

body {
  overscroll-behavior: none;
}

button,
input,
textarea {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  height: 100dvh;
  display: grid;
  place-items: stretch;
}

.hero-card {
  position: relative;
  width: min(100vw, 540px);
  margin: 0 auto;
  height: 100dvh;
  padding:
    max(20px, env(safe-area-inset-top))
    18px
    calc(18px + env(safe-area-inset-bottom))
    18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  text-align: center;
  display: grid;
  gap: 8px;
  align-content: start;
}

.eyebrow {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
  font-weight: 800;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.08;
}

.subtitle,
.status-text,
.encouragement-text,
.ring-caption {
  color: var(--muted);
  line-height: 1.45;
}

.main-stage {
  min-height: 0;
  display: grid;
}

.timer-panel,
.result-panel {
  min-height: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  padding: 12px 6px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(44, 99, 255, 0.08), rgba(44, 99, 255, 0.03));
}

.timer-panel.is-recording {
  background: linear-gradient(180deg, rgba(255, 111, 97, 0.16), rgba(255, 111, 97, 0.05));
}

.timer-panel.is-active,
.timer-panel.is-interpreting {
  background: linear-gradient(180deg, rgba(38, 162, 105, 0.16), rgba(38, 162, 105, 0.05));
}

.task-label {
  font-size: 1.08rem;
  font-weight: 800;
}

.ring-shell {
  position: relative;
  width: min(64vw, 320px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.countdown-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-ring__track,
.countdown-ring__progress {
  fill: none;
  stroke-width: 16;
}

.countdown-ring__track {
  stroke: rgba(44, 99, 255, 0.12);
}

.countdown-ring__progress {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 250ms linear, stroke 220ms ease;
}

.timer-panel.is-recording .countdown-ring__progress {
  stroke: var(--recording);
}

.timer-panel.is-active .countdown-ring__progress,
.timer-panel.is-interpreting .countdown-ring__progress {
  stroke: var(--success);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
}

.countdown {
  font-size: clamp(3.5rem, 14vw, 5.6rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.ring-caption {
  font-size: 0.95rem;
  font-weight: 700;
}

.status-text {
  max-width: 24rem;
  min-height: 2.9em;
  display: grid;
  align-items: center;
}

.result-panel {
  align-content: stretch;
  padding-inline: 14px;
}

.result-buttons {
  display: grid;
  width: 100%;
  gap: 10px;
}

.result-button,
.permission-button {
  width: 100%;
  border: none;
  border-radius: 22px;
  background: white;
  color: var(--text);
  box-shadow: var(--soft-shadow);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 16px 18px;
  min-height: 66px;
}

.result-button:active,
.permission-button:active,
.talk-button:active {
  transform: scale(0.985);
}

.action-dock {
  padding-top: 6px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.talk-button {
  width: 100%;
  min-height: 116px;
  border: none;
  border-radius: 32px;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: white;
  font-size: 1.42rem;
  font-weight: 900;
  box-shadow: 0 18px 36px rgba(44, 99, 255, 0.28);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.talk-button.is-recording {
  background: linear-gradient(180deg, #ff9488, var(--recording));
  box-shadow: 0 18px 36px rgba(255, 111, 97, 0.28);
}

.talk-button[disabled] {
  opacity: 0.55;
}

.permission-gate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(244, 247, 255, 0.82);
  backdrop-filter: blur(18px);
}

.permission-gate[hidden],
.timer-panel[hidden],
.result-panel[hidden] {
  display: none;
}

.permission-gate__card {
  width: 100%;
  border-radius: 26px;
  background: white;
  padding: 24px 20px;
  display: grid;
  gap: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.permission-button {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: white;
  min-height: 74px;
}

@media (min-width: 700px) {
  .hero-card {
    margin: 18px auto;
    height: calc(100dvh - 36px);
    border-radius: 34px;
  }
}

@media (max-height: 760px) {
  .hero-card {
    gap: 10px;
  }

  .ring-shell {
    width: min(58vw, 250px);
  }

  .talk-button {
    min-height: 100px;
  }
}
