/* Global layout */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
}

body {
  background: radial-gradient(circle at top, #e0f2fe 0, #fee2e2 40%, #f1f5f9 100%);
}

/* App shell */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

/* Damage effect */

.app-shell.damage {
  animation: damage-shake 0.3s linear 1;
}

.app-shell.damage::before,
.app-shell.damage::after {
  content: "";
  position: fixed;
  top: 0;
  width: 14vw;
  max-width: 180px;
  height: 100vh;
  pointer-events: none;
  z-index: 998;
  background: linear-gradient(
    to right,
    rgba(248, 113, 113, 0.9),
    rgba(248, 113, 113, 0)
  );
}

.app-shell.damage::after {
  right: 0;
  left: auto;
  transform: scaleX(-1);
}

.app-shell.damage::before {
  left: 0;
}

@keyframes damage-shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-4px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Header */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: #64748b;
}

/* Main navigation for content pages */

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.main-nav a {
  text-decoration: none;
  color: #0f172a;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.4);
  transition:
    background 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.08s ease,
    border-color 0.12s ease;
}

.main-nav a:hover {
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  transform: translateY(-1px);
}

.main-nav a.active {
  background: #eff6ff;
  border-color: #3b82f6;
}

/* Settings button */

.settings-button {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 0.7rem;
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.09);
}

.settings-button:hover {
  background: rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.settings-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.15);
}

.settings-icon {
  width: 22px;
  height: 22px;
  fill: #0f172a;
}

/* Dropdown menu on practice page */

.menu-dropdown {
  position: relative;
}

.menu-toggle-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.menu-button {
  padding-inline: 0.6rem;
}

.menu-icon {
  width: 22px;
  height: 22px;
  fill: #0f172a;
}

.header-menu {
  position: absolute;
  right: 0;
  top: 120%;
  min-width: 220px;
  padding: 0.45rem 0.4rem;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
  z-index: 999;
}

.menu-toggle-checkbox:checked + .menu-button + .header-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.header-menu a {
  display: block;
  padding: 0.42rem 0.8rem;
  margin: 0.05rem 0;
  border-radius: 0.7rem;
  text-decoration: none;
  font-size: 0.9rem;
  color: #0f172a;
  white-space: nowrap;
}

.header-menu a:hover {
  background: #eff6ff;
}

/* Scoreboard */

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.score-pill {
  flex: 1 1 120px;
  min-width: 0;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.5rem;
}

.score-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #64748b;
}

.score-value {
  font-weight: 700;
  font-size: 1.1rem;
}

.score-correct .score-value {
  color: #16a34a;
}

.score-wrong .score-value {
  color: #e11d48;
}

.score-review .score-value {
  color: #0ea5e9;
}

/* Question card */

.card {
  margin-top: 0.3rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-radius: 1.5rem;
  padding: 1.5rem 1.4rem 1.6rem;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(148, 163, 184, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

/* Info card on landing */

.info-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.info-card p {
  margin: 0.2rem 0;
  font-size: 0.94rem;
  color: #1f2933;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
  margin-top: 0.7rem;
}

.info-item {
  padding: 0.9rem 1rem;
  border-radius: 1.1rem;
  background: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.info-item h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.info-item p {
  margin: 0;
  font-size: 0.9rem;
  color: #4b5563;
}

.info-bottom-text {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: #4b5563;
}

/* Play button */

.play-button {
  border-radius: 999px;
  border: none;
  padding: 0.7rem 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(22, 163, 74, 0.4);
  transition:
    transform 0.08s ease,
    box-shadow 0.12s ease,
    filter 0.2s ease;
}

.play-button.small {
  margin-top: 0.75rem;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
}

.play-button:disabled {
  cursor: default;
  opacity: 0.6;
  box-shadow: none;
}

.play-button:not(:disabled):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 16px 35px rgba(22, 163, 74, 0.5);
}

.play-button:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.5);
}

.play-icon {
  font-size: 1.1rem;
}

.play-text {
  white-space: nowrap;
}

/* Instruction line */

.instruction {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
  max-width: 280px;
}

/* Choices */

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.choice-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(248, 250, 252, 0.9);
  padding: 0.75rem 1rem;
  font-size: 0.98rem;
  cursor: pointer;
  text-align: center;
  font-weight: 500;
  color: #0f172a;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
  transition:
    background 0.13s ease,
    transform 0.08s ease,
    box-shadow 0.13s ease,
    border-color 0.13s ease;
}

.choice-btn:hover {
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
}

.choice-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}

.choice-btn.correct,
.choice-btn.correct-step {
  border-color: #22c55e;
  background: #ecfdf3;
}

.choice-btn.wrong,
.choice-btn.wrong-step {
  border-color: #ef4444;
  background: #fef2f2;
}

.choice-btn.disabled {
  pointer-events: none;
  opacity: 0.85;
}

/* Sentence reveal */

.sentence-reveal {
  min-height: 1.2rem;
  font-size: 0.95rem;
  color: #0f172a;
}

.sentence-reveal span.word-highlight {
  font-weight: 700;
  color: #0ea5e9;
}

/* Status line */

.status-line {
  min-height: 1.1rem;
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
}

/* Mode banner */

.mode-banner {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%) translateY(200%);
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  z-index: 997;
}

.mode-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Confetti */

#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  pointer-events: none;
  z-index: 999;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  background: #22c55e;
  border-radius: 2px;
  opacity: 0;
  transform: translate3d(0, 0, 0) rotateZ(0deg);
  animation: confetti-fall 1.15s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate3d(0, -10px, 0) rotateZ(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, 120vh, 0) rotateZ(360deg);
  }
}

/* Mode select panel */

.mode-select-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 996;
}

.mode-select-panel[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.mode-select-panel[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
}

.mode-select-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.mode-select-content {
  position: relative;
  z-index: 1;
  width: min(460px, 100% - 2.5rem);
  background: #ffffff;
  border-radius: 1.5rem;
  padding: 1.5rem 1.4rem 1.4rem;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.35);
}

.mode-select-content h2 {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
}

.mode-select-subtitle {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.mode-select-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.mode-select-card {
  flex: 1 1 180px;
  border-radius: 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.9rem 0.95rem;
  background: #f9fafb;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
  transition:
    box-shadow 0.15s ease,
    transform 0.08s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.mode-select-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.mode-select-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #4b5563;
}

.mode-select-card:hover {
  background: #ffffff;
  transform: translateY(-1px);
  border-color: #0ea5e9;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.mode-select-card.active {
  border-color: #0ea5e9;
  box-shadow: 0 16px 36px rgba(59, 130, 246, 0.35);
  background: #eff6ff;
}

/* Settings panel */

.settings-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 995;
  pointer-events: none;
}

.settings-panel[aria-hidden="true"] {
  visibility: hidden;
}

.settings-panel[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.settings-panel[aria-hidden="false"] .settings-backdrop {
  opacity: 1;
}

.settings-content {
  position: relative;
  z-index: 1;
  width: min(420px, 100% - 2.5rem);
  background: #ffffff;
  border-radius: 1.3rem;
  padding: 1.3rem 1.3rem 1.25rem;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
  transform: translateY(35px);
  opacity: 0;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}

.settings-panel[aria-hidden="false"] .settings-content {
  transform: translateY(0);
  opacity: 1;
}

.settings-content h2 {
  margin: 0 0 0.9rem;
  font-size: 1.15rem;
}

.settings-group {
  margin-bottom: 0.8rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.settings-row input[type="number"] {
  width: 80px;
  padding: 0.3rem 0.4rem;
  border-radius: 0.55rem;
  border: 1px solid #cbd5f5;
  font-size: 0.9rem;
}

.settings-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.settings-row select {
  width: 170px;
  padding: 0.32rem 0.4rem;
  border-radius: 0.55rem;
  border: 1px solid #cbd5f5;
  font-size: 0.9rem;
}

.settings-help {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: #6b7280;
}

/* Buttons */

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
}

.btn.primary {
  background: #0f766e;
  color: #ecfeff;
}

.btn.primary:hover {
  background: #0d6962;
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn.secondary:hover {
  background: #d1d5db;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Wrong answer popup */

.wrong-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 994;
  pointer-events: none;
}

.wrong-popup[aria-hidden="true"] {
  visibility: hidden;
}

.wrong-popup[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
}

.wrong-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.wrong-popup[aria-hidden="false"] .wrong-popup-backdrop {
  opacity: 1;
}

.wrong-popup-content {
  position: relative;
  z-index: 1;
  width: min(480px, 100% - 2.5rem);
  background: #fef2f2;
  border-radius: 1.3rem;
  padding: 1.2rem 1.3rem 1.2rem;
  box-shadow: 0 22px 48px rgba(153, 27, 27, 0.35);
  transform: translateY(35px);
  opacity: 0;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
  border: 1px solid rgba(248, 113, 113, 0.7);
}

.wrong-popup[aria-hidden="false"] .wrong-popup-content {
  transform: translateY(0);
  opacity: 1;
}

.wrong-popup-content h2 {
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  color: #991b1b;
}

/* Columns and blocks inside popup */

.wrong-popup-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.45rem;
}

.wrong-popup-block {
  flex: 1 1 200px;
  background: #ffffff;
  border-radius: 1rem;
  padding: 0.75rem 0.9rem 0.85rem;
  box-shadow: 0 10px 24px rgba(148, 27, 27, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.wrong-popup-block-title {
  margin: 0 0 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b91c1c;
}

.wrong-popup-sentence {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #111827;
}

.wrong-popup-sentence .word-highlight {
  font-weight: 700;
  color: #0ea5e9;
}

.wrong-popup-word-label {
  margin: 0.35rem 0 0.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b91c1c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wrong-popup-word {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #b91c1c;
}

.wrong-popup-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

/* Tables for examples pages */

.pair-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.pair-table th,
.pair-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  text-align: left;
}

.pair-table th {
  font-weight: 600;
  color: #0f172a;
  background: rgba(248, 250, 252, 0.9);
}

/* Content page card headings */

.content-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
}

.content-card h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}

.content-card p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  color: #111827;
}

.content-card ul {
  margin: 0.25rem 0 0.5rem 1.2rem;
  padding: 0;
  font-size: 0.93rem;
  color: #111827;
}

/* Footer */

.site-footer {
  margin-top: 1.4rem;
  font-size: 0.82rem;
  color: #6b7280;
  text-align: center;
}

.site-footer a {
  color: #0f766e;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Cookie banner */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  z-index: 900;
}

.cookie-banner p {
  margin: 0;
  font-size: 0.82rem;
  max-width: 640px;
}

.cookie-banner a {
  color: #bfdbfe;
  text-decoration: underline;
}

.cookie-banner .cookie-accept {
  white-space: nowrap;
  font-size: 0.82rem;
}

/* Responsive tweaks */

@media (max-width: 640px) {
  .app-shell {
    padding: 1rem;
  }

  .brand h1 {
    font-size: 1.3rem;
  }

  .card {
    padding: 1.1rem 1rem 1.2rem;
    border-radius: 1.2rem;
  }

  .instruction {
    max-width: 100%;
  }

  .play-button {
    width: 100%;
    justify-content: center;
  }

  .wrong-popup-content {
    padding: 1.1rem 1.1rem 1.1rem;
  }

  .wrong-popup-columns {
    flex-direction: column;
  }

  .main-nav {
    width: 100%;
  }

  .header-menu {
    right: 0;
  }

  .cookie-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}
