:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1c2530;
  --muted: #6b7785;
  --line: #e3e7ec;
  --brand: #3a5bd9;
  --brand-dark: #2c46ad;
  --danger: #c23a3a;
  --success: #2e7d4f;
  --live: #2e7d4f;
  --pending: #b07a1e;
  --ended: #6b7785;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 45, 0.08), 0 6px 20px rgba(20, 30, 45, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.brand span { color: var(--brand); }
.site-header nav { display: flex; align-items: center; gap: 1rem; }

.container { max-width: 920px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }

/* Footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1.5rem;
}

/* Hero / landing */
.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.4rem; margin: 0 0 0.5rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 540px; margin: 0 auto 1.5rem; }
.cta-row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.feature h3 { margin: 0 0 0.4rem; }
.feature p { margin: 0; color: var(--muted); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h1 { margin-top: 0; }
.card hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
input, textarea {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea { resize: vertical; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: rgba(58, 91, 217, 0.08); color: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #a32f2f; border-color: #a32f2f; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.linkbtn { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
.table th { background: #fafbfc; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.status-live { background: rgba(46, 125, 79, 0.12); color: var(--live); }
.status-pending { background: rgba(176, 122, 30, 0.12); color: var(--pending); }
.status-ended { background: rgba(107, 119, 133, 0.14); color: var(--ended); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 8px; background: #eef1f6; margin: 0 0 1rem; }
.alert.success { background: rgba(46, 125, 79, 0.12); color: var(--success); }
.alert.error { background: rgba(194, 58, 58, 0.1); color: var(--danger); }

/* QR + share */
.qr { width: 200px; max-width: 100%; margin: 0.5rem 0 1rem; }
.qr svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.copyfield input { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

/* Questions */
.questions { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.75rem; }
.question {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.question.is-answered { border-left-color: var(--success); opacity: 0.7; }
.question.is-answered .q-text { text-decoration: line-through; }
.q-body { flex: 1; }
.q-text { margin: 0 0 0.3rem; font-size: 1.05rem; }
.q-meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.question form { margin: 0; }
.q-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.presenter-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 0.4rem; }

/* Icon buttons */
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #266a42; border-color: #266a42; }
.btn-icon { padding: 0.45rem; line-height: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon svg { width: 18px; height: 18px; display: block; }

.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 2rem; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.error-code { font-size: 3rem; margin: 0; }
