/* D2Reminder, "A · Refined". Tokens first; every page uses them. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0e1014;
  --side: #0b0d11;
  --panel: #161a21;
  --raised: #1c212b;
  --field: #0f1218;
  --line: #252b36;
  --text: #e7e9ee;
  --soft: #c5cad6;
  --muted: #8b93a5;
  --accent: #d4b25f;
  --accent-ink: #17130a;
  --accent-bg: #2a2212;
  --accent-line: #5a4620;
  --ok: #5cc98a;
  --ok-bg: #12261b;
  --ok-line: #1f4a30;
  --warn: #e6a43b;
  --warn-bg: #2a2212;
  --bad: #e5625e;
  --bad-bg: #2a1414;
  --bad-line: #5a2020;
  --blue: #8fb3de;
  --btn: #232936;
  --btn-line: #323a4a;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #e6c77a; }
code { font-family: var(--mono); font-size: 13px; background: var(--field); border: 1px solid #262c38; border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; }
pre { font-family: var(--mono); font-size: 13px; background: var(--field); border: 1px solid #262c38; border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0; color: var(--soft); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* --- Controls --- */
button, .button {
  font: inherit; font-size: 14px; color: var(--text); background: var(--btn); border: 1px solid var(--btn-line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; line-height: 1.3;
}
button:hover, .button:hover { border-color: var(--accent); color: var(--text); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.primary:hover, .button.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
button.chosen { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
button.danger { border-color: var(--bad-line); color: var(--bad); }
button.muted-on { border-color: var(--bad); color: var(--bad); }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--field); border: 1px solid var(--btn-line); border-radius: 6px; padding: 6px 9px;
}
input:focus, select:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent); }
input[type=number] { width: 72px; font-family: var(--mono); }
input.default { color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
input[type=range] { accent-color: var(--accent); width: 180px; padding: 0; border: 0; background: none; }
.segmented { display: inline-flex; }
.segmented button { border-radius: 0; }
.segmented button:first-child { border-radius: 8px 0 0 8px; }
.segmented button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--btn-line); color: var(--soft); font-size: 13px; }
.chip.accent { border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.tag { font-size: 11px; color: var(--warn); border: 1px solid var(--accent-line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--btn-line); transition: background 0.15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }

/* --- Layout: sidebar + top bar + content --- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; padding: 4px 12px 26px; color: var(--text); }
.brand span { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.sub { padding: 8px 12px 8px 42px; font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a.active { background: var(--raised); color: var(--text); font-weight: 600; }
.nav a.active svg { stroke: var(--accent); }
.nav.bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 36px; border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 24px; min-width: 0; }
.title { font-size: 18px; font-weight: 600; white-space: nowrap; }
.title span { color: var(--muted); font-weight: 400; }
.statuses { display: flex; gap: 8px; flex-wrap: wrap; }
.status { display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: var(--raised); border: 1px solid var(--btn-line); color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.status.ok i { box-shadow: 0 0 0 3px rgba(92, 201, 138, 0.18); }
.status.warn { background: var(--warn-bg); border-color: var(--accent-line); color: var(--warn); }
.status.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.profile { position: relative; }
.profile > button { border-radius: 999px; padding: 5px 12px 5px 5px; background: var(--panel); border-color: var(--line); gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: linear-gradient(135deg, #3d4a63, #1f2633); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--soft); }
.profile-text { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.profile-text b { font-size: 14px; }
.profile-text small { font-size: 12px; color: var(--ok); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 200px; z-index: 10; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); }
.menu a, .menu button { display: flex; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--text); font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--raised); }
.content { display: flex; flex-direction: column; gap: 20px; padding: 28px 36px 48px; max-width: 1280px; width: 100%; }
#view { display: flex; flex-direction: column; gap: 20px; }

/* --- Blocks --- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.split { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.banner { padding: 12px 16px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--accent-line); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.banner.bad span { color: var(--bad); }
.icon-chip { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; background: var(--raised); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.icon-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.icon-chip.small { width: 28px; height: 28px; border-radius: 7px; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .time { font-family: var(--mono); color: var(--soft); white-space: nowrap; }
.list-row.first .grow, .list-row.first .time { font-weight: 600; font-size: 17px; }
.list-row.first .time { color: var(--accent); }
.bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 2px; }
.bar div { height: 4px; border-radius: 2px; background: var(--accent); }
.empty { color: var(--muted); padding: 6px 0; }

/* Reminders page */
.match { flex-direction: row; align-items: center; gap: 22px; }
.portrait { width: 176px; height: 99px; flex-shrink: 0; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: linear-gradient(160deg, #2a3146, #161a24); display: flex; align-items: center; justify-content: center; }
.hero-name { font-size: 26px; font-weight: 700; line-height: 1.1; }
.clock-box { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.clock { font-family: var(--mono); font-size: 76px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sound { flex-direction: row; align-items: center; gap: 28px; flex-wrap: wrap; padding: 16px 24px; }
.sound label { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; }

/* Settings table */
.table-card { padding: 6px 24px 10px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .name { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.table .off { color: var(--muted); }
.table input.minutes { width: 64px; }
.table select { max-width: 260px; }
.table input.custom { display: block; width: 100%; min-width: 220px; margin-top: 6px; }

/* Presets page */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.preset-icons { display: flex; flex-wrap: wrap; gap: 6px; }

/* Setup page */
.steps { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.step { display: flex; gap: 18px; }
.step-num { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; background: var(--raised); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--soft); }
.step-num.done { background: var(--ok); color: var(--bg); }
.step .card { flex: 1; }
.step h3 { margin: 0; font-size: 17px; }
.note { border-left: 3px solid var(--warn); padding: 6px 10px; background: #1d1a12; font-size: 14px; border-radius: 0 6px 6px 0; }
details summary { cursor: pointer; color: var(--accent); }
textarea.copybuf { position: fixed; left: -9999px; }

/* Signed-out pages */
.public-top { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 48px; border-bottom: 1px solid var(--line); }
.public-top nav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.public-top nav a { color: var(--muted); }
.public-top nav a:hover { color: var(--text); }
.steam-button img { display: block; height: 30px; width: auto; }
.steam-button.large img { height: 44px; }
.footer { font-size: 13px; color: var(--muted); padding: 0 48px 40px; }
.footer a { color: var(--muted); }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; gap: 6px; }
  .brand { padding: 4px 8px; }
  .nav, .nav.bottom { flex-direction: row; flex-wrap: wrap; margin: 0; padding: 0; border: 0; }
  .nav a.sub { padding: 8px 12px; }
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; }
  .content { padding: 20px 16px 40px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .match { flex-direction: column; align-items: flex-start; }
  .clock-box { margin-left: 0; align-items: flex-start; }
  .clock { font-size: 56px; }
  .public-top { padding: 0 16px; }
}
