:root {
  color-scheme: light;
  --bg-1: #f6efe0;
  --bg-2: #e7f1e8;
  --ink: #0b1320;
  --muted: #516173;
  --accent: #1f7a8c;
  --accent-2: #f2b705;
  --danger: #d1495b;
  --success: #1b9aaa;
  --card: #fff7ea;
  --shadow: 0 24px 60px rgba(11, 19, 32, 0.18);
  --radius: 24px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 20%, rgba(242, 183, 5, 0.22), transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(31, 122, 140, 0.18), transparent 45%),
    linear-gradient(130deg, var(--bg-1), var(--bg-2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.25) 0,
      rgba(255, 255, 255, 0.25) 1px,
      transparent 1px,
      transparent 6px
    );
  opacity: 0.15;
}

.app {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: rise 500ms ease both;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent);
  color: #f7f3ea;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 26px rgba(31, 122, 140, 0.3);
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat {
  background: rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  padding: 10px 16px;
  min-width: 96px;
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px rgba(11, 19, 32, 0.12);
}

.stat-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
}

.app-main {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.primary-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quiz-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.quiz-card::after {
  content: "";
  position: absolute;
  inset: -50% -30% auto auto;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(31, 122, 140, 0.22), transparent 70%);
  opacity: 0.5;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.chip.alt {
  background: rgba(242, 183, 5, 0.18);
  color: #8a5a00;
}

.chip.offtopic {
  background: rgba(209, 73, 91, 0.12);
  color: #8a1d2d;
}

#question {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0;
  position: relative;
  z-index: 1;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  position: relative;
  z-index: 1;
}

.option,
.btn {
  border: none;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.option {
  background: #fdfcf8;
  box-shadow: 0 12px 24px rgba(11, 19, 32, 0.12);
  animation: fadeIn 400ms ease both;
  animation-delay: calc(var(--i) * 80ms);
}

.option:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(11, 19, 32, 0.18);
}

.option.correct {
  background: var(--success);
  color: #f2f7f6;
}

.option.wrong {
  background: var(--danger);
  color: #fdf3f4;
}

.option.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback {
  min-height: 24px;
  font-weight: 600;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.feedback.good {
  color: var(--success);
}

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

.panel-block {
  background: rgba(255, 255, 255, 0.75);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 14px 30px rgba(11, 19, 32, 0.1);
  backdrop-filter: blur(10px);
}

.panel-block h3 {
  margin-top: 0;
  font-family: var(--font-display);
}

.muted {
  color: var(--muted);
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analysis-item {
  background: rgba(11, 19, 32, 0.06);
  border-radius: 14px;
  padding: 10px 12px;
}

.analysis-line {
  margin: 12px 0 0;
  font-size: 13px;
}

.analysis-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.log-entry {
  background: rgba(11, 19, 32, 0.05);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

.log-entry.good {
  border-left: 3px solid var(--success);
}

.log-entry.bad {
  border-left: 3px solid var(--danger);
}

.icon-button {
  border: none;
  background: rgba(11, 19, 32, 0.08);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(11, 19, 32, 0.12);
}

.icon-button:hover {
  transform: translateY(-1px);
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-weight: 600;
  color: var(--ink);
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-panel {
  position: absolute;
  right: 0;
  top: 0;
  width: min(420px, 100%);
  max-height: calc(100vh - 120px);
  overflow: auto;
  display: none;
  background: rgba(255, 255, 255, 0.94);
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(11, 19, 32, 0.18);
  z-index: 4;
}

.settings-panel.open {
  display: flex;
}

.analysis-card {
  box-shadow: 0 14px 30px rgba(11, 19, 32, 0.1);
}

.analysis-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.select-line {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 6px;
}

.select {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(11, 19, 32, 0.05);
  font-family: var(--font-body);
}

.select-compact {
  max-width: 220px;
}

.set-control {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.set-hint {
  margin: 0;
}

.set-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.set-stat {
  background: rgba(11, 19, 32, 0.06);
  border-radius: 14px;
  padding: 10px 12px;
}

.set-control .select-line {
  margin-top: 8px;
}

.actions {
  display: grid;
  gap: 10px;
  margin: 16px 0 8px;
}

.toggle-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.btn.toggle {
  background: rgba(11, 19, 32, 0.08);
  color: var(--ink);
}

.btn.toggle.active {
  background: var(--accent);
  color: #f2f7f6;
  box-shadow: 0 12px 26px rgba(31, 122, 140, 0.3);
}

.btn {
  text-align: center;
  font-weight: 600;
}

.btn.primary {
  background: var(--accent);
  color: #f2f7f6;
}

.btn.secondary {
  background: rgba(31, 122, 140, 0.14);
  color: var(--accent);
}

.btn.ghost {
  background: rgba(209, 73, 91, 0.12);
  color: var(--danger);
}

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

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0;
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 960px) {
  .options {
    grid-template-columns: 1fr;
  }

  .toggle-group {
    grid-template-columns: 1fr;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    inset: 96px 12px auto 12px;
    width: auto;
    max-height: calc(100vh - 120px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
