:root {
  color-scheme: light;
  --canvas: #f7f4ef;
  --paper: #fffdfa;
  --ink: #282622;
  --muted: #817b72;
  --line: #e4ded5;
  --line-strong: #cec6bb;
  --coral: #e96850;
  --coral-dark: #c94e39;
  --blue: #5367d9;
  --blue-soft: #e9edff;
  --mint-soft: #e2f0e8;
  --shadow: 0 16px 42px rgba(55, 45, 33, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-frame { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 16px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgba(206, 198, 187, 0.7);
  background: rgba(247, 244, 239, 0.95);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--ink); color: #fffdfa; font-family: Georgia, serif; font-size: 20px; }
.brand-name { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 19px; line-height: 1; letter-spacing: 0.02em; }
.brand-caption, .section-kicker { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.16em; line-height: 1.2; }
.brand-caption { margin-top: 4px; font-size: 8px; }
.topbar-actions, .form-actions, .card-actions { display: flex; align-items: center; gap: 8px; }

.button, .icon-button {
  border: 1px solid transparent;
  border-radius: 7px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.button { min-height: 40px; padding: 0 16px; font-size: 13px; font-weight: 700; }
.button:hover, .icon-button:hover { transform: translateY(-1px); }
.button-primary { background: var(--coral); color: #fff; box-shadow: 0 5px 14px rgba(233, 104, 80, 0.2); }
.button-primary:hover { background: var(--coral-dark); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.button-quiet:hover { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.button-icon { margin-right: 7px; font-size: 20px; font-weight: 400; line-height: 0; vertical-align: -1px; }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border-color: var(--line); background: transparent; color: var(--muted); font-size: 21px; line-height: 1; }
.icon-button:hover { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }

.main-content { width: min(1180px, calc(100% - 40px)); margin: 0 auto; flex: 1; padding: clamp(48px, 8vw, 96px) 0 56px; }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
h1, h2, p { margin: 0; }
h1 { margin-top: 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 5vw, 58px); font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
h2 { margin-top: 8px; font-family: Georgia, "Times New Roman", serif; font-size: 27px; font-weight: 400; line-height: 1.15; }
.board-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 4px; }
.count-badge { display: inline-flex; min-width: 48px; height: 28px; align-items: center; justify-content: center; padding: 0 9px; border-radius: 99px; background: var(--ink); color: #fffdfa; font-size: 11px; font-weight: 750; }
.storage-note { color: var(--muted); font-size: 12px; }

.composer { margin: 0 0 30px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); }
.composer-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 22px; }
.countdown-form { display: grid; grid-template-columns: minmax(220px, 1fr) 210px auto; align-items: end; gap: 14px; }
.field { display: grid; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0.04em; }
.field input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: #fff; color: var(--ink); font-size: 14px; letter-spacing: 0; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(83, 103, 217, 0.14); }
.form-actions { justify-content: flex-end; }

.empty-state { display: grid; min-height: 330px; place-items: center; align-content: center; gap: 15px; padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: 8px; text-align: center; }
.empty-mark { color: var(--line-strong); font-family: Georgia, serif; font-size: 72px; line-height: 0.8; letter-spacing: -0.08em; }
.empty-state h2 { margin-bottom: 8px; font-size: 30px; }

.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.countdown-card { position: relative; display: flex; min-height: 270px; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 8px 24px rgba(55, 45, 33, 0.05); }
.countdown-card::before { position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--blue); content: ""; }
.countdown-card:nth-child(3n + 2)::before { background: var(--coral); }
.countdown-card:nth-child(3n)::before { background: #6da486; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-index { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.15em; }
.card-actions .icon-button { width: 30px; height: 30px; border: 0; font-size: 17px; }
.card-main { display: block; margin: 18px 0 20px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.card-main:hover .card-title { color: var(--blue); }
.card-title { display: block; max-width: 100%; overflow: hidden; color: var(--ink); font-family: Georgia, serif; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.day-display { display: flex; align-items: baseline; gap: 8px; margin-top: 17px; }
.day-number { color: var(--ink); font-family: Georgia, serif; font-size: clamp(50px, 6vw, 74px); font-weight: 400; letter-spacing: -0.05em; line-height: 0.86; }
.day-unit { color: var(--muted); font-size: 14px; font-weight: 700; }
.card-status { margin-top: 12px; color: var(--muted); font-size: 12px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.card-footer time { white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 800; }
.is-today .status-pill { background: #fff0dc; color: #a45c17; }
.is-past .status-pill { background: #f2e8e5; color: #9b5145; }

.app-footer { display: flex; justify-content: space-between; gap: 16px; width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.14em; }

.fullscreen-dialog { width: min(100vw, 100%); height: min(100vh, 100%); max-width: none; max-height: none; padding: 0; border: 0; background: transparent; color: var(--ink); }
.fullscreen-dialog::backdrop { background: #25231f; }
.fullscreen-shell { position: relative; display: grid; width: 100%; height: 100%; place-items: center; background: var(--canvas); }
.fullscreen-close { position: absolute; top: 22px; right: 22px; z-index: 1; width: 44px; height: 44px; border-color: var(--line-strong); }
.fullscreen-inner { width: min(700px, calc(100% - 48px)); text-align: center; }
.fullscreen-inner .section-kicker { color: var(--coral-dark); }
.fullscreen-inner h2 { margin-top: 20px; font-size: clamp(32px, 6vw, 72px); }
.fullscreen-number-row { display: flex; align-items: baseline; justify-content: center; gap: 18px; margin-top: 48px; }
.fullscreen-number { font-family: Georgia, serif; font-size: clamp(120px, 25vw, 300px); font-weight: 400; letter-spacing: -0.09em; line-height: 0.75; }
.fullscreen-unit { color: var(--muted); font-size: clamp(22px, 4vw, 38px); font-weight: 700; }
.fullscreen-status { margin-top: 42px; font-size: 17px; font-weight: 700; }
.fullscreen-date { margin-top: 10px; color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: min(360px, calc(100vw - 40px)); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--ink); color: #fffdfa; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 850px) {
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .countdown-form { grid-template-columns: 1fr 1fr; }
  .form-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; padding: 14px 20px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .button { min-height: 36px; padding: 0 10px; font-size: 12px; }
  .topbar-actions .icon-button { width: 34px; height: 34px; }
  .main-content { width: min(100% - 32px, 520px); padding-top: 44px; }
  .intro-row { align-items: flex-start; flex-direction: column; gap: 15px; }
  .board-meta { width: 100%; justify-content: space-between; }
  .countdown-form { grid-template-columns: 1fr; }
  .form-actions { grid-column: auto; }
  .board-grid { grid-template-columns: 1fr; }
  .countdown-card { min-height: 250px; }
  .app-footer { width: min(100% - 32px, 520px); font-size: 8px; }
  .storage-note { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
