/* Tokens copied from phatic.pro (site-may-25/src/app/globals.css). */
@font-face {
  font-family: 'Outfit';
  src: url('/fonts/outfit.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 10.2%;
  --card: 0 0% 100%;
  --primary: 3 80% 60%;
  --primary-foreground: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --border: 240 5.9% 90%;
  --dot-color: 0 0% 88%;
  --warn: 35 92% 33%;
  --land: 240 5% 88%;
  --land-hover: 240 5% 78%;
  --radius: 0.5rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 7%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --border: 240 3.7% 15.9%;
    --dot-color: 0 0% 18%;
    --warn: 38 92% 62%;
    --land: 240 4% 22%;
    --land-hover: 240 4% 32%;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Outfit', ui-sans-serif, system-ui, sans-serif;
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  background-image: radial-gradient(circle at center, hsl(var(--dot-color)) 1px, transparent 1px);
  background-size: 30px 30px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(8px);
}
.header-row { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; color: inherit; text-decoration: none; }
.header-note { font-size: 0.875rem; color: hsl(var(--foreground) / 0.6); }

.hero { padding: 56px 0 24px; }
.eyebrow {
  margin: 0 0 12px; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: hsl(var(--primary));
}
h1 { margin: 0 0 20px; font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 200; letter-spacing: -0.02em; line-height: 1.05; }
h2 { margin: 0; font-size: 1.5rem; font-weight: 500; letter-spacing: -0.01em; }
.optional { font-size: 1rem; font-weight: 400; color: hsl(var(--muted-foreground)); }
.lede { margin: 0 0 20px; font-size: 1.25rem; max-width: 62ch; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 62ch; }
.facts li {
  display: flex; gap: 14px; align-items: flex-start; font-size: 1.125rem;
  padding: 14px 16px; border-radius: var(--radius);
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
}
.facts strong { font-weight: 600; }
.fact-icon { flex: none; color: hsl(var(--primary)); line-height: 0; margin-top: 2px; }
.muted { color: hsl(var(--muted-foreground)); }

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 2);
  padding: 24px;
  margin: 16px 0;
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.step-num {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; flex: none;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font-size: 1rem; font-weight: 600;
}
.instruction { margin: 0 0 16px; font-size: 1.125rem; max-width: 66ch; }
.instruction strong { font-weight: 600; }
.tip { margin: 0 0 12px; font-size: 0.95rem; color: hsl(var(--muted-foreground)); }
.grid-title { margin: 4px 0 8px; font-size: 1.0625rem; font-weight: 600; }

.input {
  width: 100%; font: inherit; color: inherit;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 10px 12px;
}
.input:focus-visible, button:focus-visible, .country:focus-visible {
  outline: 2px solid hsl(var(--primary)); outline-offset: 2px;
}
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.code-input { width: 100%; max-width: 30ch; font-size: 1.125rem; letter-spacing: 0.04em; padding: 10px 14px; }
.textarea { resize: vertical; min-height: 96px; }
.select { margin-top: 6px; max-width: 380px; font-size: 1rem; }
.field-msg { margin: 8px 0 0; font-size: 1rem; min-height: 1.3em; color: hsl(var(--muted-foreground)); }
.field-msg.error { color: hsl(var(--primary)); }
.field-msg.ok { color: hsl(142 60% 38%); }

/* Country search */
.search { position: relative; margin-bottom: 12px; }
#search { font-size: 1.0625rem; padding: 12px 14px; }
.results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: 0 8px 24px hsl(0 0% 0% / 0.12);
}
.results li { padding: 8px 10px; border-radius: calc(var(--radius) - 2px); cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: hsl(var(--muted)); }
.results .sub { color: hsl(var(--muted-foreground)); font-size: 0.875rem; }

/* Map */
.map-frame {
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--muted) / 0.5); overflow: hidden; position: relative;
}
#map { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 511; touch-action: pan-y; cursor: grab; }
#map.zoomed { touch-action: none; }
#map.panning { cursor: grabbing; }
.country { fill: hsl(var(--land)); stroke: hsl(var(--card)); stroke-width: 0.6; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill 120ms; }
.country:hover { fill: hsl(var(--land-hover)); }
.country.selected { fill: hsl(var(--primary)); }
.dot { fill: hsl(var(--muted-foreground) / 0.7); stroke: hsl(var(--card)); stroke-width: 0.6; vector-effect: non-scaling-stroke; cursor: pointer; }
.map-zoom { position: absolute; top: 10px; right: 10px; display: grid; gap: 4px; }
.map-btn, .region-btn {
  font: inherit; color: hsl(var(--foreground)); cursor: pointer;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: 0 1px 3px hsl(0 0% 0% / 0.12);
}
.map-btn { width: 38px; height: 38px; font-size: 1.375rem; line-height: 1; }
.map-btn:hover, .region-btn:hover { background: hsl(var(--muted)); }
.map-regions { position: absolute; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.region-btn { font-size: 0.875rem; padding: 5px 10px; }
.map-tip {
  position: absolute; inset: 0; margin: 0; display: grid; place-items: center; pointer-events: none;
  background: hsl(0 0% 0% / 0.45); color: #fff; font-size: 1.125rem;
}
.dot:hover { fill: hsl(var(--foreground)); }
.dot.selected { fill: hsl(var(--primary)); }

.place { margin-top: 16px; }
.place-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.place-country { margin: 0; font-size: 1.5rem; font-weight: 500; }
.zone-label { display: block; margin-top: 10px; font-size: 1rem; font-weight: 500; }
.clock {
  display: grid; text-align: right; padding: 8px 14px;
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
}
.clock-label { font-size: 0.875rem; color: hsl(var(--muted-foreground)); }
.clock-time { font-size: 2.5rem; font-weight: 300; line-height: 1.1; font-variant-numeric: tabular-nums; }
.clock-day { font-size: 0.875rem; color: hsl(var(--muted-foreground)); }
.check { margin: 14px 0 0; font-size: 1.125rem; font-weight: 500; }
.check .muted { font-weight: 400; }
.warn {
  margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid hsl(var(--warn) / 0.5); color: hsl(var(--warn)); font-size: 1rem;
}
.warn button { margin-left: 4px; }

/* Times */
.howto {
  margin-bottom: 18px; padding: 18px 20px; border-radius: var(--radius);
  background: hsl(var(--muted) / 0.7);
}
.howto-steps { margin: 0; padding: 0; list-style: none; counter-reset: how; display: grid; gap: 14px; }
.howto-steps li { counter-increment: how; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; row-gap: 8px; font-size: 1.125rem; align-items: start; }
.howto-steps li::before {
  content: counter(how); grid-row: span 2; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px;
  border: 1.5px solid hsl(var(--foreground) / 0.5); font-size: 0.95rem; font-weight: 600;
}
.howto-text strong { font-weight: 600; }
.howto-example { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.howto-example .pair { display: inline-flex; align-items: center; gap: 10px; font-size: 1rem; color: hsl(var(--muted-foreground)); }
.howto-example strong { color: hsl(var(--foreground)); }
.mini-cell { display: inline-block; width: 40px; height: 24px; border-radius: 4px; border: 1px solid; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 999px; font-weight: 600; font-size: 0.95em; white-space: nowrap; }
.tag.best { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.tag.ok { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); border: 1px dashed hsl(var(--primary) / 0.7); }
.howto-more { margin: 14px 0 0; font-size: 1.0625rem; font-weight: 500; }
.locked { margin: 0; padding: 24px; font-size: 1.0625rem; text-align: center; border: 1px dashed hsl(var(--border)); border-radius: var(--radius); color: hsl(var(--muted-foreground)); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.brushes { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: hsl(var(--muted)); }
.brush {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font: inherit; font-size: 1.0625rem; color: hsl(var(--muted-foreground));
  background: transparent; border: 0; border-radius: calc(var(--radius) - 2px); padding: 8px 14px; cursor: pointer;
}
.brush[aria-checked="true"] { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: 0 1px 2px hsl(0 0% 0% / 0.1); }
.swatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid hsl(var(--border)); }
.swatch.best, .cell.best, .mini-cell.best { background: hsl(var(--primary)); border-color: hsl(var(--primary)); }
.swatch.ok, .cell.ok, .mini-cell.ok {
  background: repeating-linear-gradient(135deg, hsl(var(--primary) / 0.45) 0 3px, hsl(var(--primary) / 0.15) 3px 6px);
  border-color: hsl(var(--primary) / 0.6);
}
.swatch.clear { background: hsl(var(--background)); }
.link-btn { font: inherit; font-size: 1rem; color: hsl(var(--muted-foreground)); background: none; border: 0; padding: 4px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: hsl(var(--foreground)); }

.grid-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.grid {
  display: grid; grid-template-columns: 3.25rem repeat(7, minmax(36px, 1fr));
  gap: 3px; min-width: 300px; user-select: none; -webkit-user-select: none;
}
.grid.dragging { touch-action: none; }
.day-head {
  font: inherit; font-size: 0.95rem; font-weight: 600; color: hsl(var(--foreground));
  background: none; border: 0; padding: 6px 0; cursor: pointer; border-radius: 4px;
}
.day-head:hover { background: hsl(var(--muted)); }
.time-label { font-size: 0.875rem; color: hsl(var(--muted-foreground)); text-align: right; padding-right: 6px; line-height: 26px; font-variant-numeric: tabular-nums; }
.time-label.half { opacity: 0.55; }
.cell {
  height: 26px; padding: 0; border-radius: 4px; cursor: pointer;
  border: 1px solid hsl(var(--border)); background: hsl(var(--background));
}
.cell:hover { border-color: hsl(var(--primary) / 0.7); }
.cell.off { background: transparent; border-style: dashed; border-color: hsl(var(--border) / 0.6); cursor: default; }
.gap-row {
  grid-column: 1 / -1; text-align: center; font-size: 0.875rem; color: hsl(var(--muted-foreground));
  padding: 6px 0; border-top: 1px dashed hsl(var(--border)); border-bottom: 1px dashed hsl(var(--border)); margin: 4px 0;
}
.count { margin: 12px 0 0; font-size: 1rem; color: hsl(var(--muted-foreground)); min-height: 1.3em; }
.note {
  margin-top: 20px; padding: 16px 18px; border-radius: var(--radius);
  background: hsl(var(--warn) / 0.08); border: 1px solid hsl(var(--warn) / 0.35); font-size: 1.0625rem;
}
.note-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: hsl(var(--warn)); }
.shift { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.shift b { font-weight: 600; }
.note p { margin: 0 0 8px; }
.note p:last-child { margin: 0; }

.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }
.btn {
  font: inherit; font-weight: 500; color: hsl(var(--primary-foreground)); background: hsl(var(--primary));
  font-size: 1.125rem; border: 0; border-radius: var(--radius); padding: 14px 28px; cursor: pointer;
}
.btn:hover { filter: brightness(0.95); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.submit-row .field-msg { margin: 0; }

.done h2 { margin-bottom: 8px; }
.foot { font-size: 0.8rem; padding: 16px 0 48px; }

@media (max-width: 560px) {
  .card { padding: 18px 14px; }
  .hero { padding-top: 36px; }
  .grid { grid-template-columns: 2.75rem repeat(7, minmax(30px, 1fr)); gap: 2px; }
  .time-label { font-size: 0.8rem; }
  .day-head { font-size: 0.85rem; }
  .howto { padding: 14px; }
  .howto-steps li { font-size: 1.0625rem; }
  .facts li { font-size: 1.0625rem; }
  .map-regions { position: static; padding: 8px; border-top: 1px solid hsl(var(--border)); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .brushes { display: flex; }
  .brush { flex: 1; justify-content: center; padding: 8px 6px; font-size: 1rem; }
  #clear-all { align-self: flex-end; }
  .clock { text-align: left; }
}
