:root {
  --ink: #23303a;
  --ink-soft: #5d6d78;
  --bg: #e9f3f6;
  --paper: #fdfdfb;
  --line: #cfe0e6;
  --primary: #1f6f9a;
  --primary-dark: #154e6e;
  --sea: #8fd0e8;
  --sea-deep: #5fb2d6;
  --sand: #f3dfae;
  --sand-edge: #9c7a3c;
  --plank: #8a5a2b;
  --ok: #4caf50;
  --ng: #d9483b;
  --gold: #ffd34d;
  --font: "Zen Maru Gothic", system-ui, sans-serif;
  --num: "Mochiy Pop One", "Zen Maru Gothic", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.7; line-break: strict; }
.hidden { display: none !important; }
.nw { white-space: nowrap; }

.g-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 540px; margin: 0 auto; font-size: 13px; font-weight: 900; }
.g-brand { color: var(--ink-soft); text-decoration: none; }
.g-title { flex: 1; text-align: center; }
.g-head [data-mg-account] a { color: var(--primary-dark); text-decoration: none; }

main { max-width: 540px; margin: 0 auto; padding: 0 12px 24px; }
.play { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.bar { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 5px 6px; text-align: center; min-width: 0; }
.lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { font: 400 22px/1.2 var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.note { margin: 0 0 6px; min-height: 1.6em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 900; color: var(--primary-dark); text-align: center; }
.note.warn { color: #b3402e; }

/* 盤（SVG） */
.board-wrap { display: flex; justify-content: center; touch-action: none; }
.board { display: block; width: 100%; max-width: 520px; touch-action: none; cursor: pointer; filter: drop-shadow(0 8px 16px rgba(20, 70, 100, 0.22)); }
.sea-bg { fill: var(--sea); }
.dot { fill: rgba(255, 255, 255, 0.55); }
.plank { stroke: var(--plank); stroke-width: 8; stroke-linecap: round; }
.br.lit .plank { stroke: #e2a33a; transition: stroke 0.3s; }
.pvl { stroke: rgba(255, 255, 255, 0.85); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 14 10; }
.pv.ng .pvl { stroke: rgba(217, 72, 59, 0.85); }
.pv.off .pvl { stroke: rgba(35, 48, 58, 0.45); }
.fl { stroke-width: 14; stroke-linecap: round; }
.flash.ok .fl { stroke: #ffe066; animation: blink 0.7s ease-in-out 3; }
.flash.ng .fl { stroke: #ff6b5a; animation: blink 0.7s ease-in-out 3; }
@keyframes blink { 50% { opacity: 0.25; } }
.isl .ring { fill: transparent; }
.isl .body { fill: var(--sand); stroke: var(--sand-edge); stroke-width: 5; }
.isl .num { font: 400 46px/1 var(--num); fill: #3b2f1c; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.isl.ok .body { fill: #bfe6b2; stroke: #3f8f3a; }
.isl.ok .num { fill: #24561f; }
.isl.over .body { fill: #f6c3bb; stroke: var(--ng); }
.isl.over .num { fill: #8a2418; }
.isl.sel .ring { fill: rgba(255, 211, 77, 0.75); }
.isl.hint .ring { fill: rgba(255, 224, 102, 0.9); animation: blink 0.7s ease-in-out 3; }
.isl.lh .body { fill: #e6eef2; stroke: #4c6878; stroke-dasharray: 8 5; }
.isl.lh.lit .body { stroke-dasharray: none; }
.isl.lh .beam { fill: transparent; }
.isl.lh.reveal .body { fill: #fff3c4; stroke: #c48a00; stroke-dasharray: none; }
.isl.lh.reveal .beam { fill: rgba(255, 211, 77, 0.55); animation: glow 1.2s ease-in-out infinite; }
.isl.lh.reveal .lh-ico { opacity: 0.25; }
.isl.lh .lh-num { font-size: 50px; fill: #6b4a00; }
.isl.lh .lh-tag { fill: #4c6878; stroke: #fff; stroke-width: 3; }
.isl.lh .lh-q { font-size: 22px; font-weight: 700; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.isl.lh.reveal .lh-tag, .isl.lh.reveal .lh-q { display: none; }
@keyframes glow { 50% { fill: rgba(255, 211, 77, 0.15); } }
.boat { filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.25)); pointer-events: none; }
.sailing .board { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .flash .fl, .isl.hint .ring, .isl.lh.reveal .beam { animation: none; }
}

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.tools.three { grid-template-columns: repeat(3, 1fr); }
.tool { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: 900 12px/1 var(--font); cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool.arm { background: #fde3df; border-color: var(--ng); color: #8a2418; }
.kbd { margin: 8px 0 0; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* タイトル・結果（盤を隠して全体を見せる） */
.play.menu .bar, .play.menu .note, .play.menu .board-wrap, .play.menu .tools, .play.menu .kbd { display: none; }
.card-ui { width: 100%; max-width: 420px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 10px 30px rgba(20, 70, 100, 0.1); }
.logo-art { display: flex; justify-content: center; }
.logo { margin: 0; font: 400 28px/1.3 var(--num); letter-spacing: 0.04em; white-space: nowrap; color: var(--primary-dark); }
.day { margin: 2px 0 10px; font-size: 13px; color: var(--ink-soft); font-weight: 900; }
.daily-box { border: 2px solid var(--primary); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.daily-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); letter-spacing: 0.1em; }
.daily-name { font: 900 22px/1.4 var(--font); color: var(--primary-dark); }
.daily-lh { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; padding: 6px 8px; border-radius: 10px; background: #fff3c4; font-size: 12px; font-weight: 700; text-align: left; }
.daily-lh svg { flex: none; width: 20px; height: 22px; }
.daily-note { margin: 6px 0 8px; font-size: 12px; color: var(--ink-soft); }
.done { font-size: 14px; font-weight: 900; margin-top: 6px; }
.free-lbl { font-size: 12px; font-weight: 900; color: var(--ink-soft); margin: 6px 0 4px; }
.free-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.howto { list-style: none; margin: 12px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 12px; text-align: left; font-size: 13px; font-weight: 700; }
.howto li { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.howto .num { flex: none; font-weight: 900; color: var(--primary); }
.stats { font-size: 12px; color: var(--ink-soft); font-weight: 700; margin: 10px 0 0; }

.btn { display: block; width: 100%; margin: 8px 0; padding: 13px 10px; border: 0; border-radius: 14px; font: 900 16px/1.2 var(--font); cursor: pointer; background: var(--bg); color: var(--ink); touch-action: manipulation; }
.btn small { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-top: 3px; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn.lv { margin: 0; font-size: 15px; padding: 10px 2px; background: #dceef5; }
.btn.sub { font-size: 14px; }
.btn.ghost { background: transparent; border: 2px solid var(--line); color: var(--ink-soft); font-size: 14px; }
.btn.x { background: #000; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.clear-lbl { font-size: 13px; font-weight: 900; color: var(--primary-dark); }
.clear-time { font: 400 56px/1.1 var(--num); font-variant-numeric: tabular-nums; margin: 6px 0; }
.clear-sub { margin: 0; font-size: 14px; font-weight: 700; }
.c-lh { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; padding: 4px 12px; border-radius: 999px; background: #fff3c4; font-size: 14px; font-weight: 900; }
.c-lh svg { width: 20px; height: 22px; }
.c-lh b { font: 400 20px/1 var(--num); color: #8a5a00; }
.c-detail { list-style: none; margin: 8px auto 0; padding: 8px 12px; max-width: 300px; background: var(--bg); border-radius: 12px; text-align: left; font-size: 13px; font-weight: 700; }
.c-detail li { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.c-detail li b { font-weight: 900; }
.best { display: inline-block; margin: 8px 4px 0; padding: 2px 12px; border-radius: 999px; background: var(--gold); font-weight: 900; font-size: 13px; }
.rank { margin: 12px 0; padding: 8px; background: var(--bg); border-radius: 14px; }
.rank-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); }
.rank-name { font: 900 22px/1.4 var(--font); }
.rank-basis { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.c-note { margin: 8px 0; padding: 8px 10px; border-radius: 12px; background: #fff6dd; font-size: 13px; font-weight: 700; text-align: left; }
.share { margin: 8px 0; }
.pstreak { display: inline-block; margin: 8px 4px 0; padding: 2px 12px; border-radius: 999px; background: #e6f6ee; color: #1f6b47; font-weight: 900; font-size: 13px; }

.toast { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); z-index: 40; width: max-content; max-width: calc(100% - 24px); padding: 10px 18px; border-radius: 16px; background: rgba(35, 48, 58, 0.92); color: #fff; font-weight: 900; font-size: 14px; text-align: center; pointer-events: none; }

/* 下の解説（ポータルと同じ決まり: 行間 1.85・段落の間は1行分・見出しは前を広く後ろを狭く） */
.guide { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px 12px; font-size: 15px; line-height: 1.85; }
.guide p { margin: 0 0 1em; }
.guide h2 { font: 900 19px/1.4 var(--font); margin: 32px 0 12px; padding-left: 10px; border-left: 5px solid var(--primary); }
.guide h2:first-child { margin-top: 0; }
.guide h3 { display: flex; align-items: baseline; gap: 2px; font-size: 16px; margin: 22px 0 6px; line-height: 1.5; }
.guide h3 .num { flex: none; }
.guide ul { padding-left: 1.3em; margin: 0 0 1em; }
.guide li { margin: 6px 0; }
.guide .steps { list-style: none; padding: 0; }
.guide .steps li { display: flex; align-items: baseline; gap: 6px; }
.guide .steps .num { flex: none; font-weight: 900; color: var(--primary); }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details p { margin: 8px 0 4px; }
.guide summary { font-weight: 900; cursor: pointer; }
.guide a { color: var(--primary-dark); }
.g-foot { max-width: 540px; margin: 0 auto; padding: 14px 16px 28px; font-size: 12px; text-align: center; }
.g-foot a { color: var(--ink-soft); }

.card-ui .mg-box { background: var(--bg); border-color: transparent; }
@media (max-width: 360px) { main { padding: 0 8px 24px; } }

/* 遊んでいるあいだ（html.hashi-play）: ページが指でずれない・サイトの見出しを隠して盤を大きく */
html.hashi-play, html.hashi-play body { overscroll-behavior: none; }
html.hashi-play .g-head { display: none; }
html.hashi-play main { padding: 6px 6px 24px; }
