/* GW2 Timer. Dark by default with a light theme; the RadMage Labs look shared with D4 Tracker.
   System fonts only, so the page makes no outside requests. */

:root {
  --bg: #0d0e11;
  --surface: #15171b;
  --surface-2: #1c1f24;
  --line: #2a2e35;
  --line-strong: #3b4048;
  --text: #ebe7df;
  --text-dim: #a8a297;
  --text-faint: #8d877c;
  --boss: #d9a441;
  --boss-soft: rgba(217, 164, 65, 0.14);
  --boss-glow: rgba(217, 164, 65, 0.5);
  --meta: #3fb8a6;
  --meta-soft: rgba(63, 184, 166, 0.13);
  --meta-glow: rgba(63, 184, 166, 0.45);
  --day: #e8c66a;
  --night: #8ea2d8;
  --ok: #7cc48a;
  --warn: #e6b450;
  --focus: #f0c674;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f7f5f0;
  --line: #e0dcd4;
  --line-strong: #c9c2b7;
  --text: #1c1a17;
  --text-dim: #57524b;
  --text-faint: #6f695f;
  --boss: #8f630c;
  --boss-soft: rgba(143, 99, 12, 0.10);
  --boss-glow: rgba(143, 99, 12, 0.32);
  --meta: #0f7468;
  --meta-soft: rgba(15, 116, 104, 0.10);
  --meta-glow: rgba(15, 116, 104, 0.30);
  --day: #846500;
  --night: #3d528f;
  --ok: #2f7d3e;
  --warn: #85590a;
  --focus: #85590a;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -40px; z-index: 10;
  padding: 6px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-strong);
}
.skip:focus { top: 8px; }

/* Header */

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.brand h1 { margin: 0; font: 600 21px/1.2 var(--serif); letter-spacing: 0.02em; white-space: nowrap; }
.brand .tag { color: var(--text-faint); font-size: 12px; }
.brand .tag a { color: var(--text-dim); text-decoration: none; }
.brand .tag a:hover { text-decoration: underline; }
.clock { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.clock .now { font-size: 19px; font-weight: 600; }
.clock .sub { color: var(--text-faint); font-size: 12px; }
.tools { display: flex; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface-2); cursor: pointer; font-size: 13px; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-faint); }
.btn[aria-pressed="true"] { border-color: var(--focus); color: var(--text); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.link-btn { min-height: 30px; border: 0; background: none; padding: 0 2px; color: var(--text-dim); text-decoration: underline; cursor: pointer; font-size: 13px; }

/* Layout */

main {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 16px 20px 28px;
  display: grid; gap: 18px; align-content: start;
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.notice-bar { margin: 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--warn); color: var(--warn); font-size: 13px; }
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.section-head h2 { margin: 0; font: 600 18px/1.2 var(--serif); letter-spacing: 0.02em; }
.section-head h2:focus { outline: none; }
.section-head .link-btn { margin-left: auto; }
.hint { color: var(--text-faint); font-size: 12.5px; }
.explain { margin: -2px 0 10px; color: var(--text-dim); font-size: 13px; max-width: 70ch; }
.empty { margin: 0; padding: 12px 14px; color: var(--text-faint); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Strip: day and night, resets */

.strip-list {
  list-style: none; margin: 0; padding: 10px 14px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px;
}
.strip-list li { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; min-width: 0; }
.strip-list .label { color: var(--text-faint); font-size: 12px; grid-column: 1 / -1; }
.strip-list .value { font-weight: 600; }
.strip-list .sub { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.strip-list .phase-day .value, .strip-list .phase-dawn .value { color: var(--day); }
.strip-list .phase-night .value, .strip-list .phase-dusk .value { color: var(--night); }

/* Controls */

.controls { padding: 12px 14px; display: grid; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  min-height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text-dim);
}
.seg-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); border-color: var(--focus); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 28px; padding: 0 10px; border-radius: 999px; cursor: pointer; font-size: 12.5px;
  border: 1px solid var(--line); background: transparent; color: var(--text-faint); text-decoration: line-through;
}
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.field select, .field input {
  min-height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text);
}

/* Happening now: cards. The active card breathes in its own color, as in D4 Tracker. */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.event {
  --accent: var(--meta); --accent-soft: var(--meta-soft); --accent-glow: var(--meta-glow);
  position: relative; overflow: hidden;
  padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.event[data-kind="world-boss"] { --accent: var(--boss); --accent-soft: var(--boss-soft); --accent-glow: var(--boss-glow); }
.event::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: 0.85; }
.event.is-active { border-color: var(--accent); animation: breathe 4.5s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 0 2px 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 1px var(--accent), 0 0 14px 1px var(--accent-glow); }
}
@media (prefers-reduced-motion: reduce) {
  .event.is-active { animation: none; box-shadow: 0 0 0 1px var(--accent); }
}
.event-head { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: -6px; }
.event-head h3 { margin: 0; font: 600 16.5px/1.25 var(--serif); letter-spacing: 0.01em; min-width: 0; overflow-wrap: anywhere; }
.pill {
  margin-left: auto; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  color: var(--accent); border: 1px solid var(--accent); background: var(--accent-soft);
}
.where { margin: 0; color: var(--text-dim); font-size: 13px; }
.countdown { margin: 0; font-variant-numeric: tabular-nums; }
.countdown .big { font-weight: 600; }
.countdown .since { color: var(--text-faint); font-size: 12.5px; }
.note { margin: 0; color: var(--text-faint); font-size: 12.5px; }

.badges, .line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.line1 { margin-left: -6px; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--text-dim);
}
.badge.kind-world-boss { color: var(--boss); border-color: color-mix(in srgb, var(--boss) 55%, transparent); }
.badge.kind-meta { color: var(--meta); border-color: color-mix(in srgb, var(--meta) 55%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 65%, transparent); cursor: help; }
.badge.adjusted { color: var(--text); border-color: var(--focus); }

.star-btn {
  min-width: 30px; min-height: 30px; padding: 0 4px; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--text-faint); font-size: 17px; line-height: 1; cursor: pointer;
}
.star-btn:hover { color: var(--text); border-color: var(--line); }
.star-btn.on { color: var(--focus); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* Coming up: rows */

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row {
  --accent: var(--meta);
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; background: var(--surface);
}
.row[data-kind="world-boss"] { --accent: var(--boss); }
.row .when { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; line-height: 1.25; }
.row .t { font-weight: 600; font-size: 15.5px; }
.row .utc { color: var(--text-faint); font-size: 11.5px; }
.row .in { color: var(--text-dim); font-size: 12.5px; }
.row .name { font-weight: 600; overflow-wrap: anywhere; }
.row .line2 { color: var(--text-faint); font-size: 12.5px; }
.row .actions { margin-top: 0; justify-content: flex-end; }
.row .adjust-panel { grid-column: 1 / -1; }
.day-sep, .group {
  list-style: none; margin: 8px 0 0; padding: 0 2px; color: var(--text-faint);
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.group:first-child { margin-top: 0; }

.adjust-panel {
  margin-top: 6px; padding: 10px 12px; border-radius: 8px;
  border: 1px dashed var(--line-strong); background: var(--surface-2); display: grid; gap: 8px;
}
.adjust-panel p { margin: 0; font-size: 12.5px; color: var(--text-dim); }
.adjust-panel .adj-now { color: var(--text); }
.adj-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }

/* Compact: one tight line per event */

.compact .row { padding: 5px 10px; grid-template-columns: 96px minmax(0, 1fr) auto; }
.compact .row .line2, .compact .row .note, .compact .row .utc, .compact .event .note, .compact .event .where { display: none; }
.compact .row .actions .btn:not(.copy) { display: none; }
.compact .event { padding: 10px 12px 8px; }

/* News */

.news { padding: 14px 16px; }
.news-note { margin: 0 0 8px; color: var(--text-faint); font-size: 12.5px; }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.news-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.news-list a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.news-list a:hover { text-decoration: underline; }
.news-list time { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }

/* Footer, dialogs, toast */

.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 14px 20px 18px; color: var(--text-faint); font-size: 12.5px; text-align: center;
}
.site-footer p { margin: 4px auto; max-width: 900px; }
.site-footer a { color: var(--text-dim); }
.site-footer .revision { color: var(--text-dim); }
.legal { font-size: 11.5px; color: var(--text-faint); }

dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto;
  padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h2 { margin: 0 0 8px; font: 600 19px/1.2 var(--serif); }
dialog h3 { margin: 14px 0 4px; font-size: 14px; }
dialog p, dialog li { font-size: 13.5px; color: var(--text-dim); }
dialog a { color: var(--text); }
.dialog-close { float: right; margin: -4px -6px 0 8px; }
.hidden-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hidden-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px);
  max-width: calc(100vw - 24px); padding: 9px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Phones */

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  main { padding: 12px 12px 24px; gap: 14px; }
  .clock { margin-left: 0; text-align: left; }
  .tools { margin-left: auto; }
  .cards { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row .when { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
  .row .actions { justify-content: flex-start; }
  .compact .row { grid-template-columns: minmax(0, 1fr) auto; }
  .compact .row .when { grid-column: 1 / -1; }
}
