/* version et date à changer dans japonais.html
jp_styles.css — version 1.3.1
jp_styles.css — date    2026-10-22
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --ink: #e8e4df;
  --paper: #1a1a2e;
  --mid: #9090a0;
  --accent: #e05c50;
  --soft: #2a2a40;
  --green: #4cba78;
  --blue: #5ba8d8;
  --card-bg: #22223a;
  --tag-bg: #2e2e4a;
  --tag-blue: #1e3a5a;
  --border: #333355;
  --btn-primary-bg: #4a4a6a;
  --btn-primary-fg: #e8e4df;
}

:root.light {
  --ink: #1a1a2e;
  --paper: #f0ede8;
  --mid: #8a8075;
  --accent: #c0392b;
  --soft: #e8e3dd;
  --green: #27ae60;
  --blue: #2980b9;
  --card-bg: #ffffff;
  --tag-bg: #e8e3dd;
  --tag-blue: #eaf2fb;
  --border: #e8e3dd;
  --btn-primary-bg: #1a1a2e;
  --btn-primary-fg: white;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 10px 60px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

.ja-title {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  line-height: 1;
}

.fr-subtitle {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--mid);
  letter-spacing: 0.18em;
  margin-top: 5px;
  text-transform: uppercase;
}

/* ── Mode switcher ── */
.mode-switcher {
  display: flex;
  background: var(--card-bg);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 28px;
  width: 100%;
  max-width: 640px;
}

.mode-btn {
  flex: 1;
  padding: 11px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border: none;
  background: transparent;
  color: var(--mid);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.mode-btn.active {
  background: var(--accent);
  color: white;
}

.mode-btn:not(.active):hover {
  background: var(--soft);
  color: var(--ink);
}

#mode-fr-jp,
#mode-jp-fr {
  font-size: 1rem;
  letter-spacing: 0;
}

/* ── Card ── */
.card {
  background: var(--card-bg);
  border-radius: 3px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.06);
  padding: 24px 20px;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
  margin-bottom: 18px;
}

.badge.aff {
  background: #eaf6ee;
  color: var(--green);
}

.badge.neg {
  background: #fdf0ef;
  color: var(--accent);
}

.badge.q-ou {
  background: #eaf2fb;
  color: var(--blue);
}

.badge.q-qt {
  background: #fef9e7;
  color: #d68910;
}

.badge.q-cm {
  background: #fdf2f8;
  color: #8e44ad;
}

.badge.q-qd {
  background: #fdf0ef;
  color: var(--accent);
}

.prompt-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--mid);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Mode FR→JP : texte français = question */
.prompt-text {
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 14px;
}

/* Mode JP→FR : phrase japonaise = question */
.prompt-ja {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 6px;
}

.prompt-romaji {
  display: none;
  font-size: 0.9rem;
  color: var(--mid);
  font-style: italic;
  margin-bottom: 14px;
  letter-spacing: 0.03em;
}

/* hint = icône + texte inline sur la même ligne */
.hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 28px;
}

.hint-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--card-bg);
  transition: background 0.1s;
}

.hint-toggle:hover {
  background: var(--soft);
}

.hint-box {
  display: none;
  font-size: 0.8rem;
  color: var(--mid);
  font-style: italic;
  padding: 4px 10px;
  background: var(--soft);
  border-radius: 2px;
  line-height: 1.5;
  flex: 1;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

button {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 2px;
  padding: 9px 18px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--btn-primary-bg, #1a1a2e);
  color: var(--btn-primary-fg, white);
}

.btn-secondary {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-next {
  background: var(--accent);
  color: white;
  margin-left: auto;
}

.divider {
  border: none;
  border-top: 1px solid var(--soft);
  margin: 22px 0;
}

.answer-block {
  display: none;
}

.answer-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 8px;
}

/* Réponse mode FR→JP : japonais */
.ans-kana {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.6;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

/* ligne 💡 + romaji entre kana et traduction */
.ans-rom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 26px;
}

.ans-rom-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--card-bg);
  transition: background 0.1s;
}

.ans-rom-toggle:hover {
  background: var(--soft);
}

.ans-romaji {
  display: none;
  font-size: 0.88rem;
  color: var(--mid);
  font-style: italic;
  letter-spacing: 0.03em;
  flex: 1;
}

.ans-french {
  font-size: 0.88rem;
  color: var(--mid);
  margin-top: 2px;
}

/* Réponse mode JP→FR : décomposition */
.decomp-block {
  margin-top: 4px;
}

.decomp-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 10px;
}

.decomp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--tag-bg);
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 0.78rem;
  line-height: 1.4;
  gap: 2px;
}

.tag .tag-ja {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}

.tag .tag-rom {
  font-size: 0.6rem;
  color: var(--mid);
  font-style: italic;
  letter-spacing: 0.02em;
}

.tag .tag-fr {
  font-size: 0.65rem;
  color: var(--mid);
}

.tag.particle {
  background: var(--tag-blue);
}

.tag.particle .tag-ja {
  color: var(--blue);
}

.ans-structure {
  font-size: 0.78rem;
  color: var(--mid);
  font-style: italic;
  margin-top: 8px;
}

.grammar-tip {
  background: var(--soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 2px 2px 0;
  padding: 9px 13px;
  font-size: 0.78rem;
  color: var(--ink);
  opacity: 0.85;
  margin-top: 12px;
  line-height: 1.6;
}

.counter {
  text-align: center;
  font-size: 0.72rem;
  color: var(--mid);
  margin-top: 18px;
  letter-spacing: 0.06em;
}

footer {
  margin-top: 32px;
  font-size: 0.68rem;
  color: var(--mid);
  letter-spacing: 0.08em;
}

/* ── Onglets vocabulaire & structures ── */
.vocab-card {
  background: var(--card-bg);
  border-radius: 3px;
  width: 100%;
  max-width: 860px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.06);
  padding: 24px 20px;
  display: none;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-title:first-child {
  margin-top: 0;
}

.section-count {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--mid);
  letter-spacing: 0.06em;
}

/* Table vocabulaire */
.vocab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.vocab-table th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  padding: 6px 10px;
  border-bottom: 1px solid var(--soft);
}

.vocab-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--soft);
  vertical-align: middle;
}

.vocab-table tr:last-child td {
  border-bottom: none;
}

.vocab-table tr:hover td {
  background: var(--soft);
}

.span-ja {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
  white-space: nowrap;
}

.span-rom {
  font-size: 0.72rem;
  color: var(--mid);
  font-style: italic;
  white-space: nowrap;
  display: block;
  margin-top: 2px;
}

.span-fr {
  white-space: nowrap;
  display: block;
}

.td-jp-cell {
  vertical-align: middle;
}

.td-fr {
  color: var(--ink);
}

/* Table structures */
.pattern-list {
  list-style: none;
}

.pattern-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

.pattern-item:last-child {
  border-bottom: none;
}

.p-type {
  grid-column: 1 / -1;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--mid);
  margin-bottom: 4px;
}

.p-structure {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  font-family: monospace;
  letter-spacing: 0.02em;
}

.p-hint {
  font-size: 0.82rem;
  color: var(--mid);
  font-style: italic;
}

.p-example {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.p-example .ex-ja {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
}

.p-example .ex-fr {
  font-size: 0.78rem;
  color: var(--mid);
  margin-top: 1px;
}

.p-tip {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: #666;
  background: var(--soft);
  border-left: 3px solid var(--accent);
  padding: 5px 10px;
  border-radius: 0 2px 2px 0;
  margin-top: 4px;
}

/* ── Scroll to top ── */
.scroll-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  transition: opacity 0.2s, transform 0.15s;
  z-index: 999;
}

.scroll-top:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.scroll-top.visible {
  display: flex;
}

/* ── Section title cliquable ── */
.section-title {
  cursor: pointer;
  user-select: none;
}

.section-title:hover {
  color: var(--accent);
}

.section-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--mid);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.section-title.open .section-chevron {
  transform: rotate(180deg);
}

/* ── Table collapse ── */
.section-body {
  display: none;
  overflow: hidden;
}

/* ── Bouton dark/light mode ── */
.theme-btn {
  position: fixed;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.2s;
}

.theme-btn:hover {
  background: var(--soft);
}

/* ── Recherche vocabulaire ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  position: relative;
}

.search-input {
  flex: 1;
  padding: 9px 40px 9px 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--soft);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--card-bg);
}

.search-input::placeholder {
  color: var(--mid);
}

.search-clear {
  position: relative;
  right: 26px;
  top: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--mid);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px;
  display: none;
  line-height: 1;
  z-index: 2;
}

.search-clear:hover {
  color: var(--accent);
}

.search-results-count {
  font-size: 0.68rem;
  color: var(--mid);
  white-space: nowrap;
  margin-left: 6px;
  flex-shrink: 0;
}

/* ── Search bar : position relative pour la croix ── */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
}


/* Ligne de résultat de recherche */
.search-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.search-results-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--soft);
  vertical-align: middle;
}

.search-results-table tr:last-child td {
  border-bottom: none;
}

.search-results-table tr:hover td {
  background: var(--soft);
}

.srt-ja {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
}

.srt-rom {
  font-size: 0.72rem;
  color: var(--mid);
  font-style: italic;
  display: block;
  margin-top: 2px;
}

.srt-fr {
  color: var(--ink);
  font-size: 0.88rem;
}

.srt-cat {
  font-size: 0.65rem;
  color: var(--mid);
  opacity: 0.7;
}

mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.no-results {
  text-align: center;
  color: var(--mid);
  font-size: 0.85rem;
  padding: 24px 0;
}

/* ── Version popup ── */
.version-btn {
  position: fixed;
  top: 14px;
  right: 58px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--mid);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.version-popup {
  display: none;
  position: fixed;
  top: 54px;
  right: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  min-width: 300px;
}

.version-popup h4 {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 10px;
}

.version-popup table {
  width: 100%;
  border-collapse: collapse;
}

.version-popup td {
  padding: 5px 0;
  color: var(--ink);
  font-size: 0.82rem;
}

.version-popup td.fichier {
  font-weight: bold;
}

.version-popup td.date {
  text-align: left;
  font-style: italic;
  font-family: monospace;
}

.version-popup td.version {
  text-align: right;
  color: var(--accent);
  font-family: monospace;
  padding-right: 5px;
}

/* ── Kana ── */
.kana-card {
  background: var(--card-bg);
  border-radius: 3px;
  width: 100%;
  max-width: 860px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.06);
  padding: 24px 20px;
  display: none;
}

.kana-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  margin: 22px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--soft);
}

.kana-section-title:first-child {
  margin-top: 0;
}

.kana-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.kana-grid-base {
  width: 400px;
}

.kana-grid-dakuon {
  width: 400px;
}

.kana-grid-handakuon {
  width: 400px;
}

.kana-grid-yoon {
  width: 220px;
}

.kana-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  min-width: 52px;
  padding: 7px 3px 5px;
  border-radius: 4px;
  background: var(--soft);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s;
  border: 1px solid transparent;
}

.kana-cell:hover {
  border-color: var(--accent);
}

.kana-cell.selected {
  background: var(--accent);
}

.kana-cell.selected .kh,
.kana-cell.selected .kk,
.kana-cell.selected .kr {
  color: white !important;
}

.kana-cell.obsolete {
  opacity: 0.3;
}

.kh {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.2;
}

.kk {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.15rem;
  color: var(--blue);
  line-height: 1.2;
}

.kr {
  font-size: 0.6rem;
  color: var(--mid);
  margin-top: 3px;
  font-style: italic;
}

.kana-flip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.kana-toggle-btn {
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  cursor: pointer;
}

.kana-toggle-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ── Vocab lignes cliquables ── */





/* ── Masquage colonnes vocab par toggle ─────────────────────────────
   Les classes hide-ja/hide-rom/hide-fr sont posées sur #vocab-content.
   Elles ciblent span.span-ja / span.span-rom / span.span-fr
   SAUF si la ligne est en état .row-revealed (clic utilisateur)      */
#vocab-content.hide-ja  tr.word-row:not(.row-revealed) .span-ja  { visibility: hidden; }
#vocab-content.hide-rom tr.word-row:not(.row-revealed) .span-rom { visibility: hidden; }
#vocab-content.hide-fr  tr.word-row:not(.row-revealed) .span-fr  { visibility: hidden; }

#search-table.hide-ja  .span-ja  { visibility: hidden; }
#search-table.hide-rom .span-rom { visibility: hidden; }
#search-table.hide-fr  .span-fr  { visibility: hidden; }

/* Ligne révélée : tout visible quoi qu'il arrive */
tr.word-row.row-revealed .span-ja,
tr.word-row.row-revealed .span-rom,
tr.word-row.row-revealed .span-fr  { visibility: visible !important; }

/* Curseur pointer sur les lignes cliquables */
.vocab-table tr.word-row { cursor: pointer; }
.vocab-table tr.word-row:hover td { background: var(--soft); }
.vocab-table tr.word-row.row-revealed { background: color-mix(in srgb, var(--accent) 8%, transparent); }
