:root {
  color-scheme: light dark;

  /* 밝은 겨울 하늘 느낌 */
  --bg-color: #f5f7ff;
  --bg-gradient-1: #f9fbff;
  --bg-gradient-2: #dbeafe;
  --bg-gradient-3: #60a5fa;

  --accent: #f97316;
  --accent-strong: #ec4899;
  --accent-soft: #fed7aa;

  --text-main: #0f172a;
  --text-sub: #4b5563;

  --shadow-soft: 0 20px 60px rgba(148, 163, 184, 0.35);
  --radius-lg: 1.75rem;

  --transition-fast: 180ms ease-out;
  --transition-med: 260ms ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;

  background: radial-gradient(circle at top, rgba(96, 165, 250, 0.75), transparent
        80%) fixed,
    radial-gradient(circle at bottom, rgba(219, 234, 254, 0.95), transparent 65%)
      fixed,
    radial-gradient(circle at center, var(--bg-gradient-1), #eef2ff) fixed;

  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(
      circle at 15% 20%,
      rgba(191, 219, 254, 0.8) 0,
      transparent 40%
    ),
    radial-gradient(
      circle at 85% 0%,
      rgba(165, 180, 252, 0.7) 0,
      transparent 40%
    ),
    radial-gradient(
      circle at 0% 100%,
      rgba(96, 165, 250, 0.4) 0,
      transparent 45%
    );
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

/* Main layout */
.page {
  position: relative;
  z-index: 3;
  width: min(960px, 100%);
  padding: 2.4rem 1.8rem 2.7rem;
  background: transparent;
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: none;
}

/* Header */
.site-header {
  text-align: center;
  margin-bottom: 2.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(254, 226, 226, 0.9),
    rgba(254, 249, 195, 0.9)
  );
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: #9f1239;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.site-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.85rem, 3.3vw, 2.5rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-main);
}

.subtitle {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-sub);
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
}

.subtitle span {
  opacity: 0.9;
}

.subtitle-note {
  font-size: 0.86rem;
  opacity: 0.8;
}

/* Countdown section */
.countdown-wrapper {
  text-align: center;
}

.tagline {
  margin: 0 0 1.4rem;
  font-size: 0.98rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1d4ed8;
}

.countdown-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.7rem, 2.4vw, 1.3rem);
  flex-wrap: nowrap;
}

.countdown-row.no-days [data-unit="days"],
.countdown-row.no-days [data-separator-for="days"] {
  display: none;
}

/* Time segments */
.time-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(3.9rem, 15vw, 6rem);
}

.time-box {
  position: relative;
  padding: 1.05rem 0.6rem;
  border-radius: 1.2rem;

  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 14px 30px rgba(148, 163, 184, 0.35);
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform var(--transition-med), box-shadow var(--transition-med),
    border-color var(--transition-med);
}

.time-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: clamp(2.3rem, 7.8vw, 4.1rem);
  color: var(--text-main);
  transform-origin: center;
}

.time-value .digit {
  display: inline-block;
}

.tick-animate {
  animation: valueTick 420ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes valueTick {
  0% {
    transform: translateY(0.6em) scale(1.08);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.time-label {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(75, 85, 99, 0.95);
}

.separator {
  align-self: center;
  font-size: clamp(2rem, 5.5vw, 3rem);
  transform: translateY(0.12rem);
  color: rgba(107, 114, 128, 0.9);
}

/* === 60초 남았을 때: 원형 60초 시계 === */

.ring-clock {
  margin-top: 1.6rem;
  display: none;
}

body.final-minute .ring-clock {
  display: block;
}

body.final-minute .countdown-row {
  display: none;
}

.ring-clock-face {
  position: relative;
  width: min(345px, 82vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  padding: 0.5rem;

  background: radial-gradient(
    circle at top,
    rgba(255, 255, 255, 0.9),
    rgba(229, 237, 255, 0.78)
  );
  border: 1px solid rgba(148, 163, 184, 0.4);

  box-shadow: 0 18px 40px rgba(148, 163, 184, 0.55),
    0 0 55px rgba(248, 181, 83, 0.32);

  overflow: hidden;
}

.clock-mark {
  position: absolute;
  font-size: 1rem;
  color: #374151;
  letter-spacing: 0.08em;
  transform: translate(-50%, -50%);
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 600;
}

.clock-mark::selection {
  background: transparent;
}

.clock-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2px;
  height: 47%;
  background: #f97316;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(0deg);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.8);
}

.clock-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.8rem 1.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(248, 181, 83, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  box-shadow: 0 12px 30px rgba(148, 163, 184, 0.65);
}

.clock-center-label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(75, 85, 99, 0.9);
}

.clock-center-value {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: clamp(2.1rem, 6.8vw, 2.8rem);
  letter-spacing: 0.08em;
  color: #b91c1c;
}

/* Final minute effects */
body.final-minute .clock-center {
  box-shadow: 0 0 22px rgba(248, 181, 83, 0.6),
    0 12px 24px rgba(148, 163, 184, 0.7);
  animation: secondsPulse 1.1s ease-in-out infinite;
}

body.last-ten .clock-center {
  animation-duration: 0.8s;
  box-shadow: 0 0 30px rgba(248, 181, 83, 0.75),
    0 0 70px rgba(248, 113, 113, 0.5);
}

@keyframes secondsPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
  }
}

body.last-ten .clock-center-value {
  animation: lastTenNumberFlash 0.8s ease-in-out infinite;
  color: #dc2626;
  text-shadow: 0 0 14px rgba(248, 181, 83, 0.95),
    0 0 30px rgba(248, 113, 113, 0.75);
}

@keyframes lastTenNumberFlash {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.12);
    opacity: 0.9;
  }
}

/* New year state */
.new-year-message {
  margin-top: 0.4rem;
  opacity: 0;
  transform: translateY(14px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 420ms ease-out, transform 420ms ease-out;
}

.new-year-message h2 {
  margin: 0.4rem 0 0.6rem;
  font-size: clamp(1.9rem, 3.3vw, 2.4rem);
  color: #111827;
}

.new-year-message .nyey {
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #2563eb;
}

.new-year-message .ny-sub {
  margin: 0;
  font-size: 1rem;
  color: var(--text-sub);
  line-height: 1.7;
}

.countdown-wrapper.finished .countdown-grid {
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 360ms ease-out, transform 360ms ease-out;
}

.countdown-wrapper.finished .new-year-message {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.countdown-wrapper.finished.show-zero .countdown-grid {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: none;
}

.countdown-wrapper.finished.show-zero .time-box {
  box-shadow: 0 14px 200px rgba(148, 163, 184, 0.35);
}

/* Typing */
.typing-wrapper {
  margin-top: 1.8rem;
  min-height: 1.6em;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-sub);
  font-size: 0.96rem;
}

.typing-text {
  position: relative;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #1d4ed8;
  white-space: nowrap;
}

.typing-hash {
  margin-right: -0.3em;
}

.typing-text::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1.1em;
  background: currentColor;
  vertical-align: -0.12em;
  animation: typing-cursor 0.8s steps(1, end) infinite;
}

@keyframes typing-cursor {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

/* Fireworks canvas */
#fireworks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 500ms ease-out;
}

#fireworks.active {
  opacity: 1;
}

/* Snow canvas */
#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 2;
  opacity: 1;
  transition: opacity 600ms ease-out;
}

/* New year theme */
body.new-year {
  --text-main: #e5e7eb;
  --text-sub: #cbd5f5;

  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), transparent
        80%) fixed,
    radial-gradient(circle at bottom, rgba(30, 64, 175, 0.85), transparent 65%)
      fixed,
    radial-gradient(circle at center, #020617, #020617) fixed;
}

body.new-year::before {
  opacity: 0;
}

body.new-year #snow-canvas {
  opacity: 0;
}

body.new-year .new-year-message h2 {
  color: #f9fafb;
}

body.new-year .new-year-message .ny-sub {
  color: #e5e7eb;
}

/* Year overlay */
.year-counter-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 600ms ease-out, transform 800ms ease-out;
}

.year-counter-overlay.active {
  opacity: 1;
  transform: scale(1);
}

.year-counter-number {
  font-size: clamp(4.6rem, 13vw, 7.2rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #f9fafb;
  text-shadow: 0 0 10px rgba(248, 250, 252, 0.4);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #snow-canvas,
  #fireworks {
    display: none !important;
  }

  .tick-animate {
    animation: none !important;
  }

  body.final-minute .countdown-row {
    display: flex;
  }

  body.final-minute .ring-clock {
    display: none;
  }

  .typing-text::after {
    animation: none;
    opacity: 0;
  }

  body.final-minute .clock-center,
  body.last-ten .clock-center-value {
    animation: none !important;
  }

  .year-counter-overlay {
    transition: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .page {
    padding: 1.9rem 1.2rem 2.2rem;
    border-radius: 1.4rem;
  }

  .time-box {
    padding-inline: 0.5rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.9rem;
  }

  .page {
    padding-inline: 1rem;
  }

  .countdown-row {
    gap: 0.4rem;
  }

  .time-segment {
    min-width: 0;
  }

  .time-box {
    padding: 0.6rem 0.35rem;
  }

  .time-label {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }

  .time-value {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
    letter-spacing: 0.06em;
  }

  .separator {
    font-size: 1.8rem;
  }
}
