:root {
  color-scheme: light;
  --page-bg: #eed0ac;
  --surface: #fcf0df;
  --surface-muted: #f5e0c7;
  --surface-inset: #fffaf3;
  --ink: #32251d;
  --muted: #644f3c;
  --heading: #67431b;
  --border: #c8a885;
  --border-strong: #9f805e;
  --primary: #17632e;
  --primary-hover: #104b22;
  --button-tint: #e1f1dc;
  --accent: #5d287d;
  --warning: #954323;
  --grid-line: #c7c7c7;
  --route-line: #226a3d;
  --route-end: #873415;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --sans: "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 18px; }
body { margin: 0; min-width: 0; color: var(--ink); background: var(--page-bg); font: 400 1rem/1.8 var(--sans); }
button, input { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
input[type="checkbox"] { accent-color: var(--primary); width: 17px; height: 17px; margin: 0; }
a { color: var(--primary); text-underline-offset: .22em; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.32; margin: 0; letter-spacing: .015em; text-wrap: pretty; }
h1 { color: var(--heading); font-size: clamp(1.75rem, 4.1vw, 3.1rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.45rem, 2.7vw, 2rem); }
h3 { font-size: 1.12rem; }
.wrap { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 10; top: 8px; left: 8px; padding: 8px 14px; background: var(--surface); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.site-header { position: relative; z-index: 2; border-bottom: 1px solid var(--border); background: var(--page-bg); }
.header-inner { min-height: 70px; display: flex; align-items: center; gap: 30px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; text-decoration: none; }
.brand img { flex: none; border-radius: var(--radius-sm); }
.primary-nav { display: flex; gap: 24px; margin-left: auto; }
.primary-nav a, .header-tool, .mobile-nav a { color: var(--muted); text-decoration: none; font-weight: 650; font-size: .94rem; }
.primary-nav a:hover, .mobile-nav a:hover { color: var(--primary); }
.header-tool { color: var(--primary); padding: 7px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.mobile-nav { display: none; margin-left: auto; }
.mobile-nav nav { position: absolute; top: calc(100% - 2px); right: 16px; min-width: 12rem; display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px; }
.mobile-nav nav a { display: block; padding: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 11px; min-height: 48px; padding: 8px 17px; border: 1px solid transparent; border-radius: var(--radius-sm); line-height: 1.45; font-weight: 750; text-align: center; text-decoration: none; }
.button-primary { color: var(--primary); background: #fff; border-color: var(--primary); }
.button-primary:hover { color: var(--primary-hover); background: var(--button-tint); }
.button-reset { color: var(--warning); border-color: var(--warning); background: #fff; }
.button-reset:hover { background: #fff0e6; }
.button-secondary { color: var(--ink); background: var(--surface-muted); border-color: var(--border-strong); }
.button-secondary:hover, .compact-button:hover, .brushes button:hover { color: var(--primary); border-color: var(--primary); }
.section { padding-block: clamp(34px, 5.5vw, 68px); }
.section-band { background: var(--surface-muted); border-block: 1px solid var(--border); }
.section-lead { margin: 10px 0 22px; color: var(--muted); }
.cards, .steps, .notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: 18px; }
.feature-card { color: var(--ink); text-decoration: none; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.feature-card:hover { color: var(--ink); border-color: var(--primary); }
.feature-card p, .steps p, .example-card p { color: var(--muted); margin-top: 6px; }
.feature-symbol { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--primary); background: var(--page-bg); font-weight: 800; }
.amber { color: var(--warning); }
.card-arrow, .text-link { color: var(--primary); }
.text-link { display: inline-block; font-weight: 700; }
button.text-link { border: 0; padding: 0; background: none; text-align: left; text-decoration: underline; text-underline-offset: .22em; min-height: 44px; }
.room-preview { overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-inset); }
.preview-heading, .room-preview figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 10px 14px; color: var(--muted); font-size: .875rem; }
.preview-heading { border-bottom: 1px solid var(--border); color: var(--ink); font-weight: 680; }
.preview-count { font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.mini-board, .board-frame { position: relative; }
.mini-board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(10, minmax(0, 1fr)); aspect-ratio: 6 / 5; }
.mini-board canvas, .board-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mini-cell, .tile { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; border: 0; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); background: #fff; font-size: clamp(.62rem, 1.2vw, .78rem); line-height: 1; }
[data-tile="B"] { color: #fff; background: #9027ad; }
[data-tile="D"] { color: #3d2817; background: #e2bc5b; }
[data-tile="W"] { color: #213e4e; background: #add8e6; }
.mini-cell[data-marker] { font-weight: 800; color: var(--ink); background: #d7ead2; }
.mini-cell[data-marker="end"] { color: var(--warning); }
.example-card .room-preview { border-radius: var(--radius-sm); }
.example-card .text-link { margin: 8px 16px 0 0; }
.fine-print { color: var(--muted); font-size: .88rem; margin-top: 12px; }
.steps { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 0; padding: 0; list-style-position: inside; }
.steps li::marker { color: var(--primary); font-weight: 800; }
.steps h3 { display: inline; }
.notes-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.source-card { align-self: start; display: grid; gap: 9px; }
.video-card { position: relative; aspect-ratio: 16 / 9; max-width: 680px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-muted); }
.video-card iframe, .video-trigger { position: absolute; width: 100%; height: 100%; inset: 0; border: 0; }
.video-trigger { color: var(--ink); background: transparent; font-weight: 700; }
.video-trigger span { color: var(--primary); margin-right: 8px; }
.video-trigger:hover { color: var(--primary); }
.video-trigger:focus-visible { outline-offset: -5px; }
.faq h2 { margin-bottom: 14px; }
.faq details { border-block-start: 1px solid var(--border); }
.faq details:last-child { border-block-end: 1px solid var(--border); }
.faq summary { padding: 13px 0; min-height: 44px; font-weight: 720; }
.faq details p { color: var(--muted); margin: 0 0 14px; padding-left: 17px; max-width: 74ch; }
.site-footer { padding: 48px 0 28px; border-top: 1px solid var(--border); background: var(--surface-inset); }
.footer-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 42px; }
.footer-brand { max-width: 510px; }
.footer-logo { font-size: 1.05rem; font-weight: 800; letter-spacing: -.025em; }
.footer-logo img { border-radius: 10px; }
.footer-brand > p { margin-top: 13px; color: var(--muted); font-size: .85rem; line-height: 1.7; }
.footer-email { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; margin-top: 8px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: .79rem; font-weight: 700; text-decoration: none; }
.footer-email svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(120px, auto)); gap: 36px; }
.footer-group { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.footer-group p { margin-bottom: 3px; font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.footer-group a { color: var(--muted); font-size: .84rem; font-weight: 650; text-decoration: none; }
.footer-email:hover, .footer-group a:hover { color: var(--primary-hover); text-decoration: underline; }
.footer-bottom { margin-top: 34px; padding-top: 17px; border-top: 1px solid var(--border); }
.footer-bottom p { color: var(--muted); font-size: .75rem; line-height: 1.6; }
.page-intro { padding-block: 44px; }
.page-intro h1 { font-size: clamp(1.75rem, 4.1vw, 3.1rem); margin-top: 6px; }
.page-intro > p, .prose > p { color: var(--muted); margin-top: 12px; }
.prose { max-inline-size: 80ch; }
.prose h2:not(:first-child) { margin-top: 30px; }
.prose h3:not(:first-child) { margin-top: 22px; }
.after-grid { margin-top: 28px; }
.guide { display: grid; gap: 34px; }
.back-link { text-decoration: none; font-weight: 680; font-size: .9rem; }
.tool-intro { padding-block: 26px 20px; }
.tool-intro > p { color: var(--muted); margin-top: 9px; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor, .results { padding: clamp(12px, 2.4vw, 24px); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.panel-heading h2 { font-size: 1.34rem; }
.width-control { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.width-stepper { display: flex; }
.width-stepper .compact-button { width: 44px; padding: 0; }
.width-stepper #smaller { background: #f7cebb; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.width-stepper #larger { background: #cce9bd; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.width-stepper #room-width { appearance: textfield; width: 3.1rem; text-align: center; border-radius: 0; border-inline: 0; }
.width-stepper #room-width::-webkit-inner-spin-button { appearance: none; }
input[type="number"], input[type="url"] { background: var(--surface-inset); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-height: 38px; padding: 3px 8px; }
input[type="number"] { width: 4.1rem; }
.brushes, .map-actions, .conditions, .board-tools, .replay-actions { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.brushes button, .compact-button { min-height: 44px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-inset); font-weight: 680; font-size: .88rem; }
.brushes button { display: inline-flex; align-items: center; gap: 4px; }
.brushes button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.compact-button:disabled { opacity: .55; cursor: default; }
.swatch { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 3px; }
.board-tools { justify-content: space-between; color: var(--muted); font-size: .81rem; margin-block: 8px; }
.zoom-pan { display: inline-flex; gap: 3px; }
.board-scroll:not(.zoomed) + .coordinate-editor { margin-top: 8px; }
.board-scroll { overflow: auto; border: 1px solid var(--grid-line); border-radius: 2px; max-width: 100%; }
.work-actions { border-top: 1px solid var(--border); padding-top: 10px; }
.mobile-feedback { display: none; }
.mobile-feedback:not(:has(a:not([hidden]))):has(span:empty) { display: none; }
.board-scroll.zoomed .board-frame { min-width: 740px; }
.board { display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); grid-template-rows: repeat(var(--size), minmax(0, 1fr)); aspect-ratio: 1; touch-action: none; user-select: none; }
.tile:focus-visible { outline-offset: -2px; z-index: 1; }
.tile:hover { box-shadow: inset 0 0 0 1px var(--primary); }
.coordinate-editor { margin-block: 8px; color: var(--muted); font-size: .9rem; }
.coordinate-editor summary { min-height: 44px; display: list-item; align-content: center; }
.coordinate-editor form { display: flex; flex-wrap: wrap; gap: 8px; }
.conditions { margin-block: 8px; gap: 6px 16px; }
.conditions label, .filter { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--muted); cursor: pointer; }
.share-field { display: grid; gap: 4px; margin-top: 10px; }
.message:empty { display: none; }
.result-status { color: var(--muted); }
.route-summary { margin-top: 3px; font-weight: 750; }
.route-faces { color: var(--accent); font-size: .88rem; margin-block: 8px; }
.route-list { list-style: none; display: grid; gap: 6px; max-height: 440px; overflow: auto; margin: 12px 0; padding: 2px 4px; }
.route-list button { width: 100%; min-height: 48px; text-align: left; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-inset); }
.route-list button[aria-pressed="true"] { border-color: var(--primary); }
.route-list button span { color: var(--muted); font-size: .84rem; }
.sample-controls { border-top: 1px solid var(--border); padding-top: 12px; display: grid; }
@media (max-width: 760px) {
  .wrap { width: min(1120px, calc(100% - 32px)); }
  .header-inner { min-height: 62px; gap: 10px; }
  .header-tool, .primary-nav { display: none; }
  .mobile-nav { display: block; }
  .mobile-nav summary { min-height: 44px; align-content: center; color: var(--muted); font-size: .88rem; font-weight: 700; }
  .cards, .steps, .notes-grid, .work-grid { grid-template-columns: minmax(0, 1fr); }
  .site-footer { padding-top: 32px; }
  .footer-inner { flex-direction: column; gap: 24px; }
  .footer-nav { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .footer-group { gap: 0; }
  .footer-group a { display: flex; align-items: center; min-height: 44px; line-height: 1.4; }
  .footer-email { min-height: 44px; }
  .tool-intro { padding-block: 16px 12px; }
  .mobile-feedback { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
}
@media (max-width: 440px) {
  .brushes button { padding-inline: 6px; font-size: .81rem; }
  .brushes .swatch { width: 16px; height: 18px; }
  .board-tools { flex-wrap: nowrap; }
  .board-tools .compact-button { white-space: nowrap; }
}
@media (max-width: 390px) {
  .wrap { width: calc(100% - 24px); }
  .button { padding-inline: 12px; }
  .brand { font-size: .93rem; }
  .brushes { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
