:root {
  --desk: #ebe4d3; --paper: #fbf8f0; --ink: #1c1814; --ink2: #5d564c; --mute: #8d8577;
  --teal: #4eb2b7; --teal-d: #17858a; --sun: #ffaa15; --red: #cf3b2c;
  --line: rgba(28, 24, 20, 0.14);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--desk); color: var(--ink); }
body { font-family: "Zen Kaku Gothic New", system-ui, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }

/* top bar */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; pointer-events: none; z-index: 5; }
.top > * { pointer-events: auto; }
.logo { background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 8px; }
.logo img { height: 30px; width: auto; display: block; }
.actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(251, 248, 240, 0.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: var(--ink); border-radius: 99px; padding: 8px 14px; font-size: 13px; line-height: 1.2; cursor: pointer; text-decoration: none; min-height: 36px; transition: background 0.15s, transform 0.15s; }
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .logo:focus-visible, .tl:focus-visible, .read:focus-visible { outline: 2px solid var(--teal-d); outline-offset: 2px; }
.btn--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--ink:hover { background: #3a332a; }
.btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); }
.btn[aria-pressed="true"] .dot { background: var(--sun); box-shadow: 0 0 0 3px rgba(255, 170, 21, 0.25); }
.btn--big { font-size: 15px; padding: 12px 22px; min-height: 46px; font-weight: 700; }
.btn--ghost { background: transparent; }

/* start */
.start { position: fixed; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 4; transition: opacity 0.4s; }
.start.is-gone { opacity: 0; pointer-events: none; }
.start__lead { margin: 0; font-size: 13px; color: var(--ink2); letter-spacing: 0.04em; }
.start__btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 0 16px; }
.start__btns .btn--big:first-child { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* hud */
.hud { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 16px calc(14px + env(safe-area-inset-bottom)); z-index: 4; }
.hud__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; max-width: 1180px; margin: 0 auto 8px; }
.day { margin: 0; font-size: 13px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.day b { font-family: "DM Mono", monospace; font-weight: 500; color: var(--ink); margin-right: 8px; }
.day i { font-style: normal; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.read { flex: none; font-size: 13px; color: var(--teal-d); text-decoration: none; font-weight: 700; padding: 6px 2px; }
.read:hover { text-decoration: underline; }
.tl { position: relative; max-width: 1180px; margin: 0 auto; height: 34px; cursor: pointer; touch-action: none; }
.tl__bars { position: absolute; left: 0; right: 0; top: 8px; height: 6px; display: flex; gap: 2px; }
.tl__bars span { height: 100%; border-radius: 3px; opacity: 0.75; }
.tl__win { position: absolute; top: 2px; height: 18px; border: 2px solid var(--ink); border-radius: 6px; background: rgba(255, 255, 255, 0.35); transition: left 0.25s, width 0.25s; min-width: 8px; pointer-events: none; }
.tl__months { position: absolute; left: 0; right: 0; top: 20px; height: 14px; font-family: "DM Mono", monospace; font-size: 10px; color: var(--mute); }
.tl__months span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl__tip { position: absolute; bottom: 30px; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }

/* hint */
.hint { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); margin: 0; background: rgba(28, 24, 20, 0.86); color: var(--paper); font-size: 13px; padding: 8px 14px; border-radius: 99px; z-index: 6; opacity: 0; transition: opacity 0.4s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.hint.is-on { opacity: 1; }

/* end */
.end { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(251, 248, 240, 0.94); border: 1px solid var(--line); border-radius: 99px; padding: 8px; text-align: center; z-index: 6; box-shadow: 0 12px 30px rgba(60, 40, 10, 0.12); max-width: calc(100% - 32px); }
.end__en { margin: 0; font-family: Poppins, sans-serif; font-weight: 600; font-size: 22px; }
.end__ja { margin: 2px 0 12px; font-family: "Zen Maru Gothic", sans-serif; font-weight: 700; color: var(--ink2); }
.end__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* about */
.about { border: 0; border-radius: 18px; padding: 0; max-width: 560px; width: calc(100% - 32px); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(40, 30, 10, 0.3); }
.about::backdrop { background: rgba(28, 24, 20, 0.35); }
.about__in { padding: 26px 24px 22px; position: relative; font-size: 14.5px; line-height: 1.8; }
.about__close { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 18px; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; }
.about__close:hover { background: rgba(0, 0, 0, 0.05); }
.eyebrow { margin: 0; font-family: Poppins, sans-serif; font-size: 11px; letter-spacing: 0.14em; color: var(--teal-d); font-weight: 600; }
.about h2 { font-family: "Zen Maru Gothic", sans-serif; font-size: 20px; margin: 4px 0 10px; }
.about ul { padding: 0; list-style: none; margin: 10px 0; }
.about li { padding: 6px 0; border-top: 1px dashed var(--line); }
.about li b { display: inline-block; min-width: 4.5em; color: var(--teal-d); }
.about__small { font-size: 12px; color: var(--mute); }

/* fallback */
.fallback { position: fixed; inset: 0; display: grid; place-items: center; background: var(--desk); z-index: 10; padding: 16px; }
.fallback__in { max-width: 460px; }
.fallback h1 { font-family: "Zen Maru Gothic", sans-serif; font-size: 20px; }
.fallback a { color: var(--teal-d); }
.fallback__detail { font-size: 12px; color: var(--mute); }
.perf { position: fixed; left: 8px; bottom: 90px; font: 11px/1.4 "DM Mono", monospace; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 4px 6px; border-radius: 4px; z-index: 9; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; }

@media (max-width: 640px) {
  .logo img { height: 24px; }
  .btn { padding: 7px 11px; font-size: 12px; }
  .hud { padding-left: 12px; padding-right: 12px; }
  .day { font-size: 12px; }
  .read { font-size: 12px; }
  .tl__months span:nth-child(even) { display: none; }
  .end { bottom: 92px; }
}
@media (prefers-reduced-motion: reduce) { .tl__win, .start, .hint { transition: none; } }
