:root {
  --bg: #ffffff;
  --bg-soft: #f5f2ec;
  --text: #2b2116;
  --text-muted: #6b5d4f;
  --accent: #8a1f1f;
  --accent-soft: #f0e3dd;
  --border: #e2d9ce;
  --card: #ffffff;
  --shadow: 0 4px 20px rgba(43, 33, 22, 0.08);
  --nav-bg: #2b2116;
  --nav-text: #f5f2ec;
}

[data-theme="dark"] {
  --bg: #1a1512;
  --bg-soft: #241d17;
  --text: #efe7db;
  --text-muted: #a89a8a;
  --accent: #d55b3a;
  --accent-soft: #3a241b;
  --border: #3a3229;
  --card: #221b16;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --nav-bg: #120e0b;
  --nav-text: #efe7db;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

a {
  color: var(--accent);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Nav ---------- */
.top-bar {
  background: var(--nav-bg);
  color: var(--nav-text);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 15px;
}

.brand-sub {
  font-size: 11px;
  opacity: 0.75;
  display: block;
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--nav-text);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent);
  color: #fff;
}

.theme-toggle {
  background: transparent;
  border: 1px solid rgba(245, 242, 236, 0.3);
  color: var(--nav-text);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  margin-left: 8px;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.lang-toggle {
  background: transparent;
  border: 1px solid rgba(245, 242, 236, 0.3);
  color: var(--nav-text);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 8px;
  width: auto;
}

.lang-toggle option {
  background: var(--card);
  color: var(--text);
}

.lang-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 24px;
  cursor: pointer;
}

@media (max-width: 820px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    padding-bottom: 12px;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-inner {
    flex-wrap: wrap;
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}

.hero {
  background: linear-gradient(135deg, var(--accent), #5c1414);
  color: #fff;
  text-align: center;
  padding: 60px 20px;
}

.hero h1 {
  font-size: 2.4rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.hero .kanji {
  font-size: 1.2rem;
  letter-spacing: 6px;
  opacity: 0.85;
  margin-bottom: 12px;
}

.section {
  margin: 40px 0;
}

.section-title {
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.15s, opacity 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

/* ---------- Forms ---------- */
input[type="search"],
select,
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}

/* ---------- Badges / chips ---------- */
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.chip-grado {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Footer ---------- */
footer {
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
}

footer a {
  color: var(--nav-text);
  text-decoration: underline;
}

/* ---------- General utilities ---------- */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.kanji-display {
  font-family: "Yu Mincho", "MS Mincho", serif;
  font-size: 1.3rem;
  color: var(--text-muted);
}

.jap-fallback {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9em;
}

/* ---------- Técnicas ---------- */
.tec-card {
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, transform 0.15s;
}

.tec-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.tec-card .tec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tec-card .tec-nombre {
  font-weight: 700;
  font-size: 1.05rem;
}

.tec-card .tec-kanji {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.tec-card .tec-arrow {
  transition: transform 0.2s;
  color: var(--accent);
}

.tec-card.open .tec-arrow {
  transform: rotate(90deg);
}

.tec-body {
  display: none;
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.tec-card.open .tec-body {
  display: block;
}

.tec-body .detail-row {
  margin-bottom: 14px;
}

.tec-body .detail-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tec-img-box {
  border: 1px dashed var(--border);
  border-radius: 8px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-soft);
  margin-bottom: 14px;
}

.tec-pies-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* ---------- Grado selector ---------- */
.grado-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.grado-pill {
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.grado-pill:hover {
  border-color: var(--accent);
}

.grado-pill.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ---------- Validación tabla ---------- */
.val-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}

.val-row:last-child {
  border-bottom: none;
}

.val-grado-badge {
  min-width: 90px;
  text-align: center;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  border: 2px solid var(--border);
}

/* ---------- Trivia ---------- */
.trivia-card {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.trivia-options {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.trivia-option {
  padding: 14px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--card);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.trivia-option:hover {
  border-color: var(--accent);
}

.trivia-option.correct {
  border-color: #2e7d32;
  background: #e8f5e9;
  color: #1b5e20;
}

.trivia-option.wrong {
  border-color: #c62828;
  background: #ffebee;
  color: #b71c1c;
}

[data-theme="dark"] .trivia-option.correct {
  background: #1b3a1f;
  color: #c8e6c9;
}

[data-theme="dark"] .trivia-option.wrong {
  background: #3a1b1b;
  color: #ffcdd2;
}

.trivia-progress {
  margin-bottom: 20px;
  color: var(--text-muted);
}

.trivia-score {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin: 16px 0;
}

/* ---------- Glosario ---------- */
.glosario-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}


