@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,550;9..144,700&family=Source+Sans+3:wght@400;600;700&display=swap");

:root {
  --bg0: #1a2332;
  --bg1: #243044;
  --ink: #f2efe8;
  --muted: #a8b3c4;
  --accent: #c4a35a;
  --accent-ink: #1a2332;
  --ok: #6fbf8a;
  --bad: #e07a6a;
  --line: rgba(242, 239, 232, 0.14);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --font-body: "Source Sans 3", "Source Sans Pro", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #3a4d6a 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #2c3b2f 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

.page {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.25rem 0 3rem;
}

.header {
  margin-bottom: 1.5rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-text {
  min-width: 0;
  flex: 1;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.side-toggle {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
}

.side-btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 0.55rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.side-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
}

.side-btn.is-active {
  background: rgba(196, 163, 90, 0.22);
  border-color: var(--accent);
  color: var(--ink);
}

.toolbar,
.filters,
.filter-row,
.filter-chips,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toolbar,
.filter-row {
  align-items: center;
  width: 100%;
  flex-wrap: nowrap;
}

.filter-chips {
  flex: 1 1 auto;
  min-width: 0;
  align-items: stretch;
}

body[data-controls="right"] .actions {
  justify-content: flex-end;
}

body[data-controls="left"] .actions {
  justify-content: flex-start;
}

body[data-controls="left"] .header-row {
  flex-direction: row-reverse;
}

.toolbar {
  margin-bottom: 0.75rem;
}

.filters {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.filter-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  flex: 0 0 4.75rem;
  width: 4.75rem;
}

.mode-btn,
.btn,
.option,
.filter-chip {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 0.55rem;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.12s ease;
}

.mode-btn,
.filter-chip {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

.mode-btn {
  padding: 0.7rem 0.9rem;
  font-weight: 600;
}

.filter-chip {
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.mode-btn:hover,
.btn:hover,
.option:hover:not(:disabled),
.filter-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
}

.mode-btn.is-active,
.filter-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.progress {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.95rem;
}

body[data-controls="right"] .progress {
  text-align: right;
}

body[data-controls="left"] .progress {
  text-align: left;
}

.card-panel {
  background: rgba(10, 16, 26, 0.45);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1.35rem 1.35rem 1.2rem;
  min-height: 14rem;
  backdrop-filter: blur(8px);
}

.status {
  margin: 0;
  color: var(--muted);
}

.question {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.2vw, 1.55rem);
  line-height: 1.35;
  font-weight: 550;
}

.answer,
.feedback {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  line-height: 1.5;
  white-space: pre-wrap;
}

.feedback.is-ok {
  color: var(--ok);
}

.feedback.is-bad {
  color: var(--bad);
}

.options {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.option {
  text-align: left;
  padding: 0.85rem 1rem;
  line-height: 1.4;
}

.option:disabled {
  cursor: default;
  opacity: 0.95;
}

.option.is-correct {
  border-color: var(--ok);
  background: rgba(111, 191, 138, 0.15);
}

.option.is-wrong {
  border-color: var(--bad);
  background: rgba(224, 122, 106, 0.15);
}

.actions {
  margin-top: 1rem;
}

.btn {
  padding: 0.75rem 1.05rem;
  font-weight: 600;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 1.25rem, 720px);
    padding-top: 1.5rem;
  }

  .card-panel {
    padding: 1.1rem;
  }

  .side-btn {
    padding: 0.55rem 0.7rem;
  }
}
