:root {
  --bg: #1b1d22;
  --panel: #17181c;
  --text: #e3e6ee;
  --muted: #8b909f;
  --muted2: #6f7483;
  --accent: #e2b714;
  --good: #4cd964;
  --bad: #ff5a5f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --smooth: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sans:
    system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --mono:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  opacity: 0.92;
}
.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(226, 183, 20, 0.06);
}
.brand-name {
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: lowercase;
}

.controls {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.label {
  font-size: 12px;
  color: var(--muted2);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  min-width: 140px;
  color: var(--text);
}
.badge {
  min-width: 120px;
}
.status {
  color: var(--muted);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 18px 24px;
  gap: 18px;
}

/* -------- screens -------- */
.screen {
  width: min(1100px, 95vw);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fade 0.35s var(--smooth);
}

.screen.active {
  display: flex;
}

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

.title {
  margin: 0;
  font-size: clamp(26px, 4.2vw, 38px);
  letter-spacing: -0.02em;
  text-transform: lowercase;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* -------- dataset picker (custom select) -------- */
.dataset-picker {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- custom select (contrôle total) --- */
.cselect {
  position: relative;
  width: 100%;
}

.cselect-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);

  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;

  transition:
    border-color 0.18s var(--smooth),
    background 0.18s var(--smooth),
    transform 0.12s var(--smooth);
}

.cselect-btn:hover {
  border-color: rgba(226, 183, 20, 0.22);
  background: rgba(226, 183, 20, 0.05);
}

.cselect-btn:active {
  transform: translateY(0);
}

.cselect-btn:focus {
  outline: none;
  border-color: rgba(226, 183, 20, 0.28);
  background: rgba(226, 183, 20, 0.06);
}

.cselect-caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(226, 183, 20, 0.9);
  border-bottom: 2px solid rgba(226, 183, 20, 0.9);
  transform: rotate(45deg);
  margin-top: -2px;
}

.cselect-menu {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 8px);

  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);

  padding: 6px;
  display: none;
  max-height: 280px;
  overflow: auto;
}

.cselect.open .cselect-menu {
  display: block;
}

.cselect-opt {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;

  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  transition: background 0.16s var(--smooth);
}

.cselect-opt:hover,
.cselect-opt[aria-selected="true"] {
  background: rgba(226, 183, 20, 0.12);
}

/* -------- start: levels grid -------- */
.levels {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.level-card {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
  box-shadow: var(--shadow);
  padding: 14px 14px;
  cursor: pointer;
  transition:
    transform 0.12s var(--smooth),
    border-color 0.18s var(--smooth),
    background 0.18s var(--smooth);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.level-card:hover {
  transform: translateY(-2px);
  border-color: rgba(226, 183, 20, 0.18);
  background: rgba(226, 183, 20, 0.06);
}

.level-card.selected {
  border-color: rgba(226, 183, 20, 0.35);
  background: rgba(226, 183, 20, 0.1);
}

.level-name {
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  margin-bottom: 6px;
}

.level-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted2);
  font-size: 12px;
}

.pill {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  padding: 6px 8px;
  border-radius: 999px;
}

.start-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

/* -------- quiz card -------- */
.card {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.greekWord {
  font-family: var(--sans);
  font-size: 44px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: center;
  padding: 14px 10px 8px;
  user-select: none;
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 8px 0 10px;
}

/* IMPORTANT: numéro sur la même ligne */
.choice {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  padding: 12px 12px;
  cursor: pointer;
  transition:
    transform 0.1s var(--smooth),
    border-color 0.18s var(--smooth),
    background 0.18s var(--smooth);
  user-select: none;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.choice:hover {
  transform: translateY(-1px);
  border-color: rgba(226, 183, 20, 0.25);
  background: rgba(226, 183, 20, 0.08);
}

.choice.correct {
  border-color: rgba(76, 217, 100, 0.35);
  background: rgba(76, 217, 100, 0.1);
}
.choice.wrong {
  border-color: rgba(255, 90, 95, 0.3);
  background: rgba(255, 90, 95, 0.08);
}

.choice .txt {
  flex: 1 1 auto;
  min-width: 0;
}
.choice .small {
  flex: 0 0 auto;
  color: var(--muted2);
  font-size: 12px;
  font-family: var(--mono);
  opacity: 0.9;
}

/* -------- actions/buttons -------- */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(226, 183, 20, 0.1);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  transition:
    transform 0.12s var(--smooth),
    background 0.18s var(--smooth),
    border-color 0.18s var(--smooth),
    opacity 0.18s var(--smooth);
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(226, 183, 20, 0.25);
  background: rgba(226, 183, 20, 0.14);
}
.btn:active {
  transform: translateY(0);
}
.btn-ghost {
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* -------- progress -------- */
.progress-wrapper {
  width: 100%;
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.progress {
  height: 100%;
  width: 0%;
  background: rgba(226, 183, 20, 0.65);
  transition: width 0.22s var(--smooth);
}

/* -------- result screen -------- */
.stats {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.statline {
  color: var(--text);
  font-size: 14px;
}
.good {
  color: var(--good);
}
.bad {
  color: var(--bad);
}

.result-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.details {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.row {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
}
.row.err {
  border-left: 4px solid rgba(255, 90, 95, 0.7);
}
.row.ok {
  border-left: 4px solid rgba(76, 217, 100, 0.6);
}
.row .meta {
  color: var(--muted2);
  font-size: 12px;
  margin-top: 4px;
}

.footer {
  color: var(--muted2);
  font-size: 12px;
  opacity: 0.92;
  text-align: center;
}

.kbd {
  font-family: var(--mono);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  padding: 2px 6px;
  border-radius: 8px;
  margin: 0 2px;
}

/* Autoriser la sélection/copie du mot grec */
#greekWord {
  user-select: text;
  -webkit-user-select: text;
}

.greekWord .nature {
  display: inline-block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
  font-family: var(--sans);
}
