/* passed.work — 答案用紙×マークシート */
:root {
  --paper: #eef2ef;      /* 答案用紙の薄緑 */
  --card: #ffffff;
  --ink: #18242b;        /* 墨 */
  --muted: #5b6a64;
  --line: #c7d2cb;
  --shu: #c8401f;        /* 朱(印・採点ペン) */
  --shu-soft: #f7e3dc;
  --pass: #1f7a55;       /* 合格 */
  --pass-soft: #e1efe7;
  --radius: 10px;
  --font-display: "Shippori Mincho", serif;
  --font-body: "Zen Kaku Gothic New", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  background-image: repeating-linear-gradient(
    to bottom, transparent 0 31px, rgba(24, 36, 43, 0.04) 31px 32px);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--shu); }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  border-bottom: 2px solid var(--ink);
  background: var(--card);
  position: sticky; top: 0; z-index: 10;
}
.hanko {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2.5px solid var(--shu); color: var(--shu);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  transform: rotate(-6deg);
  user-select: none; flex: none;
}
.brand { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.06em; }
.brand small { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0.18em; }
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--muted); }
header nav { display: flex; gap: 6px; }

main { max-width: 880px; margin: 0 auto; padding: 24px 16px 80px; }

/* ---------- common ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; }
h1 { font-size: 26px; margin: 6px 0 4px; }
h2 { font-size: 19px; border-left: 4px solid var(--shu); padding-left: 10px; margin: 30px 0 12px; }
.lede { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(24, 36, 43, 0.05);
}

button, .btn {
  font-family: var(--font-body); font-size: 14px;
  border: 1.5px solid var(--ink); border-radius: 7px;
  background: var(--card); color: var(--ink);
  padding: 8px 16px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
button:hover, .btn:hover { background: var(--ink); color: var(--card); }
button:focus-visible, .bubble:focus-visible, input:focus-visible {
  outline: 3px solid var(--shu); outline-offset: 2px;
}
button.primary { background: var(--ink); color: var(--card); }
button.primary:hover { background: var(--shu); border-color: var(--shu); }
button.ghost { border-color: var(--line); color: var(--muted); }
button.ghost:hover { background: var(--paper); color: var(--ink); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

input {
  font-family: var(--font-body); font-size: 15px;
  width: 100%; padding: 10px 12px; margin: 5px 0 14px;
  border: 1.5px solid var(--line); border-radius: 7px; background: #fff;
}
label { font-size: 13px; color: var(--muted); }
.error { color: var(--shu); font-size: 13.5px; min-height: 1.4em; }

/* ---------- auth ---------- */
.auth-wrap { max-width: 410px; margin: 7vh auto 0; }
.auth-title { text-align: center; margin-bottom: 18px; }
.auth-title .hanko { width: 64px; height: 64px; font-size: 30px; margin: 0 auto 10px; }
.tabbar { display: flex; border-bottom: 1.5px solid var(--line); margin-bottom: 16px; }
.tabbar button {
  border: none; border-radius: 0; background: none; color: var(--muted);
  padding: 8px 14px; border-bottom: 2.5px solid transparent;
}
.tabbar button:hover { background: none; color: var(--ink); }
.tabbar button.active { color: var(--ink); border-bottom-color: var(--shu); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn-google { width: 100%; }

/* ---------- dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.stat { text-align: center; padding: 14px 8px; }
.stat .num { font-family: var(--font-mono); font-size: 30px; font-weight: 600; }
.stat .num.shu { color: var(--shu); }
.stat .num.pass { color: var(--pass); }
.stat .cap { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }

.mode-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.mode-card { cursor: pointer; transition: border-color 0.12s, transform 0.12s; }
.mode-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.mode-card h3 { margin: 0 0 4px; font-size: 16px; }
.mode-card p { margin: 0; font-size: 13px; color: var(--muted); }

table.exam-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.exam-table th, .exam-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.exam-table th { font-size: 12px; color: var(--muted); letter-spacing: 0.12em; font-weight: 500; }
.exam-table .mono { font-family: var(--font-mono); }
.exam-table .bar { background: var(--paper); border-radius: 4px; height: 8px; overflow: hidden; min-width: 80px; }
.exam-table .bar i { display: block; height: 100%; background: var(--pass); }

/* ---------- practice ---------- */
.q-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.q-no { font-family: var(--font-display); font-size: 24px; }
.q-meta { color: var(--muted); font-size: 13px; }
.q-progress { margin-left: auto; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

.q-image { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin: 12px 0; }

/* マークシート風バブル(シグネチャ要素) */
.marksheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 8px; }
.bubble {
  font-family: var(--font-display); font-size: 21px;
  height: 58px; border-radius: 50% / 42%;
  border: 2px solid var(--ink); background: var(--card); color: var(--ink);
  cursor: pointer; transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.bubble:hover { background: var(--ink); color: var(--card); }
.bubble.filled { background: var(--ink); color: var(--card); }
.bubble.correct { background: var(--pass); border-color: var(--pass); color: #fff; }
.bubble.wrong { background: var(--shu); border-color: var(--shu); color: #fff; }
.bubble:disabled { cursor: default; opacity: 1; }
.bubble:disabled:not(.correct):not(.wrong) { opacity: 0.35; }

.verdict {
  display: flex; align-items: center; gap: 14px; margin: 14px 0;
  padding: 12px 16px; border-radius: var(--radius); font-size: 15px;
}
.verdict.ok { background: var(--pass-soft); border: 1px solid var(--pass); }
.verdict.ng { background: var(--shu-soft); border: 1px solid var(--shu); }
.stamp {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  transform: rotate(-8deg);
  animation: stamp-in 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.verdict.ok .stamp { border: 3px solid var(--pass); color: var(--pass); }
.verdict.ng .stamp { border: 3px solid var(--shu); color: var(--shu); }
@keyframes stamp-in { from { transform: rotate(-8deg) scale(2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } }

.explain {
  background: #fffdf7; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 20px 14px; margin-top: 12px; font-size: 14.5px;
}
.explain h2 { font-size: 16px; margin: 16px 0 6px; }
.explain .src { font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- session result ---------- */
.result-hero { text-align: center; padding: 36px 18px; }
.result-hero .stamp { width: 96px; height: 96px; font-size: 42px; margin: 0 auto 14px; border: 4px solid var(--shu); color: var(--shu); }
.result-hero .stamp.pass { border-color: var(--pass); color: var(--pass); }
.result-hero .big { font-family: var(--font-mono); font-size: 48px; font-weight: 600; }

footer { text-align: center; font-size: 11.5px; color: var(--muted); padding: 26px 14px; }

.loading { text-align: center; color: var(--muted); padding: 40px 0; }
@media (max-width: 560px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .marksheet { gap: 8px; }
  .bubble { height: 52px; font-size: 19px; }
  .who { display: none; }
}
