:root {
  --bg: #f6f0e5;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-strong: #fffaf1;
  --text: #272421;
  --muted: #756c62;
  --accent: #6f8f41;
  --accent-dark: #567032;
  --border: rgba(39, 36, 33, 0.08);
  --shadow: 0 24px 80px rgba(62, 49, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Georgia", "Times New Roman", serif;
  background: radial-gradient(circle at top, #fffaf2 0%, var(--bg) 65%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
textarea {
  font: inherit;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

.screen-input,
.screen-finish,
.screen-checkin,
.screen-export {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.panel {
  width: min(100%, 760px);
  padding: 56px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.subtitle,
.finish-note,
.finish-intro,
.prep-copy,
.copy-feedback,
.timer-message,
.timer-note {
  color: var(--muted);
  line-height: 1.8;
}

.subtitle {
  margin: 18px 0 36px;
  font-size: 1.1rem;
}

.ritual-form {
  display: grid;
  gap: 14px;
}

.prep-block {
  margin-top: 10px;
  padding: 20px;
  border: 1px solid rgba(86, 112, 50, 0.15);
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.78);
}

.prep-title {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 1rem;
  font-weight: 700;
}

.prep-copy {
  margin: 0 0 14px;
  font-size: 0.98rem;
}

.ritual-form label,
.summary-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.timer-block {
  margin-top: 34px;
  padding: 24px;
  border: 1px solid rgba(86, 112, 50, 0.15);
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.82);
}

.timer-message {
  min-height: 3.6em;
  margin: 16px 0 0;
  font-size: 0.98rem;
}

.timer-note {
  margin: 10px 0 0;
  font-size: 0.94rem;
}

.frog-timer-panel {
  margin-top: 18px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(86, 112, 50, 0.15);
  background: rgba(255, 255, 255, 0.64);
}

.frog-timer-display {
  margin: 12px 0 18px;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  line-height: 1;
  color: var(--accent-dark);
  letter-spacing: 0.06em;
}

.frog-timer-panel.timer-complete {
  border-color: rgba(111, 143, 65, 0.5);
  background: rgba(111, 143, 65, 0.14);
  box-shadow: 0 0 0 5px rgba(111, 143, 65, 0.08);
}

.hidden-action {
  display: none;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.chip-button {
  border: 1px solid rgba(86, 112, 50, 0.18);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.chip-button:hover {
  transform: translateY(-1px);
}

.selected-chip {
  border-color: rgba(86, 112, 50, 0.55);
  background: rgba(111, 143, 65, 0.14);
  color: var(--accent-dark);
}

.ritual-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(86, 112, 50, 0.15);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  line-height: 1.7;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.ritual-form textarea:focus {
  outline: none;
  border-color: rgba(111, 143, 65, 0.55);
  box-shadow: 0 0 0 4px rgba(111, 143, 65, 0.14);
  transform: translateY(-1px);
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 16px 26px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  margin-top: 10px;
  background: var(--accent);
  color: #fffdf8;
}

.secondary-button {
  background: rgba(39, 36, 33, 0.08);
  color: var(--text);
}

.screen-ritual {
  position: relative;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0c0d0a;
}

.ritual-video,
.video-overlay,
.countdown-stage,
.begin-stage {
  position: absolute;
  inset: 0;
}

.ritual-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.08) 45%, rgba(0, 0, 0, 0.42) 100%),
    linear-gradient(to bottom, rgba(10, 11, 8, 0.1), rgba(10, 11, 8, 0.38));
}

.countdown-stage,
.begin-stage {
  display: grid;
  place-items: center;
  text-align: center;
  color: #fffdf4;
  overflow: visible;
}

.countdown-stage.hidden,
.begin-stage.hidden {
  display: none;
}

.countdown-number {
  position: relative;
  z-index: 2;
  font-size: clamp(7rem, 24vw, 18rem);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: 0.06em;
  padding: 0.08em 0.14em 0.14em;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.countdown-number.animate {
  animation: number-pop 800ms cubic-bezier(0.2, 0.8, 0.18, 1) both;
}

.pulse-ring {
  width: min(26vw, 280px);
  height: min(26vw, 280px);
  border-radius: 50%;
  border: 4px solid rgba(255, 253, 244, 0.72);
  opacity: 0;
}

.pulse-ring.animate {
  animation: ring-pulse 800ms ease-out both;
}

.begin-stage {
  z-index: 2;
  gap: 12px;
  padding: 24px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.44));
}

.begin-stage[aria-hidden="true"] {
  display: none;
}

.begin-title {
  margin: 0;
  font-size: clamp(3.6rem, 12vw, 8rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  animation: begin-rise 1500ms ease both;
}

.begin-subtitle,
.begin-task {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.4rem);
}

.begin-task {
  max-width: min(90vw, 720px);
  color: rgba(255, 253, 244, 0.88);
  line-height: 1.6;
}

.panel-finish {
  max-width: 720px;
}

.finish-intro {
  margin: 18px 0 10px;
  font-size: 1.02rem;
}

.summary-block {
  margin-top: 26px;
}

.summary-value {
  margin: 8px 0 0;
  font-size: 1.1rem;
  line-height: 1.8;
}

.finish-note {
  margin: 36px 0;
  font-size: 1.05rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.copy-feedback {
  min-height: 1.8em;
  margin: 16px 0 0;
  font-size: 0.95rem;
}

.markdown-output {
  margin: 24px 0 0;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(39, 36, 33, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  font-size: 0.97rem;
  max-height: 52vh;
  overflow: auto;
}

@keyframes number-pop {
  0% {
    opacity: 0;
    transform: scale(0.74) rotate(-4deg);
  }
  15% {
    opacity: 1;
    transform: scale(1.1) rotate(2deg) translateX(-4px);
  }
  32% {
    transform: scale(0.98) rotate(-1.4deg) translateX(4px);
  }
  54% {
    transform: scale(1.03) rotate(0.8deg) translateX(-2px);
  }
  78% {
    opacity: 1;
    transform: scale(1) rotate(0deg) translateX(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

@keyframes ring-pulse {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  18% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(2.8);
  }
}

@keyframes begin-rise {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  24% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .panel {
    padding: 28px 22px;
    border-radius: 24px;
  }

  .subtitle,
  .finish-note,
  .summary-value,
  .ritual-form textarea {
    font-size: 1rem;
  }

  .button-row {
    flex-direction: column;
  }
}
