:root {
  color-scheme: light;
  --ink: #242321;
  --subtle: #68635d;
  --line: #eae6e0;
  --accent: #875530;
  --focus: #81766a;
  --ring-track: #eee8e1;
  --paper: #fff;
  --sans: Inter, 'Malgun Gothic', 'Apple SD Gothic Neo', 'Segoe UI', sans-serif;
  --serif: Georgia, 'Nanum Myeongjo', 'Batang', 'AppleMyungjo', serif;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p, dl, dd, figure, blockquote { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 1px solid var(--focus); outline-offset: 2px; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.account-control { display: inline-flex; align-items: center; min-height: 35px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; text-decoration: none; }
.account-control:hover { border-color: var(--focus); }
.brand { font: 600 19px/1 var(--serif); white-space: nowrap; letter-spacing: -.03em; }
.language { min-height: 35px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; }

.settings { width: min(740px, 100%); display: grid; grid-template-columns: 1.25fr 1.15fr 1fr 1fr; gap: 16px; margin: 25px auto 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; font-weight: 680; }
.field > span, .field-heading { min-height: 23px; display: flex; align-items: center; }
.field-heading { justify-content: space-between; gap: 4px; }
#unknown-time { padding: 0 2px; border: 0; background: none; color: var(--subtle); font-size: 11px; text-decoration: underline; text-underline-offset: 2px; }
#unknown-time:hover { color: var(--ink); }
.field :is(input, select, .picker-trigger) { border: 1px solid #e6e1d9; border-radius: 4px; background-color: white; display: block; min-width: 0; width: 100%; min-height: 40px; padding: 8px 10px; font-size: 13px; font-weight: 500; }
.field select { text-overflow: ellipsis; }
.field .picker-trigger { text-align: start; }
.picker-trigger[data-empty='true'] { color: var(--subtle); }
.picker-trigger:hover { border-color: var(--focus); }
#birthday-trigger[aria-invalid='true'] { border-color: #a83928; }
.picker-dialog { width: min(360px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 5px; padding: 18px; background: #fff; color: var(--ink); }
.picker-dialog::backdrop { background: #29231f33; }
.picker-dialog h2 { font-size: 17px; margin-bottom: 12px; }
.picker-fields { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.time-fields { grid-template-columns: 1fr 1fr; }
.picker-fields :is(input, select) { font-size: 16px; }
.picker-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-top: 15px; }
.picker-actions button { min-height: 34px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; }
.picker-actions button:first-child { margin-right: auto; }
.picker-actions button[type='submit'] { background: #443a31; border-color: #443a31; color: #fff; }
.login-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.login-heading h2 { margin: 0; outline: none; }
.login-close { min-height: 32px; padding: 0 4px; border: 0; background: none; color: var(--subtle); font-size: 13px; }
.login-close:hover { text-decoration: underline; text-underline-offset: 2px; }
.google-provider { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: center; gap: 10px; padding: 0 12px; border: 1px solid #747775; border-radius: 8px; color: #1f1f1f; background: #fff; font: 500 14px/20px 'Google Sans', var(--sans); text-decoration: none; }
.google-provider:hover { background: #f8f9fa; }
.google-provider img { display: block; width: 18px; height: auto; }
.login-status { margin-top: 10px; color: var(--subtle); font-size: 13px; }
.login-status:empty { display: none; }

.hero { position: relative; padding: 43px 0 38px; text-align: center; }
.hero-main { max-width: 650px; margin: auto; }
.ad-slot { position: absolute; top: 43px; width: min(15%, 152px); height: 306px; }
.ad-left { left: 0; }
.ad-right { right: 0; }

.clock { width: min(310px, calc(100% - 32px)); aspect-ratio: 1; position: relative; margin: 0 auto 19px; }
.clock-ring { position: absolute; inset: 0; border-radius: 50%; background: var(--ring-track); mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); }
.clock-ring-outer { inset: -7px; }
.clock-ring-extra { inset: -14px; }
.dial { position: absolute; inset: 3px; border-radius: 50%; background: #fff; }
.dial::before { content: ''; position: absolute; inset: 7px; border: 1px solid #f0eae3; border-radius: 50%; }
.tick { position: absolute; inset: 5.5%; transform: rotate(var(--angle)); }
.tick::before { content: ''; position: absolute; left: 50%; top: 0; height: 2.1%; width: 1px; background: #ccc2b7; transform: translateX(-50%); }
.tick.major::before { height: 3.5%; width: 1.5px; background: #75695c; border-radius: 2px; }
.number { position: absolute; translate: -50% -50%; font: 500 clamp(15px, 5vw, 23px)/1 var(--serif); color: #504943; }
.number.cardinal { color: var(--ink); }
.hand { position: absolute; top: 50%; left: 50%; width: 0; height: 0; transform: rotate(var(--angle)); }
.hand::before { content: ''; position: absolute; left: 0; bottom: 0; translate: -50% 0; border-radius: 8px; background: var(--ink); }
.hour::before { width: 5px; height: clamp(49px, 19vw, 65px); bottom: -7px; }
.minute::before { width: 3px; height: clamp(70px, 27vw, 98px); bottom: -8px; }
.second::before { width: 1.5px; height: clamp(90px, 34vw, 124px); bottom: -24px; background: #ae7147; }
.pin { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; translate: -50% -50%; border: 2px solid #fffaf4; border-radius: 50%; background: #a6683d; }

.readout time { display: block; font: 400 31px/1.2 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: .07em; }
.readout p { min-height: 20px; margin-top: 5px; font-size: 12px; color: var(--subtle); }
.readout p:empty { display: none; }
.readout p[data-error='true'] { color: #a83928; }
.overage-message { min-height: 18px; margin-top: 5px; color: var(--accent); font-size: 13px; }
.stage-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 13px; margin: 11px 0 0; padding: 0; list-style: none; color: var(--subtle); font-size: 11px; }
.stage-legend li { display: flex; align-items: center; gap: 4px; }
.stage-legend li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--stage-color); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(480px, 100%); margin: 15px auto 0; padding: 13px 0 0; border-top: 1px solid var(--line); }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics dt { color: var(--subtle); font-size: clamp(10px, 2.8vw, 12px); }
.metrics dd { margin-top: 1px; font: 400 23px/1.2 var(--serif); font-variant-numeric: tabular-nums; }

.journal { width: min(650px, 100%); margin: auto; padding: 17px 0 0; border-top: 1px solid var(--line); }
.journal h2 { margin-bottom: 9px; font-size: 16px; font-weight: 690; letter-spacing: -.025em; }
.journal textarea { display: block; width: 100%; min-height: 110px; resize: vertical; padding: 12px 13px; border: 1px solid #e6e1d9; border-radius: 4px; background: #fff; font-size: 15px; line-height: 1.7; }
.journal-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 9px; }
.storage-note { flex: 1; }
.storage-note, .memo-bytes { font-size: 11px; color: var(--subtle); }
.memo-bytes { white-space: nowrap; font-variant-numeric: tabular-nums; }
.storage-note[data-error='true'], .memo-bytes[data-error='true'] { color: #a83928; }
.journal textarea[aria-invalid='true'] { border-color: #a83928; }
#save-memo { min-width: 60px; min-height: 34px; padding: 4px 11px; border: 1px solid #443a31; border-radius: 4px; color: #fff; background: #443a31; font-size: 13px; }
#save-memo:disabled { cursor: default; color: var(--subtle); background: #f9f8f6; border-color: var(--line); }
.memo-history { margin: 16px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.memo-history li { border-bottom: 1px solid var(--line); }
.memo-history summary { display: flex; align-items: baseline; gap: 14px; min-height: 43px; padding: 10px 2px; cursor: pointer; list-style: none; }
.memo-history summary::-webkit-details-marker { display: none; }
.memo-history summary:hover .memo-preview { text-decoration: underline; text-underline-offset: 3px; }
.memo-history summary time { flex: none; color: var(--subtle); font-size: 13px; font-variant-numeric: tabular-nums; }
.memo-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memo-body { padding: 2px 2px 12px; overflow-wrap: anywhere; }
.memo-body p { white-space: pre-wrap; }
.memo-body time { display: block; margin-top: 9px; font-size: 11px; color: var(--subtle); }
.more-notes { display: block; margin: 11px auto 0; padding: 4px 8px; border: 0; background: none; color: var(--subtle); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.move-status { text-align: center; font-size: 12px; color: var(--subtle); }
.move-page { width: min(460px, calc(100% - 40px)); margin: 12vh auto; }
.move-page > * + * { margin-top: 16px; }
.privacy-link { margin: 20px 0; text-align: center; font-size: 12px; color: var(--subtle); }
.privacy-page { width: min(660px, calc(100% - 40px)); margin: 8vh auto; }
.privacy-page p, .privacy-page section + section { margin-top: 16px; }
:is(select, input, textarea):focus { outline: none; }
:is(.language, .field input, .field select, .journal textarea, .field .picker-trigger):focus-visible { outline: none; border-color: var(--focus); }

.quote { width: min(650px, 100%); margin: 33px auto 0; padding: 19px 12px 34px; border-top: 1px solid var(--line); text-align: center; }
.quote blockquote { max-width: 540px; margin-inline: auto; font: 500 clamp(17px, 3vw, 22px)/1.55 var(--serif); text-wrap: balance; }
.quote figcaption { margin-top: 10px; font-size: 12px; color: var(--subtle); }

@media (max-width: 820px) {
  .ad-slot { display: none; }
  .settings { gap: 10px; }
}

@media (max-width: 660px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 63px; }
  .settings { margin-top: 17px; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .field input, .field select { font-size: 16px; }
  .hero { padding-top: 29px; padding-bottom: 28px; }
  .clock { width: min(288px, calc(100% - 32px)); }
  .journal textarea { font-size: 16px; }
}
