:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1f232c;
  --text: #ece9e4;
  --muted: #8b909a;
  --line: #272b34;
  --accent: #6ee7b7;
  --accent-ink: #062b1f;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #93c5fd;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 18px 96px;
  min-height: 100%;
}

.screen { display: none; animation: fade .18s ease; }
.screen.active { display: block; }
.hidden { display: none !important; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0; }

.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }

.streak {
  font-size: 14px; color: var(--amber); background: #2a2113;
  padding: 4px 10px; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.streak:empty { display: none; }

.hero { text-align: center; padding: 24px 0 8px; }
.big { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hero-label { color: var(--muted); margin: 8px 0 28px; }

button {
  font: inherit; color: inherit; border: 0; background: none;
  cursor: pointer; border-radius: 12px; transition: transform .06s, background .15s;
}
button:active { transform: scale(.98); }

.primary {
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; padding: 16px 40px; font-size: 17px;
}
.primary.wide { width: 100%; padding: 16px; }
.ghost {
  background: var(--panel2); border: 1px solid var(--line);
  padding: 10px 14px; font-size: 15px;
}
.ghost:hover { background: #262b35; }
.danger { color: var(--red); }
kbd {
  font: 11px/1 ui-monospace, monospace; border: 1px solid #3a4150;
  border-radius: 4px; padding: 3px 5px; margin-left: 8px; opacity: .6; vertical-align: 2px;
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 36px; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }

/* --- révision --- */
.review-top { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.review-top h2 { flex: 1; }
#quit { padding: 6px 10px; font-size: 20px; }
.bar { flex: 1; height: 4px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 36px 24px; text-align: center; min-height: 230px;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
  cursor: pointer;
}
.label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sentence { font-size: 27px; line-height: 1.35; font-weight: 500; letter-spacing: -.01em; }
.answer { color: var(--accent); font-weight: 600; }

.audio-row { display: flex; gap: 8px; justify-content: center; margin: 22px 0 18px; flex-wrap: wrap; }

.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grades button {
  background: var(--panel2); border: 1px solid var(--line);
  padding: 12px 4px 10px; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.grades small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.grades .again { border-color: #4a2529; }
.grades .again:active { background: #3a1f22; }
.grades .good { border-color: #24513f; background: #16281f; }

/* --- phrases --- */
.filters { display: flex; gap: 8px; margin-bottom: 16px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); width: 100%;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #2f4a3d; outline-offset: 1px; }
.filters input { flex: 2; }
.filters select { flex: 1; }

.phrases { display: flex; flex-direction: column; gap: 8px; }
.phrase {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; cursor: pointer;
}
.phrase:hover { border-color: #343a46; }
.phrase .en { font-size: 15px; }
.phrase .fr { color: var(--muted); font-size: 14px; margin-top: 2px; }
.phrase .meta { display: flex; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.phrase .meta span { background: #21252e; border-radius: 99px; padding: 2px 8px; }

/* --- réglages --- */
.field { display: block; margin-bottom: 22px; }
.field > span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.field .row, .row { display: flex; gap: 8px; }
.row button, .file { flex: 1; }
.file { text-align: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.file input { display: none; }

/* --- onglets --- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; align-items: center; gap: 4px;
  max-width: 640px; margin: 0 auto; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(15, 17, 21, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs button { flex: 1; padding: 9px 4px; font-size: 13px; color: var(--muted); }
.tabs button.on { color: var(--text); background: var(--panel2); }
.tabs .add { flex: 0 0 44px; font-size: 22px; background: var(--accent); color: var(--accent-ink); border-radius: 50%; height: 44px; }

/* --- toast --- */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 12px);
  background: #ededea; color: #111; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .sentence { font-size: 23px; }
  .grades button { font-size: 12px; }
}
