/* ===== ITパスポート学習室 — 和紙×墨×朱 ===== */
:root {
  --paper: #f7f3ea;
  --paper-deep: #efe8d8;
  --card: #fffdf7;
  --ink: #2b2620;
  --ink-soft: #6b6156;
  --line: #d9cfbc;
  --shu: #c73e2c;        /* 朱 */
  --shu-deep: #a32e1f;
  --matsu: #2e6e4e;      /* 松葉（正解） */
  --matsu-bg: #e8f2ec;
  --shu-bg: #fae9e6;
  --kin: #b8862d;        /* 金茶（フラグ） */
  --st: #b8862d;         /* ストラテジ */
  --mg: #4a6fa5;         /* マネジメント */
  --te: #2e6e4e;         /* テクノロジ */
  --radius: 10px;
  --shadow: 0 2px 10px rgba(60, 45, 20, .08), 0 12px 32px rgba(60, 45, 20, .06);
  --serif: "Shippori Mincho", "Noto Serif", "Hiragino Mincho ProN", serif;
  --gothic: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--gothic);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(199, 62, 44, .05), transparent),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(120, 100, 60, .015) 2px 4px);
  line-height: 1.8;
  font-size: 15px;
}
#app { max-width: 880px; margin: 0 auto; padding: 0 20px 60px; }

/* ===== header ===== */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 22px 0 18px;
  border-bottom: 3px double var(--line);
  margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-seal {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--shu); color: #fff;
  font-family: var(--serif); font-weight: 800; font-size: 22px;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), 0 2px 6px rgba(163,46,31,.35);
}
.brand-title { font-family: var(--serif); font-weight: 800; font-size: 20px; letter-spacing: .06em; display: block; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--ink-soft); letter-spacing: .04em; }
.header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.lang-switch .lang-btn {
  border: none; background: none; cursor: pointer; font: inherit;
  color: var(--ink-soft); padding: 4px 2px; transition: color .15s;
}
.lang-switch .lang-btn:hover { color: var(--shu); }
.lang-switch .lang-btn.active { color: var(--shu); font-weight: 700; }
.lang-switch .lang-sep { color: var(--line); user-select: none; }
.site-nav a {
  text-decoration: none; color: var(--ink-soft);
  font-weight: 500; font-size: 14px;
  padding: 7px 14px; border-radius: 999px;
  transition: all .15s;
}
.site-nav a:hover { color: var(--shu); background: var(--shu-bg); }
.site-nav a.active { color: #fff; background: var(--ink); }

/* ===== common ===== */
.view { min-height: 60vh; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h1.page-title {
  font-family: var(--serif); font-size: 26px; font-weight: 800; letter-spacing: .05em;
  margin-bottom: 6px;
}
h1.page-title::before { content: "▍"; color: var(--shu); margin-right: 6px; }
.page-lead { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 24px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 26px; margin-bottom: 18px;
}
.btn {
  display: inline-block; border: none; cursor: pointer;
  font-family: var(--gothic); font-weight: 700; font-size: 15px;
  padding: 12px 28px; border-radius: 999px;
  background: var(--shu); color: #fff;
  box-shadow: 0 3px 0 var(--shu-deep);
  transition: transform .08s, box-shadow .08s, background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--shu-deep); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shu-deep); }
.btn.secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.btn.secondary:hover { background: var(--paper-deep); }
.btn.ghost { background: transparent; color: var(--ink-soft); box-shadow: none; border: 1px solid var(--line); font-weight: 500; }
.btn.ghost:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; letter-spacing: .05em;
  color: #fff; vertical-align: 2px;
}
.badge.st { background: var(--st); } .badge.mg { background: var(--mg); } .badge.te { background: var(--te); }
.badge.year { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }

/* ===== home ===== */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 30px; }
.mode-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 22px 20px;
  text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--shu); box-shadow: 0 6px 24px rgba(163,46,31,.15); }
.mode-card .mode-kanji {
  position: absolute; right: -6px; bottom: -22px;
  font-family: var(--serif); font-size: 84px; font-weight: 800;
  color: rgba(43, 38, 32, .05); pointer-events: none; line-height: 1;
}
.mode-card h2 { font-family: var(--serif); font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.mode-card h2::before { content: "―"; color: var(--shu); margin-right: 8px; }
.mode-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.mode-card .mode-meta { margin-top: 10px; font-size: 12px; color: var(--shu); font-weight: 700; }

.stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.stat-tile .stat-label { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .05em; }
.stat-tile .stat-value { font-family: var(--serif); font-size: 26px; font-weight: 800; line-height: 1.3; }
.stat-tile .stat-value small { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-left: 2px; }
.cat-bars { display: grid; gap: 10px; }
.cat-bar-row { display: grid; grid-template-columns: 110px 1fr 84px; gap: 12px; align-items: center; font-size: 13px; }
.cat-bar { height: 10px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.cat-bar > i { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.cat-bar-row .cat-num { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ===== setup forms ===== */
.opt-group { margin-bottom: 20px; }
.opt-group .opt-label { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; display: block; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  cursor: pointer; user-select: none;
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 7px 18px; font-size: 13.5px; font-weight: 500;
  background: var(--card); transition: all .12s;
}
.chip:hover { border-color: var(--ink-soft); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }

/* ===== quiz ===== */
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.quiz-progress { flex: 1; min-width: 160px; height: 8px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.quiz-progress > i { display: block; height: 100%; background: var(--shu); transition: width .3s; }
.quiz-count { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

.q-card { position: relative; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.q-no { font-family: var(--serif); font-weight: 800; font-size: 17px; color: var(--shu); }
.q-stem { font-size: 15.5px; margin-bottom: 20px; overflow-wrap: anywhere; }
.q-stem table, .choice-text table { border-collapse: collapse; margin: 12px 0; font-size: 13.5px; display: block; overflow-x: auto; max-width: 100%; }
.q-stem th, .q-stem td, .choice-text th, .choice-text td { border: 1px solid var(--line); padding: 5px 12px; background: var(--card); white-space: nowrap; }
.q-stem th { background: var(--paper-deep); font-weight: 700; }
.q-figure { margin: 14px 0; text-align: center; }
.q-figure img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 13px 16px;
  cursor: pointer; transition: all .12s; text-align: left;
  font: inherit; width: 100%;
}
.choice:hover:not(:disabled) { border-color: var(--shu); background: #fffaf3; }
.choice:disabled { cursor: default; opacity: 1; color: inherit; }
.choice:disabled:not(.correct):not(.wrong) { opacity: .55; }
.choice .choice-key {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line); font-weight: 700; font-size: 14px;
  background: var(--paper);
}
.choice.correct { border-color: var(--matsu); background: var(--matsu-bg); }
.choice.correct .choice-key { background: var(--matsu); border-color: var(--matsu); color: #fff; }
.choice.wrong { border-color: var(--shu); background: var(--shu-bg); }
.choice.wrong .choice-key { background: var(--shu); border-color: var(--shu); color: #fff; }
.choice.picked-mock { border-color: var(--ink); background: var(--paper-deep); }
.choice.picked-mock .choice-key { background: var(--ink); border-color: var(--ink); color: #fff; }
.choice .choice-text { flex: 1; overflow-wrap: anywhere; }

.verdict { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-family: var(--serif); font-size: 20px; font-weight: 800; }
.verdict.ok { color: var(--matsu); }
.verdict.ng { color: var(--shu); }
.verdict .v-mark { font-size: 30px; line-height: 1; }

.expl {
  border-left: 4px solid var(--kin);
  background: linear-gradient(to right, rgba(184,134,45,.07), transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px; margin-top: 14px; font-size: 14px;
}
.expl .expl-title { font-weight: 700; color: var(--kin); font-size: 12.5px; letter-spacing: .1em; margin-bottom: 6px; }
.expl p { margin-bottom: 6px; }

/* ===== mock ===== */
.mock-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--ink); color: #f7f3ea;
  border-radius: var(--radius);
  padding: 10px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.mock-timer { font-family: var(--serif); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.mock-timer.low { color: #ff9d8c; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: .5; } }
.mock-bar .spacer { flex: 1; }
.mock-bar .mock-info { font-size: 12.5px; opacity: .85; }
.mock-bar .btn { padding: 8px 18px; font-size: 13px; }

.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 6px; margin: 10px 0 4px; }
.pal-cell {
  aspect-ratio: 1; border-radius: 7px; border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  cursor: pointer; background: var(--card); color: var(--ink-soft);
  font-variant-numeric: tabular-nums; position: relative;
}
.pal-cell.answered { background: var(--ink); border-color: var(--ink); color: #fff; }
.pal-cell.current { outline: 2.5px solid var(--shu); outline-offset: 1px; }
.pal-cell.flagged::after {
  content: ""; position: absolute; top: 2px; right: 2px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--kin);
}
.flag-btn { border: 1.5px dashed var(--kin); color: var(--kin); background: transparent; border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.flag-btn.on { background: var(--kin); color: #fff; border-style: solid; }

/* ===== result ===== */
.result-hero { text-align: center; padding: 36px 20px 30px; }
.result-hero .rh-label { font-size: 13px; color: var(--ink-soft); letter-spacing: .2em; }
.result-hero .rh-score { font-family: var(--serif); font-size: 64px; font-weight: 800; line-height: 1.15; }
.result-hero .rh-score small { font-size: 20px; color: var(--ink-soft); font-weight: 500; }
.result-hero .rh-judge {
  display: inline-block; margin-top: 8px; font-family: var(--serif);
  font-size: 22px; font-weight: 800; letter-spacing: .3em; padding: 6px 26px 6px 32px;
  border: 2.5px solid; border-radius: 6px; transform: rotate(-2deg);
}
.result-hero .rh-judge.pass { color: var(--matsu); border-color: var(--matsu); }
.result-hero .rh-judge.fail { color: var(--shu); border-color: var(--shu); }
.result-note { font-size: 11.5px; color: var(--ink-soft); text-align: center; margin-top: 10px; }

.wrong-list { display: grid; gap: 10px; }
.wrong-item {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 14px 18px; cursor: pointer;
}
.wrong-item summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; gap: 10px; align-items: baseline; }
.wrong-item summary::-webkit-details-marker { display: none; }
.wrong-item summary .wi-no { color: var(--shu); font-weight: 800; font-family: var(--serif); white-space: nowrap; }
.wrong-item[open] { background: #fffdf7; }
.wrong-item .wi-body { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 14px; }

/* ===== footer ===== */
.site-footer {
  margin-top: 48px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-soft); line-height: 1.7;
}
.empty-note { text-align: center; color: var(--ink-soft); padding: 40px 0; font-size: 14px; }

.orig-ja {
  margin-top: 14px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 12.5px; color: var(--ink-soft); background: var(--paper-deep);
}
.orig-ja summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.orig-ja .q-stem { margin-top: 10px; font-size: 12.5px; }
.orig-ja .choices { margin-top: 8px; pointer-events: none; }
.figure-note { font-size: 11.5px; color: var(--ink-soft); margin-top: 6px; text-align: center; }

:lang(vi) h1.page-title,
:lang(vi) .brand-title,
:lang(vi) .q-no,
:lang(vi) .quiz-count,
:lang(vi) .result-hero .rh-score,
:lang(vi) .result-hero .rh-judge,
:lang(vi) .verdict {
  font-family: "Shippori Mincho", "Noto Serif", serif;
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .card { padding: 18px 16px; }
  .site-header { justify-content: center; text-align: center; }
  .header-right { justify-content: center; }
  .result-hero .rh-score { font-size: 46px; }
  .cat-bar-row { grid-template-columns: 90px 1fr 70px; }
}
