@charset "UTF-8";
:root {
  color-scheme: light;
  --paper: #f7f3e8; --card: #fffcf4; --ink: #303a38; --muted: #71776e;
  --line: #dbe0d3; --accent: #28675f; --accent-hover: #1d514b; --red: #b84e3b;
  --draft: #f3d875; --shadow: 0 8px 24px #333b2d09; --soft: #e8eee4;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  color: var(--ink); background: var(--paper); font-synthesis: none;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #192a27; --card: #203731; --ink: #e6e8d9; --muted: #abb9ac;
  --line: #3c5249; --accent: #afcbb3; --accent-hover: #c5ddc9; --red: #f49a80;
  --draft: #856d33; --shadow: 0 10px 28px #0002; --soft: #2d4439;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100svh; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 28px 28px; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; background: transparent; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }
a { color: inherit; }
select, input { border: 1px solid var(--line); border-radius: 6px; background: var(--card); min-height: 46px; padding: 9px 12px; max-width: 100%; }
select { width: 100%; }
.top-tools { max-width: 960px; padding: 18px 24px; margin: auto; display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.theme-label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.theme-label select { width: 166px; min-height: 36px; font-size: 11px; padding: 5px; }
.icon-button { font-size: 11px; color: var(--muted); min-width: 46px; min-height: 44px; }
main { width: min(860px, calc(100% - 48px)); margin: 10px auto 44px; }
.loading { text-align: center; margin-top: 25vh; color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .17em; color: var(--muted); margin: 0 0 18px; }
.hero { min-height: 294px; position: relative; padding: 32px 32px 34px; }
.hero .eyebrow span { margin-left: 20px; font-size: 9px; letter-spacing: .12em; }
.hero h1 { margin: 0 0 14px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-weight: 800; font-size: clamp(60px, 8vw, 84px); letter-spacing: .08em; line-height: 1.3; }
.hero h1>span:first-child { position: relative; }
.hero h1>span:first-child::after { content: ""; position: absolute; height: 4px; width: 98%; background: var(--red); top: 52%; left: 0; transform: rotate(-14deg); border-radius: 4px; }
.title-dot { color: var(--red); }
.hero-copy { font-size: 18px; font-weight: 700; letter-spacing: .13em; margin: 12px 0; }
.hero-sub { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.hero-sticks { position: absolute; right: 16px; top: 52px; width: 300px; transform: rotate(5deg); }
.hero-sticks>div { display: flex; justify-content: center; gap: 18px; height: 44px; }
.hero-sticks i { display: inline-block; height: 31px; width: 4px; background: var(--ink); border-radius: 4px; transform: rotate(-5deg); position: relative; }
.hero-sticks i:nth-child(even) { transform: rotate(3deg); }
.hero-sticks i.crossed::after { content: ""; width: 25px; height: 3px; position: absolute; background: var(--red); left: -10px; top: 15px; transform: rotate(-37deg); }
.play-panel, .paper-card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.play-panel { padding: 28px 32px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; font-size: 13px; font-weight: 700; letter-spacing: .1em; }
.pencil-mark { color: var(--red); letter-spacing: .25em; font-size: 15px; transform: rotate(-7deg); }
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.mode-tabs button { text-align: left; border: 1px solid var(--line); border-radius: 5px; padding: 15px 14px; min-height: 104px; transition: background .15s; }
.mode-tabs button[aria-pressed="true"] { background: var(--soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-number { font-size: 10px; color: var(--muted); display: block; margin-bottom: 10px; letter-spacing: .08em; }
.mode-tabs strong { display: block; font-size: 14px; }
.mode-tabs small { display: block; color: var(--muted); font-size: 10px; margin-top: 7px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid label { display: grid; gap: 9px; color: var(--muted); font-size: 11px; }
.settings-grid select { color: var(--ink); font-size: 13px; }
.wide { grid-column: 1 / -1; }
.small-note { color: var(--muted); font-size: 11px; line-height: 1.9; margin: 16px 0 20px; }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; gap: 18px; min-height: 50px; border-radius: 5px; text-decoration: none; font-size: 14px; font-weight: 700; }
.primary { background: var(--accent); color: var(--card); width: 100%; padding: 12px 20px; letter-spacing: .08em; transition: background .15s; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary span { font-size: 20px; }
.primary:disabled { background: var(--soft); color: var(--muted); }
.secondary { background: var(--card); border: 1px solid var(--line); padding: 10px 18px; }
.text-button { color: var(--muted); font-size: 12px; min-height: 44px; padding: 10px 4px; text-decoration: underline; text-underline-offset: 5px; }
.play-panel>.text-button { display: block; margin: 8px auto 0; }
.menu-footer { padding: 20px 4px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-footer>span { font-size: 10px; color: var(--muted); }
.online-entry { display: grid; gap: 14px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.join-row input { width: 100%; text-transform: uppercase; letter-spacing: .15em; }
.message { border: 1px solid var(--red); color: var(--red); border-radius: 5px; background: var(--card); padding: 14px; margin: 12px 0 18px; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.game-screen { max-width: 620px; margin: 8px auto; }
.game-heading { display: flex; justify-content: space-between; align-items: center; padding: 16px 2px 22px; }
.game-heading .eyebrow { margin-bottom: 7px; font-size: 10px; }
.game-heading h1 { font-family: "Yu Mincho", serif; font-size: 32px; letter-spacing: .15em; margin: 0; }
.game-heading h1 span { color: var(--red); }
.rule-strip { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); border-block: 1px solid var(--line); padding: 12px 2px; }
.rule-strip strong { color: var(--red); margin-left: 2px; }
.turn-heading { display: flex; gap: 10px; align-items: center; min-height: 76px; }
.turn-heading h2 { font-size: 16px; letter-spacing: .06em; margin: 0; }
.turn-dot { width: 8px; height: 8px; border: 1px solid var(--muted); border-radius: 50%; }
.turn-dot.active { background: var(--accent); border-color: var(--accent); }
.clock { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.connection-note { margin: -4px 0 16px; font-size: 12px; color: var(--red); }
.board { padding: 30px 12px 32px; position: relative; background-image: repeating-linear-gradient(transparent, transparent 27px, var(--line) 27px, var(--line) 28px); }
.board-label { display: block; text-align: right; margin: -12px 8px 20px; font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.stick-row { display: flex; justify-content: safe center; min-height: 72px; overflow-x: hidden; max-width: 100%; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.stick { min-width: 0; flex: 0 1 44px; height: 70px; position: relative; padding: 0; border-radius: 5px; touch-action: pan-y pinch-zoom; }
.stick span { height: 43px; width: 4px; display: block; margin: auto; background: var(--ink); border-radius: 4px; transform: rotate(-3deg); }
.stick:nth-child(3n) span { transform: rotate(2deg); }
.stick.selected { background: var(--draft); }
.stick.selected::after, .stick.gone::after { content: ""; width: calc(100% - 2px); height: 3px; background: var(--red); border-radius: 4px; transform: none; position: absolute; left: 1px; top: 33px; }
.stick.gone { opacity: .25; }
.stick.last-move { opacity: .75; }
.board-count { display: block; margin: 20px 6px -16px; text-align: center; color: var(--muted); font-size: 11px; }
.move-panel { text-align: center; padding-top: 20px; min-height: 132px; }
.move-panel p { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.result-panel { text-align: center; padding-top: 18px; }
.result-panel>p { font-size: 13px; line-height: 1.8; }
.result-panel .stats { font-size: 11px; color: var(--muted); }
.game-footer { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.game-footer>span { font-size: 11px; color: var(--muted); }
.lobby-screen { max-width: 520px; margin: 50px auto; padding: 36px; text-align: center; }
.lobby-screen h1 { font-family: "Yu Mincho", serif; font-size: 32px; letter-spacing: .1em; line-height: 1.5; }
.lobby-screen>p { font-size: 12px; line-height: 1.8; }
.room-code { font-family: ui-monospace, monospace; font-size: 40px; letter-spacing: .15em; color: var(--accent); margin: 24px 0; }
.waiting-indicator { color: var(--muted); }
.waiting-indicator span { display: inline-block; background: var(--accent); border-radius: 50%; width: 7px; height: 7px; margin-right: 5px; }
.qr { background: #fff; padding: 8px; margin: 16px auto; display: block; border-radius: 5px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-buttons>* { font-size: 12px; }
dialog { max-width: min(540px, calc(100% - 32px)); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 20px 100px #0004; }
dialog::backdrop { background: #10272399; }
dialog h2 { font-size: 22px; }
dialog p, dialog li { font-size: 13px; line-height: 1.9; }
dialog ol { padding-left: 20px; }
dialog .primary { margin-top: 12px; }
.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: 620px) {
  main { width: calc(100% - 32px); margin-top: 2px; }
  .top-tools { padding: 12px 14px; gap: 6px; }
  .theme-label { font-size: 0; }
  .theme-label select { width: 132px; font-size: 10px; }
  .hero { min-height: 290px; padding: 32px 8px 22px; }
  .hero .eyebrow { font-size: 9px; }
  .hero .eyebrow span { margin-left: 12px; }
  .hero h1 { font-size: 61px; }
  .hero-copy { font-size: 15px; position: relative; z-index: 1; }
  .hero-sub { font-size: 10px; }
  .hero-sticks { width: 170px; top: 99px; right: -1px; opacity: .16; }
  .hero-sticks>div { gap: 14px; height: 35px; }
  .hero-sticks i { height: 26px; width: 3px; }
  .play-panel { padding: 22px 18px; }
  .mode-tabs { gap: 6px; }
  .mode-tabs button { padding: 12px 8px; min-height: 104px; }
  .mode-tabs strong { font-size: 12px; }
  .mode-tabs small { font-size: 9px; line-height: 1.6; }
  .settings-grid { gap: 14px 10px; }
  .settings-grid select { font-size: 11px; padding: 8px; }
  .menu-footer { flex-direction: column; gap: 0; padding: 14px 0; }
  .section-title { font-size: 12px; }
  .board { padding-inline: 8px; }
  .game-heading { padding-top: 14px; }
  .lobby-screen { padding: 28px 20px; margin: 30px auto; }
  .game-footer { flex-wrap: wrap; gap: 4px; }
  .game-footer .text-button { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
/* Marukanido return chip — shared across the o-kani.com games. Spec: SPEC.md next to this file. */
.okani-home {
  position: fixed;
  z-index: 2147483000;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 32px;
  padding: 0 12px 0 9px;
  border: 1px solid rgba(37, 39, 33, .18);
  border-radius: 999px;
  background: rgba(244, 241, 232, .94);
  color: #252721;
  font: 700 12px/1 "Noto Sans CJK JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  letter-spacing: .06em;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  -webkit-tap-highlight-color: transparent;
}
.okani-home:hover { background: #fff; color: #252721; }
.okani-home:focus-visible { outline: 3px solid #c93824; outline-offset: 3px; }
.okani-home__mark { display: block; flex: none; width: 18px; height: 18px; }
@media print { .okani-home { display: none; } }

body[data-playing="true"] .okani-home { display: none; }
