:root {
  color-scheme: dark;
  --bg: #17120f;
  --paper: #241b16;
  --paper-light: #2d221b;
  --text: #f0e5d7;
  --muted: #a79a8b;
  --faint: #76695d;
  --amber: #d4a767;
  --amber-soft: rgba(212, 167, 103, .16);
  --line: rgba(244, 229, 211, .1);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse 75% 36% at 50% -4%, rgba(185, 125, 62, .14), transparent 72%),
    linear-gradient(180deg, #211914 0%, var(--bg) 55%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.app-shell { width: min(520px, 100%); min-height: 100svh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 22px 34px; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 30px; }
.back-link { color: var(--faint); font-size: 13px; text-decoration: none; transition: color 160ms ease; }
.back-link:hover { color: var(--amber); }
.date-label { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-align: center; }
.icon-button { justify-self: end; width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 18px; line-height: 1; transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.icon-button:active { transform: scale(.94); }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.06); }

.focus-card { display: flex; min-height: 610px; margin-top: clamp(54px, 11vh, 100px); padding: 34px 24px 28px; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(145deg, rgba(49, 36, 28, .9), rgba(31, 23, 18, .94)); box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.eyebrow { margin: 0; color: var(--amber); font-size: 11px; font-weight: 650; letter-spacing: .17em; }
.focus-title { max-width: 11em; min-height: 3em; margin: 18px 0 7px; font-family: ui-serif, "Songti SC", "STSong", serif; font-size: clamp(31px, 8vw, 42px); font-weight: 500; letter-spacing: -.045em; line-height: 1.18; text-align: center; text-wrap: balance; }
.change-action { border: 0; padding: 5px 9px; color: var(--muted); background: transparent; font-size: 12px; transition: color 160ms ease, transform 160ms var(--ease-out); }
.change-action:hover { color: var(--amber); }
.change-action:active { transform: scale(.96); }

.timer-wrap { display: grid; flex: 1; min-height: 240px; width: 100%; place-items: center; }
.timer-ring { --progress: 0deg; position: relative; display: grid; width: min(232px, 60vw); aspect-ratio: 1; place-content: center; border-radius: 50%; background: conic-gradient(from -90deg, var(--amber) var(--progress), rgba(255,255,255,.08) 0deg); transition: background 180ms linear, transform 220ms var(--ease-out); }
.timer-ring::before { position: absolute; inset: 7px; border-radius: inherit; background: #241a15; content: ""; box-shadow: inset 0 0 28px rgba(0,0,0,.18); }
.timer-ring.is-running { transform: scale(1.025); }
.timer-ring > span { position: relative; z-index: 1; text-align: center; }
.timer-value { font-variant-numeric: tabular-nums; font-size: clamp(42px, 11vw, 56px); font-weight: 350; letter-spacing: -.06em; }
.timer-hint { margin-top: 8px; color: var(--muted); font-size: 12px; }

.primary-button, .done-button, .save-button { width: 100%; min-height: 54px; border: 0; border-radius: 17px; font-size: 16px; font-weight: 650; transition: transform 160ms var(--ease-out), background 180ms ease, color 180ms ease, opacity 180ms ease; }
.primary-button { color: #271a10; background: var(--amber); box-shadow: 0 10px 28px rgba(175, 114, 45, .16); }
.primary-button:hover { background: #e0b676; }
.primary-button:active, .done-button:active, .save-button:active { transform: scale(.975); }
.done-button { display: none; margin-top: 9px; color: var(--text); background: rgba(255,255,255,.08); }
.done-button:not(:disabled) { display: block; }
.done-button:disabled { cursor: default; opacity: .42; }
.focus-card.is-running .primary-button { color: var(--amber); background: transparent; box-shadow: inset 0 0 0 1px rgba(212,167,103,.5); }
.focus-card.is-complete .primary-button { color: #271a10; background: #d1a364; }

.week-section { margin: 38px 8px 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: 13px; }
.section-heading p { margin: 0; }
.section-heading span { color: var(--faint); font-size: 12px; }
.week-track { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; margin-top: 16px; }
.day-dot { display: grid; gap: 8px; justify-items: center; }
.day-dot span { display: block; width: 100%; max-width: 42px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.025); transition: background 200ms ease, border-color 200ms ease, transform 200ms var(--ease-out); }
.day-dot.is-done span { border-color: rgba(212,167,103,.75); background: var(--amber); box-shadow: 0 4px 14px rgba(212,167,103,.18); }
.day-dot.is-today span { transform: scale(1.08); }
.day-dot small { color: var(--faint); font-size: 10px; }

.quiet-note { display: flex; margin: 28px 8px 0; align-items: center; justify-content: space-between; border: 1px solid rgba(212,167,103,.22); border-radius: 15px; padding: 13px 14px 13px 16px; color: var(--amber); background: var(--amber-soft); transition: opacity 180ms ease, transform 180ms var(--ease-out); }
.quiet-note[hidden] { display: none; }
.quiet-note p { margin: 0; font-size: 13px; }
.quiet-note button { border: 0; padding: 6px 8px; color: var(--text); background: transparent; font-size: 12px; }

.settings-dialog { width: min(460px, calc(100% - 28px)); margin: auto; border: 1px solid rgba(244, 229, 211, .12); border-radius: 27px; padding: 0; color: var(--text); background: #261c17; box-shadow: 0 30px 100px rgba(0,0,0,.5); }
.settings-dialog::backdrop { background: rgba(8, 6, 5, .7); backdrop-filter: blur(4px); }
.settings-sheet { padding: 26px; }
.sheet-head { display: flex; align-items: start; justify-content: space-between; }
.sheet-head h2 { margin: 8px 0 0; font-family: ui-serif, "Songti SC", serif; font-size: 28px; font-weight: 500; letter-spacing: -.04em; }
.close-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: rgba(255,255,255,.06); font-size: 24px; line-height: 1; }
.field-label, .duration-fieldset legend { display: block; margin: 30px 0 10px; color: var(--muted); font-size: 12px; }
.settings-sheet input[type="text"], .settings-sheet input:not([type]) { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 14px; color: var(--text); background: rgba(0,0,0,.16); outline: none; }
.settings-sheet input::placeholder { color: #776a5e; }
.duration-fieldset { border: 0; margin: 0; padding: 0; }
.duration-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.duration-options label { cursor: pointer; }
.duration-options input { position: absolute; opacity: 0; }
.duration-options span { display: grid; min-height: 45px; place-items: center; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); font-size: 13px; transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms var(--ease-out); }
.duration-options input:checked + span { border-color: rgba(212,167,103,.6); color: var(--amber); background: var(--amber-soft); }
.duration-options label:active span { transform: scale(.97); }
.voice-option { display: flex; gap: 10px; margin: 25px 0; align-items: center; color: var(--muted); font-size: 13px; }
.voice-option input { accent-color: var(--amber); }
.save-button { color: #271a10; background: var(--amber); }
.privacy-note { margin: 16px 0 0; color: var(--faint); font-size: 11px; text-align: center; }

@media (hover: hover) and (pointer: fine) {
  .day-dot.is-done:hover span { transform: scale(1.08); }
}
@media (max-width: 400px) {
  .app-shell { padding-inline: 14px; }
  .focus-card { min-height: 570px; padding-inline: 18px; border-radius: 25px; }
  .timer-wrap { min-height: 215px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 1ms !important; }
}
