:root {
  --bg: #0f1226;
  --bg-soft: #1a1f3d;
  --card: #1e2547;
  --accent: #ffb347;
  --accent-2: #6c8cff;
  --good: #4caf78;
  --bad: #e8617a;
  --text: #eef1ff;
  --muted: #9aa3c7;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, #2a3170 0%, var(--bg) 55%);
  display: flex;
  justify-content: center;
}

.app {
  width: min(680px, 92vw);
  padding: 32px 0 48px;
}

.header { text-align: center; margin-bottom: 24px; position: relative; }
.header h1 { font-size: 2.2rem; margin: 0; }
.tagline { color: var(--muted); margin: 8px 0 0; }

.lang-switcher {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.lang-btn:hover { border-color: var(--accent); }
.lang-btn.active {
  border-color: var(--accent);
  background: rgba(255, 179, 71, 0.16);
  font-weight: 700;
}
.lang-flag { font-size: 1.1rem; line-height: 1; }
.lang-code { letter-spacing: 0.04em; }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 { margin: 0 0 16px; font-size: 1.2rem; }

.difficulties {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.diff-card {
  cursor: pointer;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.diff-card:hover { transform: translateY(-3px); border-color: var(--accent); background: rgba(255,255,255,0.07); }
.diff-card .diff-name { font-size: 1.1rem; font-weight: 700; }
.diff-card .diff-meta { color: var(--muted); font-size: 0.85rem; margin-top: 6px; line-height: 1.5; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.badge {
  background: var(--accent);
  color: #2a1c00;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.stat { color: var(--muted); font-size: 0.9rem; }
.link-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 0.9rem;
}
.link-btn:hover { text-decoration: underline; }

.message {
  min-height: 1.4em;
  margin: 0 0 16px;
  font-size: 1.05rem;
}
.message.good { color: var(--good); }
.message.bad { color: var(--bad); }

.guess-form { display: flex; gap: 10px; margin-bottom: 16px; }
.guess-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
}
.guess-input:focus { outline: 2px solid var(--accent-2); }

.primary-btn {
  padding: 0 22px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: var(--accent-2);
  color: white;
  cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.1); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.input-hint {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.hints { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.hints-label { color: var(--muted); font-size: 0.9rem; margin-right: 4px; }
.hint-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}
.hint-btn:hover:not(:disabled) { border-color: var(--accent); }
.hint-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.history { width: 100%; border-collapse: collapse; }
.history th, .history td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.history th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.history td.guess-cell { letter-spacing: 0.25em; font-weight: 700; font-size: 1.1rem; }
.history tr:last-child td { animation: pop 0.3s ease; }

@keyframes pop {
  from { background: rgba(255, 179, 71, 0.18); }
  to { background: transparent; }
}

.footer { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 8px; }
.hidden { display: none !important; }

.boot-error { color: var(--bad); padding: 2rem; }
