/* ===== 후추의 이벤트 타이머 ===== */
/* 일반 뷰: 버터 모닝 토큰(라이트/다크 자동) · 디스플레이 모드: 전용 야간 팔레트 */

/* ---------- 히어로 (가장 가까운 이벤트) ---------- */
.timer-hero {
  background: var(--bm-hero-grad);
  border-radius: var(--r-hero);
  box-shadow: var(--sh-hero);
  padding: 26px 20px 22px;
  text-align: center;
  color: var(--bm-hero-ink);
  position: relative;
  overflow: hidden;
}
.timer-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--bm-noise);
  pointer-events: none;
}
.timer-hero > * { position: relative; z-index: 1; }

.timer-hero .th-delete {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  background: rgba(255, 253, 245, 0.4);
  border: none; border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 0.85rem; color: var(--bm-hero-ink);
  cursor: pointer; opacity: 0.55;
  transition: opacity var(--transition), background var(--transition);
}
.timer-hero .th-delete:hover { opacity: 1; background: rgba(255, 253, 245, 0.75); }

.timer-hero .th-emoji { font-size: 3rem; line-height: 1.1; }
.timer-hero .th-emoji img {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; border: 3px solid rgba(255, 255, 255, 0.6);
}
.timer-hero .th-name {
  font-size: 1.35rem; font-weight: 800; margin-top: 6px;
}
.timer-hero .th-name small {
  font-weight: 600; font-size: 0.85rem; opacity: 0.75; margin-left: 4px;
}
.timer-hero .th-date {
  font-size: 0.85rem; color: var(--bm-hero-sub); margin-top: 2px;
}

.th-countdown {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 16px;
  font-variant-numeric: tabular-nums;
}
.cd-block {
  background: rgba(255, 253, 245, 0.82);
  border-radius: var(--r-mini);
  box-shadow: var(--sh-card);
  min-width: 64px; padding: 10px 8px 8px;
}
[data-theme="dark"] .cd-block { background: rgba(35, 29, 16, 0.72); }
.cd-num {
  display: block;
  font-size: 1.9rem; font-weight: 800; line-height: 1.1;
  color: var(--ink);
}
.cd-label {
  display: block; font-size: 0.7rem; font-weight: 600;
  color: var(--text-sec); margin-top: 2px;
}
.th-dday {
  font-size: 2.4rem; font-weight: 800; margin-top: 14px;
  animation: dday-bounce 1.2s var(--bm-spring) infinite;
}
@keyframes dday-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.th-trivia {
  margin: 16px auto 0; max-width: 420px;
  background: var(--bm-chip-bg);
  border: 2px dashed var(--bm-dash);
  border-radius: var(--r-mini);
  padding: 10px 14px;
  font-size: 0.92rem; font-weight: 600; color: var(--ink);
  transition: opacity 0.4s ease;
}
.th-trivia.fade { opacity: 0; }

/* ---------- 디스플레이 모드 CTA ---------- */
.display-cta-wrap { margin-top: 14px; }
.display-cta {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 18px;
  background: var(--color-surface);
  border: 2px solid var(--bm-line);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  cursor: pointer; text-align: left;
  font-family: inherit; color: var(--ink);
  transition: transform var(--transition), box-shadow var(--transition);
}
.display-cta:hover { transform: translateY(-2px); box-shadow: var(--sh-strong); }
.display-cta-icon { font-size: 1.8rem; }
.display-cta-text { display: flex; flex-direction: column; gap: 2px; }
.display-cta-text strong { font-size: 1rem; }
.display-cta-text small { font-size: 0.78rem; color: var(--text-sec); }

/* ---------- 이벤트 목록 카드 ---------- */
.timer-list { display: flex; flex-direction: column; gap: 10px; }
.timer-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  background: var(--color-surface);
  border: 2px solid var(--bm-line);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  padding: 12px 14px;
}
.timer-card .tc-emoji { font-size: 1.7rem; flex-shrink: 0; }
.timer-card .tc-emoji img {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
}
.timer-card .tc-body { flex: 1; min-width: 0; }
.timer-card .tc-name {
  font-weight: 700; font-size: 0.95rem; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.timer-card .tc-name small {
  font-weight: 600; font-size: 0.75rem; opacity: 0.65; margin-left: 3px;
}
.timer-card .tc-count {
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 1.05rem; color: var(--bm-cta);
  margin-top: 2px;
}
.timer-card .tc-count.tc-dday { color: var(--red); }
.timer-card .tc-trivia {
  font-size: 0.76rem; color: var(--text-sec); margin-top: 3px;
  transition: opacity 0.4s ease;
}
.timer-card .tc-trivia.fade { opacity: 0; }
.timer-card .tc-delete {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 0.85rem; color: var(--muted); padding: 2px 4px;
}
.timer-card .tc-delete:hover { color: var(--red); }
.timer-empty {
  text-align: center; color: var(--text-sec); padding: 18px 0;
  font-size: 0.92rem;
}

/* ---------- 추가 폼 ---------- */
.timer-add-form {
  background: var(--color-surface);
  border: 2px solid var(--bm-line);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.timer-form-row { display: flex; gap: 8px; }
.timer-input {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  border: 2px solid var(--bm-line);
  border-radius: var(--r-small);
  background: var(--color-bg);
  color: var(--ink);
  font-family: inherit; font-size: 0.95rem;
}
.timer-input:focus { outline: none; border-color: var(--olive); }
.timer-input-emoji { flex: 0 0 64px; text-align: center; }
.timer-form-opts { align-items: center; justify-content: space-between; }
.timer-annual-label {
  font-size: 0.88rem; font-weight: 600; color: var(--text-sec);
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.timer-submit-btn {
  padding: 10px 22px;
  background: var(--olive);
  color: #fffdf5;
  border: none; border-radius: var(--r-pill);
  font-family: inherit; font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
  box-shadow: var(--sh-card);
  transition: transform var(--transition);
}
.timer-submit-btn:hover { transform: translateY(-2px); }
.timer-submit-btn:disabled { opacity: 0.5; transform: none; cursor: default; }
.timer-form-msg {
  font-size: 0.82rem; font-weight: 600; margin: 0; min-height: 1em;
  color: var(--olive-dark);
}
.timer-form-msg.err { color: var(--red); }

/* ---------- PC 레이아웃 (2컬럼) ---------- */
@media (min-width: 1024px) {
  .timer-layout {
    max-width: 1160px;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    align-items: start;
  }
  .timer-col-main { position: sticky; top: 16px; }
  .timer-hero { padding: 44px 32px 36px; }
  .timer-hero .th-emoji { font-size: 4.2rem; }
  .timer-hero .th-emoji img { width: 96px; height: 96px; }
  .timer-hero .th-name { font-size: 1.9rem; }
  .cd-block { min-width: 92px; padding: 14px 10px 12px; }
  .cd-num { font-size: 3rem; }
  .cd-label { font-size: 0.8rem; }
  .th-trivia { font-size: 1.05rem; }
}

/* ---------- 상시 디스플레이 모드 (전용 야간 팔레트) ---------- */
.dp-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at 50% 35%, #26200f 0%, #171307 62%, #0e0b04 100%);
  color: #ffeec2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
  cursor: none;
}
.dp-overlay[hidden] { display: none; }

.dp-exit {
  position: absolute; top: 18px; right: 22px; z-index: 3;
  background: rgba(255, 238, 194, 0.08);
  border: 1px solid rgba(255, 238, 194, 0.25);
  color: #ffeec2;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1rem; cursor: pointer;
  opacity: 0; transition: opacity 0.3s ease;
}
.dp-overlay:hover .dp-exit { opacity: 0.85; }

.dp-clock {
  position: absolute; top: 22px; left: 28px; z-index: 2;
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.9rem, 1.4vw, 1.3rem);
  font-weight: 600; color: rgba(255, 238, 194, 0.55);
  letter-spacing: 0.06em;
}

.dp-main {
  text-align: center;
  padding: 0 4vw;
  animation: dp-drift 120s ease-in-out infinite alternate;
  transition: opacity 0.6s ease;
}
.dp-main.switching { opacity: 0; }
@keyframes dp-drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(9px, -7px); }
  50%  { transform: translate(-8px, 6px); }
  75%  { transform: translate(6px, 9px); }
  100% { transform: translate(-9px, -5px); }
}

.dp-event-name {
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  font-weight: 800;
  color: #f6e7a8;
}
.dp-name-img, .dp-tk-img {
  height: 1em; width: 1em; border-radius: 50%;
  object-fit: cover; vertical-align: -0.12em;
}
.dp-event-name .dp-till {
  font-weight: 600; font-size: 0.6em;
  color: rgba(255, 238, 194, 0.6); margin-left: 8px;
}

.dp-countdown {
  margin-top: 2vh;
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 9vw, 9rem);
  font-weight: 800; line-height: 1.05;
  letter-spacing: -0.01em;
  color: #ffeec2;
  text-shadow: 0 0 60px rgba(246, 231, 168, 0.18);
  white-space: nowrap;
}
.dp-countdown .dp-unit {
  font-size: 0.32em; font-weight: 700;
  color: rgba(255, 238, 194, 0.55);
  margin: 0 1.5vw 0 0.4vw;
}
.dp-countdown .dp-dday {
  font-size: clamp(3rem, 10vw, 9rem);
  animation: dday-bounce 1.2s ease-in-out infinite;
  display: inline-block;
}

.dp-trivia {
  margin: 3.5vh auto 0;
  max-width: 72vw;
  font-size: clamp(1.05rem, 2.2vw, 2rem);
  font-weight: 600;
  color: #c9d3a0;
  transition: opacity 0.5s ease;
}
.dp-trivia.fade { opacity: 0; }
.dp-trivia::before { content: '🦎 '; }

.dp-ticker-wrap {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 2vh 0 2.4vh;
  border-top: 1px solid rgba(255, 238, 194, 0.12);
  background: rgba(14, 11, 4, 0.55);
  overflow: hidden;
  white-space: nowrap;
}
.dp-ticker {
  display: inline-block;
  font-size: clamp(0.9rem, 1.6vw, 1.35rem);
  font-weight: 600;
  color: rgba(255, 238, 194, 0.72);
  animation: dp-ticker-scroll 45s linear infinite;
  padding-left: 0;
}
.dp-ticker .dp-tk-item { margin-right: 3.2em; }
.dp-ticker .dp-tk-d { color: #c9a5d9; font-variant-numeric: tabular-nums; }
@keyframes dp-ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- 디스플레이 모드 — 세로(portrait) 화면 대응 ---------- */
/* 모니터 피벗·태블릿/폰 세로 거치 용: 일수를 윗줄로 쌓고 세로폭 기준으로 크게 */
@media (orientation: portrait) {
  .dp-countdown {
    white-space: normal;
    font-size: clamp(3rem, 17vw, 10rem);
    line-height: 1.0;
  }
  .dp-countdown .dp-days {
    display: block;
    font-size: 0.52em;
    color: #f6e7a8;
    margin-bottom: 0.12em;
  }
  .dp-countdown .dp-unit { margin: 0 0 0 0.4vw; }
  .dp-countdown .dp-dday { font-size: clamp(2.6rem, 13vw, 8rem); }
  .dp-event-name { font-size: clamp(1.5rem, 6.5vw, 3rem); }
  .dp-trivia {
    max-width: 88vw;
    font-size: clamp(1rem, 4.4vw, 1.8rem);
    margin-top: 4.5vh;
  }
  .dp-clock { font-size: clamp(0.85rem, 3vw, 1.1rem); }
  .dp-ticker { font-size: clamp(0.85rem, 3.4vw, 1.2rem); }
}

/* 디스플레이 모드 켜졌을 때 뒤 페이지 스크롤 잠금 */
body.dp-on { overflow: hidden; }
