:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --bg: #0a1020;
  --panel: #131b33;
  --panel-2: #1b2446;
  --border: #2a396d;
  --text: #edf1ff;
  --muted: #a9b5e8;
  --accent: #4d79ff;
  --accent-2: #2ea46d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 20% 0%, #131f43 0%, var(--bg) 55%);
  color: var(--text);
}

.app {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 14px;
}

.top-nav {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.top-link {
  background: #31478b;
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.hero h1 {
  margin: 0;
  line-height: 1.12;
  font-size: clamp(1.4rem, 5.5vw, 2.1rem);
}

.hero p { margin: 10px 0 0; }

h2 {
  margin: 0 0 12px;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, black 8%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-top: 12px;
}

.metric { margin-bottom: 12px; }
.metric-label { font-size: 0.92rem; color: var(--muted); margin-bottom: 6px; }
.metric-value { font-size: 0.9rem; color: var(--muted); margin-top: 5px; }

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-pill {
  background: #101a35;
  border: 1px solid #2a396d;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.92rem;
}

.bar {
  height: 12px;
  background: #10182f;
  border: 1px solid #25335f;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3d68f2, var(--accent));
  transition: width 220ms ease;
}

.bar-fill.green {
  background: linear-gradient(90deg, #228a5a, var(--accent-2));
}

.box-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.box-col {
  background: #10172d;
  border: 1px solid #263560;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.box-count {
  font-size: 1.12rem;
  font-weight: 700;
}

.box-name {
  font-size: 0.8rem;
  color: var(--muted);
}

.letters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.letter-chip {
  background: #1b2650;
  border: 1px solid #314281;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.letter-big {
  font-size: clamp(1.6rem, 7vw, 2rem);
  font-weight: 700;
}

.ipa {
  font-family: "Noto Sans", "Segoe UI", sans-serif;
  color: #cdd6ff;
}

.card {
  min-height: 74px;
  font-size: clamp(1.4rem, 8vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border-radius: 12px;
  margin: 8px 0 12px;
  text-align: center;
  padding: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

button, .import-label {
  background: #31478b;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 10px;
  cursor: pointer;
  font-weight: 600;
  text-align: center;
  display: inline-block;
}

button.success { background: #1e7648; }
button.warning { background: #8d5a12; }

.export-row { margin-top: 10px; }
#importInput { display: none; }

.word {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin: 8px 0;
  background: #182241;
}

.word-main {
  font-size: clamp(1.35rem, 6vw, 1.7rem);
  font-weight: 700;
}

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

.focus-mode #progressPanel {
  display: none;
}

.alphabet-page .app {
  width: min(100%, 760px);
}

.alphabet-page .alphabet-letters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.alphabet-page .letter-chip {
  padding: 12px 8px;
}

@media (max-width: 360px) {
  .alphabet-page .alphabet-letters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .app { padding: 20px; }
  .row {
    display: flex;
    flex-wrap: wrap;
  }
  .letters {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
}
