:root {
  --bg:             #1a1714;
  --surface:        #242018;
  --surface-raised: #2e2820;
  --border:         #3d3628;
  --border-soft:    #2e2820;
  --text:           #e8ddd0;
  --muted:          #7a6e60;
  --faint:          #4a4038;
  --parchment:      #fdf8f0;
  --parchment-text: #251d14;
  --gold:           #c9963a;
  --gold-bright:    #e0ad4a;
  --gold-dim:       rgba(201, 150, 58, 0.15);
  --gold-on:        #1a1208;
  --green:          #86c98a;
  --green-bg:       rgba(134, 201, 138, 0.07);
  --green-border:   rgba(134, 201, 138, 0.25);
  --red:            #d4726a;
  --red-bg:         rgba(212, 114, 106, 0.07);
  --red-border:     rgba(212, 114, 106, 0.25);
  --radius:         10px;
  --radius-sm:      6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1rem;
}

.app {
  width: 100%;
  max-width: 640px;
}

/* --- Home --- */

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding-top: 5rem;
}


.title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.25rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}

.title-accent {
  color: var(--gold-bright);
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.01em;
}

/* --- Mode buttons --- */

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 300px;
  margin-top: 0.5rem;
}

.mode-btn {
  width: 100%;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  letter-spacing: 0.02em;
}

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

.mode-btn.easy {
  background: #2e2618;
  color: #c4a96a;
  border: 1px solid rgba(196, 169, 106, 0.2);
}

.mode-btn.easy:hover {
  background: #382e1e;
  border-color: rgba(196, 169, 106, 0.4);
}

.mode-btn.medium {
  background: #3a2e10;
  color: #c9963a;
  border: 1px solid rgba(201, 150, 58, 0.25);
}

.mode-btn.medium:hover {
  background: #453615;
  border-color: rgba(201, 150, 58, 0.45);
}

.mode-btn.hard {
  background: #2e1e14;
  color: #c07a5a;
  border: 1px solid rgba(192, 122, 90, 0.2);
}

.mode-btn.hard:hover {
  background: #3a2518;
  border-color: rgba(192, 122, 90, 0.4);
}

/* --- Play again button --- */

.play-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  background: var(--gold);
  color: var(--gold-on);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.play-btn:hover {
  background: var(--gold-bright);
}

/* --- Loading / Error --- */

.loading, .error {
  text-align: center;
  padding-top: 6rem;
  color: var(--muted);
}

.error-detail {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--red);
}

/* --- Round --- */

.round {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.round-counter {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.round-score {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.text-block {
  background: var(--parchment);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--parchment-text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--gold);
}

/* --- Easy mode option buttons --- */

.option-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-btn {
  width: 100%;
  padding: 0.8rem 1.1rem;
  font-size: 0.975rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.option-btn:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.option-btn.selected {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-bright);
  font-weight: 600;
}

.combobox-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* --- Selected language chip --- */

.combobox-wrapper {
  position: relative;
}

.selected-chip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.9rem;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.selected-chip-label {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.selected-chip-clear {
  pointer-events: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.selected-chip-clear:hover {
  color: var(--text);
}

/* --- Submit button --- */

.submit-btn {
  width: 100%;
  padding: 0.7rem;
  font-size: 0.975rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  background: var(--gold);
  color: var(--gold-on);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.submit-btn:hover:not(:disabled) {
  background: var(--gold-bright);
}

.submit-btn:disabled {
  background: var(--surface);
  color: var(--faint);
  border: 1px solid var(--border-soft);
  cursor: not-allowed;
}

/* --- Feedback --- */

.feedback {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid transparent;
  border-left-width: 3px;
}

.feedback.correct {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
  border-left-color: var(--green);
}

.feedback.wrong {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
  border-left-color: var(--red);
}

.feedback-header {
  font-size: 1.05rem;
  font-weight: 600;
}

.score-axis {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  row-gap: 0.2rem;
  align-items: center;
}

.axis-name {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  opacity: 0.65;
  position: relative;
  cursor: help;
}

.axis-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.axis-fill {
  height: 100%;
  background: currentColor;
  border-radius: 3px;
  opacity: 0.65;
  transition: width 0.4s ease;
}

.axis-score {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.85;
}

.axis-desc {
  grid-column: 2 / 4;
  font-size: 0.78rem;
  opacity: 0.85;
}

.axis-name .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 210px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.axis-name:hover .tooltip,
.axis-name:active .tooltip {
  display: block;
}

.score-total {
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Next button --- */

.next-btn {
  width: 100%;
  padding: 0.7rem;
  font-size: 0.975rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}

.next-btn:hover {
  background: var(--surface);
  border-color: var(--muted);
}

/* --- End card --- */

.end-mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  border: 1px solid rgba(201, 150, 58, 0.35);
  border-radius: 4px;
  padding: 0.25rem 0.65rem;
}

.end-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.25rem 0;
}

.end-round {
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border: 1px solid transparent;
  overflow: hidden;
}

.end-round-summary {
  display: grid;
  grid-template-columns: 1.25rem 1.25rem 1fr auto auto;
  align-items: center;
  column-gap: 0.6rem;
  padding: 0.55rem 0.85rem;
}

.end-round-summary.clickable {
  cursor: pointer;
}

.end-round.correct {
  background: var(--green-bg);
  border-color: var(--green-border);
}

.end-round.wrong {
  background: var(--red-bg);
  border-color: var(--red-border);
}

.end-round-num {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.4;
}

.end-round-tick {
  font-weight: 700;
}

.end-round.correct .end-round-tick { color: var(--green); }
.end-round.wrong   .end-round-tick { color: var(--red); }

.end-round-lang {
  font-weight: 500;
  color: var(--text);
}

.end-round-guessed {
  color: var(--muted);
  font-weight: 400;
}

.end-round-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.end-round-chevron {
  font-size: 0.6rem;
  opacity: 0.4;
  width: 0.75rem;
  text-align: center;
}

.end-round-detail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.end-detail-axis {
  display: grid;
  grid-template-columns: 3rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  row-gap: 0.15rem;
  align-items: center;
}

.end-detail-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  opacity: 0.5;
}

.end-detail-label {
  grid-column: 2;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* --- Finished screen score --- */

.score {
  font-family: Georgia, serif;
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1;
  letter-spacing: -1px;
}

/* --- Combobox --- */

.combobox {
  position: relative;
}

.combobox input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.975rem;
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

.combobox input::placeholder {
  color: var(--muted);
}

.combobox input:focus {
  border-color: var(--gold);
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10;
  overflow: hidden;
}

.suggestions li {
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-size: 0.975rem;
  color: var(--text);
  transition: background 0.1s, color 0.1s;
}

.suggestions li:hover,
.suggestions li.highlighted {
  background: var(--gold-dim);
  color: var(--gold-bright);
}
