:root {
  color-scheme: light;
  font-family: "Inter", "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #4a211f;
  --muted: #927a6c;
  --wine: #850e1b;
  --wine-dark: #690b16;
  --gold: #c6924b;
  --paper: #fbf2e8;
  --line: rgba(111, 51, 38, .16);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 39%, rgba(255, 255, 255, .9), transparent 48%),
    radial-gradient(ellipse at 8% 12%, rgba(231, 184, 133, .25), transparent 34%),
    radial-gradient(ellipse at 92% 82%, rgba(202, 139, 93, .17), transparent 36%),
    var(--paper);
}

body.is-celebrating { overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.page {
  position: relative;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  padding: 28px clamp(22px, 6vw, 88px) 24px;
}

.page::before, .page::after {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  content: "";
}

.page::before {
  inset: 13px;
  border: 1px solid rgba(157, 105, 65, .13);
  border-radius: 3px;
}

.page::after {
  top: -210px;
  left: 50%;
  width: min(1000px, 90vw);
  height: 400px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(255, 255, 255, .64), transparent 70%);
}

.topbar, .footer, .footer-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .14em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(133, 14, 27, .4);
  border-radius: 50%;
  color: var(--wine);
  font-size: 15px;
}

.top-note, .footer-note {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .18em;
}

main {
  display: flex;
  width: min(100%, 1000px);
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 38px 0 42px;
  text-align: center;
}

.hero-ornament {
  display: flex;
  width: 126px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 21px;
  color: var(--gold);
  font-size: 12px;
}

.hero-ornament i {
  width: 72px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(177, 125, 62, .7), transparent);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: #9a6842;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .24em;
}

.eyebrow::before, .eyebrow::after {
  width: 22px;
  height: 1px;
  background: rgba(154, 104, 66, .48);
  content: "";
}

h1 {
  margin: 0;
  color: #552b25;
  font-size: clamp(44px, 7.1vw, 84px);
  font-weight: 450;
  letter-spacing: .02em;
  line-height: 1.12;
}

h1 span { display: block; }

.headline-accent {
  margin-top: 4px;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: .92em;
  font-style: italic;
  font-weight: 500;
  letter-spacing: .04em;
}

.intro {
  margin: 18px 0 0;
  color: #816c60;
  font-size: 14px;
  letter-spacing: .1em;
  line-height: 1.9;
  white-space: pre-line;
}

.countdown {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(5px, 1.4vw, 16px);
  margin-top: clamp(42px, 6.5vh, 68px);
}

.unit {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.unit-label {
  color: #74121d;
  font-size: clamp(9px, 1.1vw, 13px);
  font-weight: 750;
  letter-spacing: .09em;
  line-height: 1;
}

.unit-label i {
  margin-left: 3px;
  color: #a47d61;
  font-size: .82em;
  font-style: normal;
  font-weight: 500;
  letter-spacing: .04em;
}

.number {
  display: flex;
  align-items: center;
  gap: clamp(3px, .5vw, 6px);
  font-variant-numeric: tabular-nums;
}

.digit {
  display: grid;
  width: clamp(35px, 5.7vw, 68px);
  height: clamp(54px, 8vw, 82px);
  place-items: center;
  border-radius: 3px;
  background: linear-gradient(145deg, #951522, var(--wine) 62%, var(--wine-dark));
  box-shadow: 0 4px 0 #530812, 0 9px 18px rgba(103, 20, 25, .14);
  color: #fff9f0;
  font-family: "Arial Narrow", "Segoe UI", sans-serif;
  font-size: clamp(39px, 6.3vw, 72px);
  font-weight: 750;
  letter-spacing: -.065em;
  line-height: 1;
  text-shadow: 0 2px 1px rgba(68, 9, 15, .18);
}

.countdown-colon {
  align-self: flex-end;
  padding-bottom: clamp(4px, .8vw, 10px);
  color: #7b1821;
  font-family: Georgia, serif;
  font-size: clamp(34px, 5.2vw, 58px);
  font-weight: 700;
  line-height: 1;
}

.below-count {
  display: flex;
  width: min(100%, 740px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.target-label, .mode-label {
  color: #8d7667;
  font-size: 10px;
  letter-spacing: .08em;
}

.mode-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-label::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a3312d;
  box-shadow: 0 0 10px rgba(163, 49, 45, .35);
  content: "";
}

.wish-section {
  width: min(100%, 540px);
  margin-top: clamp(25px, 4vh, 38px);
}

.wish-form {
  display: flex;
  align-items: center;
  gap: 9px;
}

.wish-form input, .field input, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(125, 67, 47, .2);
  border-radius: 3px;
  outline: none;
  background: rgba(255, 252, 247, .7);
  color: #512b26;
}

.wish-form input {
  min-height: 40px;
  padding: 0 13px;
  font-size: 12px;
}

.wish-form input::placeholder { color: #a89180; }
.wish-form input:focus, .field input:focus, .field textarea:focus { border-color: rgba(133, 14, 27, .56); }

.wish-form button, .primary-button, .secondary-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--wine);
  border-radius: 3px;
  background: var(--wine);
  color: #fff8ef;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.wish-form .text-button {
  padding: 0 4px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
}

.wish-display {
  margin: 0 0 12px;
  color: #8c2730;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(17px, 2.4vw, 22px);
  font-style: italic;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.wish-note {
  margin: 8px 0 0;
  color: #a28b7a;
  font-size: 10px;
}

.footer {
  min-height: 25px;
  border-top: 1px solid rgba(111, 51, 38, .13);
  padding-top: 15px;
}

.footer-note { font-size: 9px; letter-spacing: .14em; }
.footer-right { gap: 20px; }
.footer-year { color: #967d6c; font-size: 10px; letter-spacing: .1em; }

.admin-entry, .icon-button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #ad9a8a;
  cursor: pointer;
  font-size: 10px;
}

.admin-entry:hover, .icon-button:hover { color: var(--wine); }

.celebration-frame {
  position: fixed;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.dialog {
  width: min(92vw, 600px);
  max-height: min(86vh, 760px);
  padding: 26px;
  border: 1px solid rgba(243, 240, 232, .18);
  border-radius: 6px;
  background: #fff8ef;
  color: var(--ink);
  box-shadow: 0 24px 90px rgba(66, 28, 18, .28);
}

.dialog::backdrop { background: rgba(38, 17, 15, .62); backdrop-filter: blur(5px); }

.dialog-header, .form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-kicker {
  margin: 0 0 7px;
  color: #9c6c43;
  font-size: 9px;
  letter-spacing: .2em;
}

.dialog-header h2 { margin: 0; font-size: 20px; font-weight: 550; }
.icon-button { font-size: 26px; line-height: 1; }
.password-form, .settings-form { margin-top: 23px; }
.password-form[hidden], .settings-form[hidden] { display: none; }

.local-warning {
  margin: 0 0 18px;
  color: #927145;
  font-size: 11px;
  line-height: 1.7;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 12px;
}

.field { display: block; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

.field > span {
  display: block;
  margin-bottom: 7px;
  color: #806d60;
  font-size: 10px;
}

.field input, .field textarea {
  min-height: 39px;
  padding: 9px 10px;
  font-size: 12px;
}

.field textarea { min-height: 76px; resize: vertical; }
.field input[type="datetime-local"] { color-scheme: light; }

.form-message {
  min-height: 16px;
  margin: 9px 0 0;
  color: #927145;
  font-size: 11px;
}

.form-actions { justify-content: flex-end; margin-top: 5px; }
.secondary-button { border-color: rgba(125, 67, 47, .28); background: transparent; color: #775d50; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (min-width: 1200px) {
  .page { padding-right: max(88px, calc((100vw - 1360px) / 2)); padding-left: max(88px, calc((100vw - 1360px) / 2)); }
}

@media (max-width: 600px) {
  .page { min-height: 100svh; padding: 19px 22px 16px; }
  .page::before { inset: 8px; }
  .brand { gap: 7px; font-size: 10px; }
  .brand-mark { width: 26px; height: 26px; }
  .top-note { max-width: 120px; font-size: 9px; text-align: right; }
  main { padding: 36px 0 30px; }
  .hero-ornament { margin-bottom: 16px; }
  .eyebrow { margin-bottom: 17px; font-size: 9px; }
  h1 { font-size: clamp(42px, 11vw, 62px); }
  .intro { margin-top: 15px; font-size: 11px; letter-spacing: .06em; }
  .countdown { gap: clamp(3px, 1.3vw, 6px); margin-top: 48px; }
  .unit { gap: 7px; }
  .unit-label { font-size: 8px; letter-spacing: .035em; white-space: nowrap; }
  .unit-label i { margin-left: 1px; font-size: .78em; }
  .number { gap: 3px; }
  .digit {
    width: clamp(27px, 8.1vw, 36px);
    height: clamp(45px, 13vw, 56px);
    border-radius: 2px;
    font-size: clamp(33px, 9.8vw, 43px);
    box-shadow: 0 3px 0 #530812, 0 6px 12px rgba(103, 20, 25, .12);
  }
  .countdown-colon { padding-bottom: 5px; font-size: clamp(25px, 7vw, 34px); }
  .below-count { margin-top: 19px; }
  .target-label, .mode-label { font-size: 8px; }
  .mode-label { white-space: nowrap; }
  .wish-section { margin-top: 24px; }
  .wish-form { flex-wrap: wrap; gap: 8px; }
  .wish-form input { flex: 1 1 100%; }
  .wish-form button { flex: 1; }
  .footer-note { max-width: 160px; font-size: 8px; line-height: 1.5; }
  .footer-right { gap: 11px; }
  .footer-year { font-size: 9px; }
  .dialog { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field-wide { grid-column: auto; }
}

@media (max-width: 360px) {
  .page { padding-right: 17px; padding-left: 17px; }
  .countdown { gap: 3px; }
  .digit { width: 26px; height: 43px; font-size: 31px; }
  .unit-label { font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
