:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans JP", sans-serif;
  font-size: 16px;
  color: #342e2b;
  background: #fffdf9;
  --surface: rgb(255 255 255 / 96%);
  --line: #d8cbbb;
  --text-subtle: #6b5d52;
  --accent: #705a40;
  --accent-dark: #584632;
  --correct: #4e653c;
  --correct-bg: #f0f1e6;
  --wrong: #9e3f2e;
  --wrong-bg: #fbede7;
  --warning-bg: #fff7dc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #fffdf9;
  background-image: url("./assets/mosaic-flow.png");
  background-position: right -180px top -140px;
  background-size: 720px auto;
  background-repeat: no-repeat;
}

button, input { font: inherit; }

button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
input:focus-visible + span {
  outline: 3px solid #8e4927;
  outline-offset: 3px;
}

button:disabled { cursor: not-allowed; opacity: 0.55; }

.app-shell {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 64px 16px 48px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(18px, 4vw, 32px);
  box-shadow: 0 24px 60px rgb(52 46 43 / 16%);
}

.wordmark { display: grid; width: max-content; max-width: 100%; margin: 0 0 22px; line-height: 1.08; letter-spacing: -0.065em; }
.wordmark-poker { font-family: "Arial Narrow", "Avenir Next Condensed", system-ui, sans-serif; font-size: clamp(3.5rem, 7.5vw, 5.6rem); font-weight: 900; letter-spacing: -0.07em; }
.wordmark-second { display: flex; align-items: baseline; gap: 0.1em; font-size: clamp(2.7rem, 6.1vw, 4.6rem); font-weight: 900; white-space: nowrap; }
.wordmark-knowledge { color: #f05a3c; }
.wordmark-quiz { font-family: "Arial Narrow", "Avenir Next Condensed", system-ui, sans-serif; font-size: 1.15em; letter-spacing: -0.065em; }
.wordmark.compact { display: flex; flex-wrap: wrap; gap: 0.3em; align-items: baseline; margin-bottom: 16px; letter-spacing: 0.08em; }
.wordmark.compact .wordmark-poker, .wordmark.compact .wordmark-second, .wordmark.compact .wordmark-quiz { font-family: inherit; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.08em; }
.email-gate { display: grid; gap: 10px; width: min(100%, 360px); margin-top: 28px; }
.email-gate label { font-size: 0.9rem; font-weight: 800; }
.email-gate input { min-height: 50px; width: 100%; padding: 10px 14px; border: 1px solid #9a856a; border-radius: 12px; background: rgb(255 255 255 / 94%); }
.email-gate .primary { width: 100%; }
.email-note { margin: 0; color: var(--text-subtle); font-size: 0.76rem; }
.share-panel { margin: 26px 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #f7f1e7; }
.share-panel h2 { margin-bottom: 4px; font-size: 1.15rem; }
.share-panel p { color: var(--text-subtle); font-size: 0.85rem; }
.x-action { display: inline-flex; align-items: center; min-height: 48px; padding: 10px 18px; border-radius: 12px; color: #fff; background: #705a40; font-weight: 800; text-decoration: none; }
.x-action:hover { background: #584632; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.3; }
h2 { font-size: clamp(1.25rem, 4vw, 1.65rem); line-height: 1.45; }
p, li { line-height: 1.7; }

.eyebrow, .meta, .muted {
  color: var(--text-subtle);
}

.eyebrow {
  margin-bottom: 8px;
  color: #f05a3c;
  font-size: 0.875rem;
  font-weight: 700;
}

.prototype-note {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--warning-bg);
  line-height: 1.6;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.score-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.score-box strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
}

.primary, .secondary, .danger {
  padding: 10px 18px;
  font-weight: 700;
}

.primary { color: white; background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.secondary { color: #342e2b; background: white; border-color: var(--line); }
.danger { color: var(--wrong); background: white; border-color: #efaaa4; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.progress-track {
  height: 8px;
  margin: 10px 0 22px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5d9c8;
}

.progress-bar { height: 100%; background: var(--accent); }

.visual {
  margin: 18px 0 24px;
  padding: 18px;
  border: 2px solid #9a856a;
  border-radius: 12px;
  background: #faf6ef;
}

.visual-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  font-weight: 800;
}

.visual-symbol { font-size: 1.6rem; }
.visual-brief { margin: 0; color: #6b5d52; }

.visual-table { border-color: #e5d9c8; background: #f7f1e7; }
.table-stage { position: relative; display: grid; place-items: center; min-height: 236px; }
.table-center { position: absolute; display: grid; place-items: center; width: 41%; min-height: 66px; border: 2px solid #342e2b; border-radius: 50%; font-size: 0.76rem; font-weight: 800; text-align: center; }
.seat-grid { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 102px 10px; width: 100%; }
.seat { display: grid; gap: 2px; min-height: 57px; padding: 8px; border: 1px solid #342e2b; border-radius: 10px; background: white; text-align: center; }
.seat strong { font-size: 1rem; }
.seat span { font-size: 0.75rem; font-weight: 700; }
.seat.empty { opacity: 0.38; }

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.card-token {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 58px;
  padding: 5px;
  border: 1px solid #9a856a;
  border-radius: 7px;
  background: white;
  font-weight: 800;
  box-shadow: 0 2px 4px rgb(24 32 43 / 10%);
}

.card-token.red { color: #c1261d; }

.stem { font-size: 1.08rem; font-weight: 650; }

.options {
  display: grid;
  gap: 12px;
  margin: 22px 0;
  padding: 0;
  border: 0;
}

.option {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.option:hover { border-color: #9e8057; }
.option input { position: absolute; opacity: 0; pointer-events: none; }

.option-id {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #9a856a;
  border-radius: 50%;
  font-weight: 800;
}

.option:has(input:checked) { border-color: var(--accent); background: #f0e4d5; }
.option:has(input:checked) .option-id { color: white; border-color: var(--accent); background: var(--accent); }
.option.locked { cursor: default; }
.option.correct { border-color: var(--correct); background: var(--correct-bg); }
.option.wrong { border-color: var(--wrong); background: var(--wrong-bg); }

.feedback {
  margin-top: 22px;
  padding: 18px;
  border-radius: 10px;
  border-left: 5px solid;
}

.feedback.correct { border-color: var(--correct); background: var(--correct-bg); }
.feedback.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.feedback h3 { margin-bottom: 8px; }

.category-list { padding-left: 20px; }
.incorrect-list { padding-left: 24px; }

.error { border-color: #efaaa4; }
.error-message { color: var(--wrong); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 520px) {
  body { background-image: none; }
  .app-shell { padding: 26px 10px 32px; }
  .panel { position: relative; z-index: 0; isolation: isolate; overflow: hidden; border-radius: 20px; padding: 22px 16px; }
  .panel::before { position: absolute; z-index: -1; inset: 0; background: url("./assets/mosaic-flow.png") center top / 115% auto repeat-y; opacity: 0.28; content: ""; pointer-events: none; }
  .panel > * { position: relative; }
  .score-box, .option, .visual { background: rgb(255 255 255 / 86%); }
  .score-grid { grid-template-columns: 1fr; }
  .button-row { display: grid; }
  .button-row button { width: 100%; }
  .option { grid-template-columns: 34px 1fr; padding: 10px; }
  .visual-table { padding: 12px; }
  .table-stage { min-height: 224px; }
  .seat-grid { gap: 94px 5px; }
  .seat { padding: 6px 2px; }
  .seat span { font-size: 0.65rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .progress-bar { transition: width 180ms ease; }
}
