/* Question of the Day — light theme, friendly self-hosted font */

@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/quicksand-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/quicksand-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/quicksand-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/quicksand-700.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --font: 'Quicksand', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;

  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf7f0;
  --border: #e7decd;
  --ink: #2c2a26;
  --muted: #746f64;

  --accent: #6f42c1;
  --accent-ink: #ffffff;
  --accent-weak: #efeaf9;

  --ok: #2f8f5b;
  --warn: #b8862f;
  --danger: #c2492c;

  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 2px 8px rgba(44, 42, 38, 0.08);
  --shadow-lg: 0 10px 30px rgba(44, 42, 38, 0.18);

  /* category accents */
  --cat-serious: #4b6cb7;
  --cat-funny: #e08a2b;
  --cat-contemplative: #6f42c1;
  --cat-would_you_rather: #2f8f8f;
  --cat-food: #c2562f;
  --cat-icebreaker: #4f9a5b;
}

* { box-sizing: border-box; }

/* The hidden attribute must win even when a class sets display (e.g. .field). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 20px 64px;
}

/* top bar with identity chip */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 36px;
  gap: 8px;
}
.topbar-link {
  margin-right: auto;
  font-size: .85rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.topbar-link:hover { color: var(--accent); }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.chip strong { color: var(--ink); font-weight: 600; }
.chip button {
  border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0 0 0 6px;
}
.chip button:hover { text-decoration: underline; }

/* hero image */
.hero {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 6px auto 4px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: var(--surface-2);
}

h1 {
  text-align: center;
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 12px 0 4px;
  letter-spacing: -0.01em;
}
.subline {
  text-align: center;
  color: var(--muted);
  margin: 0 0 20px;
  min-height: 1.4em;
}
.subline strong { color: var(--ink); }
.day-hint {
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
  margin: -10px 0 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 16px 0;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

/* controls */
.controls-label { font-size: 0.85rem; color: var(--muted); margin: 0 0 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.12s ease;
}
.pill:hover { border-color: var(--accent); }
.pill[aria-pressed='true'] {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: none; border-color: transparent; color: var(--accent); padding-left: 6px; padding-right: 6px; }
.btn-danger { color: var(--danger); border-color: transparent; background: none; }
.btn-sm { padding: 6px 12px; font-size: 0.88rem; }

/* candidate cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: var(--shadow);
}
.card.is-today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.card-q { font-size: 1.08rem; font-weight: 500; margin: 0 0 12px; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.badge.cat-serious { background: var(--cat-serious); }
.badge.cat-funny { background: var(--cat-funny); }
.badge.cat-contemplative { background: var(--cat-contemplative); }
.badge.cat-would_you_rather { background: var(--cat-would_you_rather); }
.badge.cat-food { background: var(--cat-food); }
.badge.cat-icebreaker { background: var(--cat-icebreaker); }

/* today panel */
.today-q { font-size: 1.25rem; font-weight: 600; margin: 4px 0 10px; }
.meta { color: var(--muted); font-size: 0.9rem; }
.note-ok { color: var(--ok); font-size: 0.85rem; }

/* saved list */
.saved-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.saved-item:last-child { border-bottom: 0; }
.saved-text { flex: 1; }
.empty { color: var(--muted); font-style: italic; }

/* status / banner */
.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 0.92rem;
}
.banner-warn { background: #fbf3e0; border: 1px solid #ecd9a8; color: #7a5a16; }
.banner-error { background: #fbe8e3; border: 1px solid #f0c3b6; color: #8c3517; }
.hidden { display: none !important; }

/* spinner */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 3px solid var(--accent-weak); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { color: var(--muted); display: flex; gap: 10px; align-items: center; justify-content: center; padding: 20px; }

/* footer */
.gen-source { text-align: right; color: var(--muted); font-size: 0.78rem; margin: 4px 2px 0; }
.foot { text-align: center; margin-top: 28px; color: var(--muted); font-size: 0.9rem; }
.foot a { font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* modal / dialog */
.overlay {
  position: fixed; inset: 0; background: rgba(44, 42, 38, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 460px; width: 100%;
  padding: 22px;
}
.modal h3 { margin: 0 0 10px; font-size: 1.15rem; }
.modal p { margin: 0 0 16px; color: var(--ink); }
.modal .quote { background: var(--surface-2); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-weight: 500; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; color: var(--muted); }
select, input[type='text'], input[type='password'], input[type='date'], textarea {
  font: inherit; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
.panel-divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg); z-index: 60; font-size: 0.92rem; opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: var(--danger); }

/* history table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
td.day { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; margin-bottom: 4px; }

@media (min-width: 900px) {
  .wrap { max-width: 1080px; }
  .hero { max-width: 300px; }
  .page-columns {
    display: grid;
    grid-template-columns: 370px 1fr;
    gap: 20px;
    align-items: start;
  }
}

@media (max-width: 560px) {
  .wrap { padding: 12px 14px 56px; }
  .card-actions { gap: 6px; }
  th.who, td.who { display: none; }
}
