/* ============================================================
   Q&A Board — exhibition stand interactive wall
   Neutral mechanic-first styling; brand styling comes later.
   ============================================================ */

:root {
  --font: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  /* Wall (dark) theme */
  --wall-bg: #0e1626;
  --wall-surface: #182238;
  --wall-surface-2: #1e2a44;
  --wall-border: rgba(255, 255, 255, 0.09);
  --wall-text: #f1f5fb;
  --wall-muted: #93a4c0;
  --wall-accent: #4cc3ff;
  --wall-accent-soft: rgba(76, 195, 255, 0.14);

  /* Light theme (guest + admin) */
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #dde4ee;
  --text: #101828;
  --muted: #5b6b85;
  --accent: #0b6bcb;
  --accent-soft: #e8f1fc;
  --accent-text: #0b6bcb;

  --success: #0e8a4f;
  --success-soft: #e4f5ec;
  --danger: #c5223c;
  --danger-soft: #fde9ed;
  --warning: #b25e09;
  --warning-soft: #fdf1e2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --focus-ring: 0 0 0 3px rgba(11, 107, 203, 0.28);
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Shared controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: #0a5fb4; }
.btn-primary:disabled { background: #9fb8d4; cursor: not-allowed; }

.btn-success { background: var(--success); color: #ffffff; }
.btn-success:hover { background: #0c7442; }

.btn-danger { background: #ffffff; color: var(--danger); border-color: #eeb6c0; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-quiet {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}
.btn-quiet:hover { background: #f1f4f9; }

.btn-sm { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.field .hint {
  font-size: 12.5px;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="password"],
.field textarea,
.field select {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.15s ease;
}

.field textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus-ring);
}

.char-counter {
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
  margin-top: -2px;
}

.char-counter.over { color: var(--danger); font-weight: 600; }

.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
  cursor: pointer;
}

.checkline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: none;
  accent-color: var(--accent);
}

.notice {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.5;
}

.notice-error { background: var(--danger-soft); color: #7a1626; border: 1px solid #f3c3cd; }
.notice-ok { background: var(--success-soft); color: #0b5c38; border: 1px solid #bfe4d0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-approved { background: var(--success-soft); color: var(--success); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: #eef2f8; color: var(--muted); }

/* ---------- Guest page ---------- */

.guest-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.guest-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 26px;
}

.guest-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

.guest-card .subtitle {
  margin: 0 0 20px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 11px 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.guest-form { display: flex; flex-direction: column; gap: 16px; }

.guest-form .actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guest-form .btn { width: 100%; padding: 13px 18px; font-size: 16px; }

.success-box { text-align: center; padding: 26px 6px; }

.success-box .mark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.success-box h2 { margin: 0 0 10px; font-size: 20px; }

.success-box p { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.55; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: underline;
  padding: 4px;
}

/* ---------- Admin page ---------- */

.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.admin-login .guest-card { max-width: 420px; }

.admin-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 16px 60px;
}

.admin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-top h1 { margin: 0; font-size: 21px; flex: 1 1 auto; }

.admin-top .spacer { flex: 1 1 auto; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.filters select,
.filters input[type="text"] {
  font-family: inherit;
  font-size: 14.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: #ffffff;
  color: var(--text);
}

.filters input[type="text"] { flex: 1 1 200px; min-width: 140px; }

.filter-count {
  margin-left: auto;
  font-size: 13.5px;
  color: var(--muted);
}

.filter-count strong { color: var(--warning); }

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.q-card.is-new { border-color: var(--warning); box-shadow: 0 0 0 1px var(--warning); }

.q-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.q-head .meta {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.q-text {
  margin: 0 0 10px;
  font-size: 16.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.q-text .guest-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.q-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.q-rejected-reason {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.answers-block {
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.answers-block .answers-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.answer-row .answer-text {
  flex: 1 1 260px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.answer-row .answer-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.answer-row .answer-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 46px 20px;
  font-size: 15px;
  line-height: 1.5;
}

.sync-note {
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
  margin-top: 10px;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 22, 38, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  z-index: 50;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(14, 22, 38, 0.35);
  width: 100%;
  max-width: 560px;
  padding: 22px 24px;
}

.modal h3 { margin: 0 0 16px; font-size: 18px; }

.modal .field { margin-bottom: 14px; }

.modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.hidden { display: none !important; }

/* ---------- Wall / screen page ---------- */

.wall {
  min-height: 100vh;
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(76, 195, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(76, 195, 255, 0.07), transparent 55%),
    var(--wall-bg);
  color: var(--wall-text);
  padding: 30px clamp(18px, 3.5vw, 56px) 110px;
}

.wall-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto 30px;
}

.wall-title { flex: 1 1 420px; min-width: 280px; }

.wall-title h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-weight: 800;
}

.wall-title p {
  margin: 0;
  color: var(--wall-muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.5;
  max-width: 560px;
}

.wall-qr {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--wall-surface);
  border: 1px solid var(--wall-border);
  border-radius: 16px;
  padding: 14px 20px 14px 14px;
}

.wall-qr img {
  width: 116px;
  height: 116px;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px;
  display: block;
}

.wall-qr .qr-copy { max-width: 210px; }

.wall-qr .qr-copy strong {
  display: block;
  font-size: 15.5px;
  margin-bottom: 5px;
}

.wall-qr .qr-copy span {
  display: block;
  font-size: 13px;
  color: var(--wall-muted);
  line-height: 1.45;
}

.wall-grid {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 360px);
}

.q-tile {
  background: var(--wall-surface);
  border: 1px solid var(--wall-border);
  border-radius: 16px;
  padding: 20px 22px;
  animation: tile-in 0.35s ease both;
  display: flex;
  flex-direction: column;
}

@keyframes tile-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.q-tile .q-tile-text {
  margin: 0 0 12px;
  font-size: clamp(18px, 1.9vw, 23px);
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
  flex: 1 1 auto;
}

.q-tile .q-tile-meta {
  font-size: 13px;
  color: var(--wall-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.q-tile .q-tile-meta .edited-mark { color: var(--wall-accent); }

.answers-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--wall-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answers-list li {
  background: var(--wall-surface-2);
  border: 1px solid var(--wall-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.5;
}

.answers-list .answer-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--wall-accent);
  margin-bottom: 3px;
}

.wall-empty {
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
  padding: 70px 20px;
  color: var(--wall-muted);
  font-size: 18px;
  line-height: 1.6;
}

.wall-empty strong { color: var(--wall-text); display: block; font-size: 24px; margin-bottom: 8px; }

.wall-status {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--wall-muted);
  background: rgba(14, 22, 38, 0.9);
  border-top: 1px solid var(--wall-border);
  z-index: 40;
}

.wall-offline {
  max-width: 1440px;
  margin: 0 auto 20px;
  background: rgba(197, 34, 60, 0.16);
  border: 1px solid rgba(197, 34, 60, 0.5);
  color: #ffd7de;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14.5px;
}

/* ---------- Guest: choice landing ---------- */

.choice-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.choice-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 26px;
}

.choice-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

.choice-card .subtitle {
  margin: 0 0 22px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
}

.choice-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.05s ease;
}

.choice-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice-option:active { transform: translateY(1px); }

.choice-option .choice-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.choice-option .choice-copy { flex: 1 1 auto; min-width: 0; }

.choice-option .choice-copy strong {
  display: block;
  font-size: 16.5px;
  margin-bottom: 3px;
  color: var(--text);
}

.choice-option .choice-copy span {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}

.choice-option .choice-arrow {
  flex: none;
  color: var(--muted);
  display: inline-flex;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 2px;
  margin-bottom: 14px;
  cursor: pointer;
  text-decoration: none;
}

.back-link:hover { color: var(--accent); }

/* ---------- Guest: solve (question grid) ---------- */

.solve-shell {
  min-height: 100vh;
  padding: 24px 16px 60px;
}

.solve-inner {
  max-width: 860px;
  margin: 0 auto;
}

.solve-inner h1 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
}

.solve-inner .subtitle {
  margin: 0 0 16px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
}

.solve-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.solve-toolbar input[type="text"] {
  flex: 1 1 180px;
  min-width: 130px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  background: #ffffff;
  color: var(--text);
}

.solve-toolbar select {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
}

.solve-count {
  font-size: 13px;
  color: var(--muted);
  margin: 0 2px 12px;
}

.solve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.solve-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease;
}

.solve-tile:hover { border-color: var(--accent); }
.solve-tile:active { transform: translateY(1px); }

.solve-tile .tile-text {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
  flex: 1 1 auto;
}

.solve-tile .tile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
}

.solve-tile .tile-meta .tile-answers {
  color: var(--accent-text);
  font-weight: 700;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 10px;
}

.solve-tile.is-answered { border-left: 4px solid var(--accent); }

/* Answer modal on solve page */

.answer-modal-question {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.5;
  margin-bottom: 14px;
  color: var(--text);
}

.answer-modal-question .q-source {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .wall-grid { grid-template-columns: 1fr; }
  .wall-qr { width: 100%; }
  .q-tile .q-tile-text { font-size: 18px; }
  .admin-top .btn { flex: 1 1 auto; }
  .filters { flex-direction: column; align-items: stretch; }
  .filter-count { margin-left: 0; }
  .q-head .meta { margin-left: 0; width: 100%; }
}
