:root {
  color-scheme: light;
  --bg: #f5f0e8;
  --ink: #171717;
  --muted: #69645c;
  --panel: #fffaf1;
  --line: #dfd3c1;
  --green: #12785f;
  --green-dark: #0d4f41;
  --orange: #e96f31;
  --button: #ff5a3c;
  --button-hover: #e7472f;
  --accent-soft: #ff8a72;
  --shadow: 0 24px 70px rgba(39, 29, 18, 0.16);
  --result-height: 148px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Pretendard,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 18%, rgba(233, 111, 49, 0.22), transparent 30%),
    linear-gradient(135deg, #f9f2e7 0%, var(--bg) 48%, #e8f1e6 100%);
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.app {
  width: min(100%, 520px);
  padding: 28px;
  border: 3px solid var(--accent-soft);
  border-radius: 40px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: var(--shadow);
}

.hero {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--button);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: 0;
}

.description {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.result-panel {
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 22px;
}

.counter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.counter strong {
  color: var(--ink);
  font-size: 12px;
}

.result {
  position: relative;
  height: var(--result-height);
  margin: 18px 0;
  padding: 0;
  border: 2px solid var(--accent-soft);
  border-radius: 20px;
  background: #ffffff;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.12rem, 5vw, 1.6rem);
  font-weight: 850;
  line-height: 1.45;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: pre-line;
}

.result-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.result-static,
.result-item {
  width: 100%;
  height: var(--result-height);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.result-static {
  position: absolute;
  inset: 0;
}

.result-reel {
  width: 100%;
  will-change: transform;
}

.result.is-rest {
  border-color: var(--accent-soft);
  color: var(--ink);
}

.result.is-workout {
  border-color: var(--accent-soft);
  color: var(--ink);
}

.result-button {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 20px;
  background: var(--button);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.share-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 2px solid var(--accent-soft);
  border-radius: 18px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.share-button:hover {
  border-color: var(--button);
  color: var(--button-hover);
  transform: translateY(-1px);
}

.share-button:active {
  transform: translateY(1px);
}

.share-button:focus-visible {
  outline: 3px solid rgba(233, 111, 49, 0.45);
  outline-offset: 3px;
}

.share-button[hidden] {
  display: none;
}

.result-button:hover {
  background: var(--button-hover);
  box-shadow: 0 12px 28px rgba(231, 71, 47, 0.24);
  transform: translateY(-1px);
}

.result-button:active {
  transform: translateY(1px);
}

.result-button:focus-visible {
  outline: 3px solid rgba(233, 111, 49, 0.55);
  outline-offset: 3px;
}

.result-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-top: 6px;
  padding: 0 10px 2px;
  font-size: 12px;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--button-hover);
  text-decoration: underline;
}

.content-page {
  line-height: 1.75;
}

.content-page h1 {
  margin-bottom: 18px;
}

.content-page h2 {
  margin: 28px 0 10px;
  font-size: 20px;
}

.content-page p,
.content-page li {
  color: var(--muted);
  font-size: 15px;
}

.content-page ul {
  padding-left: 20px;
}

.content-page a {
  color: var(--button-hover);
  font-weight: 700;
}

.article-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.article-link {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 2px solid rgba(255, 138, 114, 0.55);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  text-decoration: none;
}

.article-link strong {
  color: var(--ink);
  font-size: 16px;
}

.article-link span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.article-link:hover {
  border-color: var(--button);
  background: #ffffff;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--button-hover);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.confetti-piece {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: var(--confetti-color);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: fanfare 820ms ease-out forwards;
}

@keyframes fanfare {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.8) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translate(
        calc(-50% + var(--confetti-x)),
        calc(-50% + var(--confetti-y))
      )
      scale(1.05)
      rotate(var(--confetti-rotation));
  }
}

@media (max-width: 420px) {
  body {
    align-items: start;
    padding-top: 44px;
  }

  .result-panel {
    padding: 18px;
  }

  .app {
    padding: 20px;
  }

  .site-footer {
    margin-top: 4px;
  }

  .result {
    --result-height: 136px;
  }

  .result-static,
  .result-item {
    padding: 16px;
  }
}
