/* Clockwise: neubrutalism. Flat colour blocks, thick outlines, hard shadows. */

:root {
  --bg: #fff4e0;
  --panel: #ffffff;
  --text: #111111;
  --muted: #4a4a4a;
  --edge: #111111;          /* outlines and shadows */
  --on-colour: #111111;     /* text on the coloured cards, both themes */
  --night: rgba(17, 17, 17, 0.10);
  --work: rgba(78, 205, 196, 0.35);
  --needle: #ff4d4d;
  --border: 3px;
  --shadow: 6px 6px 0 var(--edge);
  --shadow-sm: 3px 3px 0 var(--edge);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --panel: #26221b;
    --text: #f6ecd9;
    --muted: #c9bda6;
    --edge: #f6ecd9;
    --night: rgba(0, 0, 0, 0.35);
    --work: rgba(78, 205, 196, 0.28);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 24px 40px;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button, input, label { touch-action: manipulation; }

main, .top, .foot { max-width: 1040px; margin: 0 auto; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px;
  background: var(--panel); color: var(--text);
  border: var(--border) solid var(--edge); border-radius: 10px;
  box-shadow: var(--shadow-sm);
  font-weight: 800; letter-spacing: 0.01em;
  cursor: pointer; user-select: none;
  transition: transform 0.06s, box-shadow 0.06s, background 0.12s;
}
.btn:hover { background: #ffd23f; color: #111; }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--edge); }
.btn:focus-visible, .link:focus-visible, canvas:focus-visible, .add input:focus-visible {
  outline: 3px solid var(--needle); outline-offset: 3px;
}
.btn.now[aria-pressed="true"] { background: #b8f35d; color: #111; }

.link {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}

/* ------------------------------------------------------------ header */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 28px 0 24px;
}
.logo {
  display: flex; align-items: center; gap: 12px; margin: 0;
  font-size: 30px; font-weight: 900; letter-spacing: -0.03em;
}
.logo svg { width: 44px; height: 44px; }
.top-actions { display: flex; gap: 12px; }

/* ------------------------------------------------------------ hero */

.hero {
  background: var(--panel);
  border: var(--border) solid var(--edge); border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px 26px 24px;
}
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero-label { font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; }
.hero-time { font-size: clamp(56px, 13vw, 120px); font-weight: 800; line-height: 1; letter-spacing: -0.04em; margin: 14px 0 10px; }
.hero-time .sec { font-size: 0.38em; color: var(--muted); letter-spacing: 0; margin-left: 0.15em; }
.hero-time .ampm { font-size: 0.32em; letter-spacing: 0; margin-left: 0.2em; }
.hero-date { font-size: 22px; font-weight: 800; }
.hero-zone { color: var(--muted); font-weight: 600; margin-top: 2px; }
#use-mine { margin-top: 10px; color: var(--muted); }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border: var(--border) solid var(--edge); border-radius: 99px;
  font-size: 13px; font-weight: 800; background: #b8f35d; color: #111;
}
.status.live::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: #111;
  animation: pulse 1.4s ease-in-out infinite;
}
.status.pinned { background: #ffd23f; }
.status button { color: #111; font-size: 13px; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ------------------------------------------------------------ ruler */

.scrub { margin-top: 26px; }
.ruler-wrap {
  background: var(--panel);
  border: var(--border) solid var(--edge); border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
#ruler {
  display: block; width: 100%; height: 84px;
  cursor: grab; touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
#ruler.dragging { cursor: grabbing; }
.steps { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ------------------------------------------------------------ zone cards */

.zones {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px; margin-top: 34px;
}

.zone {
  position: relative;
  background: var(--c); color: var(--on-colour);
  border: var(--border) solid var(--edge); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
  min-height: 170px;
  display: flex; flex-direction: column;
}
.zone header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.zone .city { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -0.01em; line-height: 1.15; }
.zone .tzid { font-size: 12px; font-weight: 600; opacity: 0.7; }
.zone .actions { display: flex; gap: 6px; flex: none; }
.zone .icon {
  width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  background: #fff; color: #111;
  border: 2px solid #111; border-radius: 8px; box-shadow: 2px 2px 0 #111;
  cursor: pointer;
}
.zone .icon:hover { background: #111; color: #fff; }
.zone .icon:active { transform: translate(2px, 2px); box-shadow: none; }
.zone .icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.zone .time { font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; margin: 14px 0 6px; }
.zone .time .ampm { font-size: 0.42em; letter-spacing: 0; margin-left: 0.15em; }
.zone .date { font-weight: 700; }
.zone .date b { font-weight: 900; }
.zone .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border: 2px solid #111; border-radius: 99px;
  background: rgba(255, 255, 255, 0.65); color: #111;
  font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.pill.period.work { background: #fff; }
.pill.period.night { background: #111; color: #fff; }

/* The add card */
.add {
  border: var(--border) dashed var(--edge); border-radius: 16px;
  padding: 16px; min-height: 170px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
.add label { font-weight: 900; font-size: 18px; }
.add input {
  width: 100%; min-height: 44px; padding: 0 12px;
  background: var(--panel); border: var(--border) solid var(--edge); border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.add input::placeholder { color: var(--muted); }

/* ------------------------------------------------------------ footer & toast */

.foot { margin-top: 48px; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; }
.foot p { margin: 6px 0; }
.foot .credit { margin-top: 28px; font-size: 12.5px; font-weight: 500; opacity: 0.7; }
.foot a { color: inherit; }
kbd {
  font-family: var(--mono); font-size: 12px; font-weight: 800;
  padding: 1px 6px; border: 2px solid var(--edge); border-radius: 5px; background: var(--panel); color: var(--text);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 10;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: #ffd23f; color: #111;
  border: var(--border) solid #111; border-radius: 10px; box-shadow: 4px 4px 0 #111;
  padding: 10px 16px; font-weight: 800;
  transition: opacity 0.15s, transform 0.15s;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ small screens */

@media (max-width: 560px) {
  body { padding: 0 16px 32px; }
  .top { padding: 18px 0 18px; }
  .logo { font-size: 24px; }
  .logo svg { width: 36px; height: 36px; }
  .btn { padding: 0 12px; }
  .hero { padding: 18px 18px 20px; }
  .hero-date { font-size: 19px; }
  .steps { gap: 8px; }
  .steps .btn { flex: 1 1 auto; padding: 0 6px; min-width: 0; white-space: nowrap; font-size: 14px; }
  .zones { gap: 18px; }
}
