:root {
  color-scheme: dark;
  --background: #000;
  --foreground: #edeefb;
  --muted: #9294bb;
  --ticks: #7c7d9a;
  --accent: #ff245b;
  --second: #ff9c32;
  --tile: min(41.5vw, 84dvh, 780px);
  --brightness: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; background: var(--background); }
body { overflow: hidden; color: var(--foreground); overscroll-behavior: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; background: none; }
button, select, input { touch-action: manipulation; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
button:disabled, input:disabled { opacity: .4; cursor: default; }
[hidden] { display: none !important; }
#main { height: 100%; height: 100dvh; width: 100%; display: grid; place-items: center; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.desk { display: grid; grid-template-columns: var(--tile) var(--tile); gap: calc(var(--tile) * .18); align-items: center; filter: brightness(var(--brightness)); }
.clock-widget, .calendar-widget { position: relative; width: var(--tile); height: var(--tile); min-width: 0; }
#clock { display: block; width: 100%; height: 100%; overflow: visible; }
.tick-minor { stroke: var(--ticks); stroke-width: 3.6; }
.tick-major { stroke: var(--foreground); stroke-width: 4.4; }
.numerals { fill: var(--foreground); font-size: 65px; font-weight: 600; letter-spacing: -3px; }
.hour-hand, .minute-hand { stroke: var(--foreground); stroke-linecap: round; fill: none; }
.hour-hand { stroke-width: 16; }
.minute-hand { stroke-width: 14; }
.second-hand { stroke: var(--second); stroke-width: 3.2; stroke-linecap: round; }
.hub-outer { fill: var(--foreground); }
.hub-inner { fill: #000; }
.hub-second { fill: var(--second); }
.zone-caption { position: absolute; bottom: calc(var(--tile) * -.025); width: 100%; text-align: center; color: var(--muted); font-size: max(11px, calc(var(--tile) * .032)); letter-spacing: .03em; }
.calendar-widget { display: flex; flex-direction: column; padding: calc(var(--tile) * .025) 0 calc(var(--tile) * .005); }
.month-header { display: flex; align-items: center; min-height: calc(var(--tile) * .09); gap: calc(var(--tile) * .02); margin-bottom: calc(var(--tile) * .025); }
.month-title { color: var(--accent); padding: 0; font-size: calc(var(--tile) * .072); font-weight: 650; letter-spacing: -.018em; line-height: 1.15; text-transform: uppercase; text-align: left; }
.calendar-year { color: var(--muted); font-size: calc(var(--tile) * .039); font-weight: 600; }
.month-nav { margin-left: auto; display: flex; gap: 2px; opacity: 0; visibility: hidden; }
.controls-visible .month-nav, .calendar-widget:focus-within .month-nav { opacity: 1; visibility: visible; }
.icon-button.small { width: clamp(28px, calc(var(--tile) * .075), 44px); height: clamp(28px, calc(var(--tile) * .075), 44px); padding: 4px; }
.icon-button.small svg { width: 18px; height: 18px; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays { height: calc(var(--tile) * .1); align-items: center; margin-bottom: calc(var(--tile) * .025); font-size: calc(var(--tile) * .064); font-weight: 600; }
.days { flex: 1; grid-template-rows: repeat(var(--weeks, 6), 1fr); font-size: calc(var(--tile) * .065); font-weight: 600; letter-spacing: -.035em; }
.day { display: flex; align-items: center; justify-content: center; min-width: 0; }
.day > span { width: calc(var(--tile) * .117); height: calc(var(--tile) * .117); display: grid; place-items: center; border-radius: 50%; }
.weekend { color: var(--muted); }
.day.today > span { background: var(--accent); color: #fff1f6; }
.today-button { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); color: var(--accent); white-space: nowrap; font-size: 13px; padding: 7px 13px; border: 1px solid #45202c; border-radius: 16px; background: #11070a; }
.swapped .clock-widget { order: 2; }
.swapped .calendar-widget { order: 1; }
body.night { --foreground: #eb3b36; --muted: #88302d; --ticks: #6c2422; --accent: #df2925; --second: #ff493c; }
body.night .desk { filter: brightness(calc(var(--brightness) * .58)); }
body.night .day.today > span { color: #000; }
.toolbar { position: fixed; z-index: 4; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translate(-50%, 12px); display: flex; align-items: center; gap: 3px; padding: 5px; border-radius: 32px; background: rgba(20, 20, 24, .96); border: 1px solid #333338; box-shadow: 0 8px 35px #0009; opacity: 0; visibility: hidden; }
.controls-visible .toolbar { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toolbar-divider { width: 1px; height: 23px; margin: 0 3px; background: #3a3a40; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 10px; border-radius: 50%; flex: none; position: relative; }
.icon-button:hover { background: #ffffff12; }
.icon-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button[aria-pressed="true"] { color: var(--accent); }
.status-dot { position: absolute; width: 5px; height: 5px; right: 10px; top: 8px; border-radius: 50%; background: #787882; }
.awake-active .status-dot { background: #6bd89c; }
.hint { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; width: 100%; text-align: center; color: #767681; font-size: 12px; letter-spacing: .03em; transition: opacity .3s; pointer-events: none; }
.hint.dismissed { opacity: 0; }
dialog { background: #141416; color: #eeeef2; border: 1px solid #38383d; border-radius: 24px; padding: 0; width: min(440px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); box-shadow: 0 25px 110px #000c; overflow: auto; overscroll-behavior: contain; }
dialog::backdrop { background: #000a; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 23px 22px 17px; border-bottom: 1px solid #29292e; position: sticky; top: 0; background: #141416; z-index: 2; }
.eyebrow { font-size: 10px; letter-spacing: .18em; font-weight: 700; color: #b7b7c1; margin: 0 0 5px; }
h1, h2 { font-size: 25px; font-weight: 600; letter-spacing: -.025em; margin: 0; }
.settings-body { padding: 0 23px 20px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 13px 0; border-bottom: 1px solid #29292e; font-size: 14px; }
.setting-row label { cursor: pointer; }
.setting-row select { width: auto; max-width: 55%; font-size: 13px; color: #c2c2ce; background: #212126; border: 1px solid #3b3b42; border-radius: 8px; padding: 7px 6px; }
input[role="switch"] { appearance: none; -webkit-appearance: none; margin: 0; width: 42px; height: 25px; border: 0; background: #414148; border-radius: 20px; position: relative; flex: none; cursor: pointer; transition: background .15s; }
input[role="switch"]::before { content: ""; position: absolute; width: 19px; height: 19px; top: 3px; left: 3px; border-radius: 50%; background: #f7f7fa; transition: transform .15s; box-shadow: 0 1px 3px #0004; }
input[role="switch"]:checked { background: #db2454; }
input[role="switch"]:checked::before { transform: translateX(17px); }
.brightness-row { padding: 17px 0 11px; border-bottom: 1px solid #29292e; font-size: 14px; }
.brightness-row > div { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.brightness-row output { color: #aaaab6; font-size: 12px; }
input[type="range"] { width: 100%; height: 24px; accent-color: #ff245b; cursor: pointer; }
.setting-note { color: #9d9da9; font-size: 12px; line-height: 1.5; margin: 6px 0 0; }
.awake-setting { min-height: 72px; }
.install-section { text-align: center; padding: 22px 0 12px; }
.primary-button { width: 100%; background: #eeeeF3; color: #151518; border-radius: 12px; font-size: 14px; font-weight: 600; padding: 13px 20px; }
.text-button { color: #ff6489; margin-top: 12px; font-size: 13px; padding: 7px; }
.settings-footer { font-size: 12px; line-height: 1.65; color: #9494a1; text-align: center; margin: 10px 3px; }
.version { color: #656570; font-size: 10px; text-align: center; margin: 14px 0 0; }
.install-help { padding: 16px 24px 25px; font-size: 15px; line-height: 1.7; }
.install-help > p:first-child { margin-top: 0; white-space: pre-line; }
.toast { position: fixed; left: 50%; bottom: max(86px, calc(env(safe-area-inset-bottom) + 66px)); transform: translate(-50%, 8px); background: #26262d; border: 1px solid #45454e; color: #f3f3f7; border-radius: 15px; width: max-content; max-width: min(420px, calc(100vw - 32px)); padding: 12px 18px; font-size: 13px; line-height: 1.5; text-align: center; z-index: 12; opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.no-script { position: fixed; left: 20px; right: 20px; top: 40%; padding: 25px; background: #222; text-align: center; }
@media (max-aspect-ratio: 1/1) {
  :root { --tile: min(88vw, calc((100dvh - 72px) / 2.15), 620px); }
  .desk { grid-template-columns: var(--tile); gap: calc(var(--tile) * .12); }
  .calendar-widget { padding-left: calc(var(--tile) * .015); padding-right: calc(var(--tile) * .015); }
  .month-title { font-size: calc(var(--tile) * .068); }
  .toolbar { bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (max-height: 480px) and (min-aspect-ratio: 1/1) {
  :root { --tile: min(39vw, 86dvh); }
  .toolbar { bottom: max(5px, env(safe-area-inset-bottom)); padding: 3px; }
  .toolbar .icon-button { width: 36px; height: 36px; padding: 8px; }
  .toolbar .icon-button svg { width: 21px; height: 21px; }
  .hint { bottom: 8px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; } }
