
  /* ブラウザやスマホの設定で文字だけが勝手に拡大されないようにする（レイアウト崩れ防止） */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  :root {
    --wall: #f4ead6;
    --ink: #3a2a1e;
    --red: #d8282f;
    --orange: #f08a24;
    --panel: #fffdf6;
    --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Meiryo", system-ui, sans-serif;
    color-scheme: light;
  }
  [hidden] { display: none !important; }
  html, body { height: 100%; margin: 0; }
  body {
    background: var(--wall);
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.35) 0 22px, rgba(255,255,255,0) 22px 44px);
    color: var(--ink);
    font-family: var(--font);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
  .app { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; }
  header {
    position: relative; z-index: 100; width: 100%; max-width: 560px; box-sizing: border-box;
    height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
  }
  .top {
    position: relative; z-index: 100; color: #fff; background: rgba(58,42,30,0.75); text-decoration: none;
    font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 999px;
  }
  /* タイトルとベストは画面に出さない（h1 は読み上げ用に残す） */
  h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
  .best { display: none; }
  .stage { flex: 1; width: 100%; display: flex; justify-content: center; align-items: flex-start; min-height: 0; }
  .paperWrap {
    position: relative; transform-origin: 50% 0; transition: transform 0.35s ease;
    box-shadow: 0 3px 10px rgba(80,50,20,0.25); background: #fffaf0;
  }
  .paperWrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  #paper { touch-action: none; cursor: crosshair; }
  #stamps { pointer-events: none; }
  .tape { position: absolute; top: -9px; width: 64px; height: 20px; background: rgba(250,230,160,0.8); pointer-events: none; }
  .tape.l { left: 14px; transform: rotate(-6deg); }
  .tape.r { right: 14px; transform: rotate(5deg); }
  .tray { width: 100%; max-width: 560px; box-sizing: border-box; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .colors { display: flex; gap: 3px; justify-content: center; align-items: flex-end; height: 66px; }
  .crayon {
    flex: 1; max-width: 42px; height: 58px; border: 0; padding: 0; cursor: pointer; position: relative;
    border-radius: 3px 3px 4px 4px; background: transparent; transition: transform 0.12s;
  }
  .crayon .body { position: absolute; left: 3px; right: 3px; bottom: 0; top: 12px; border-radius: 3px; }
  .crayon .tip { position: absolute; left: 7px; right: 7px; top: 2px; height: 12px; border-radius: 50% 50% 2px 2px; }
  .crayon .wrap { position: absolute; left: 3px; right: 3px; top: 22px; height: 16px; background: rgba(255,255,255,0.72); }
  .crayon .wrap::after { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 4px; background: currentColor; opacity: 0.85; }
  .crayon.img { height: 66px; background: no-repeat center 12px / 100% auto; transition: background-position 0.12s; }
  .crayon.img.sel { transform: none; background-position: center 0; }
  .crayon.sel { transform: translateY(-8px); }
  .crayon:focus-visible { outline: 3px solid #ffbf2e; outline-offset: 1px; }
  .btns { display: flex; gap: 8px; margin-top: 6px; }
  .btn {
    font-family: var(--font); font-weight: 800; font-size: 15px; border: 0; border-radius: 12px; padding: 10px 0;
    cursor: pointer; color: var(--ink); background: #fff; box-shadow: 0 3px 0 #c9b79a; flex: 1;
  }
  .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c9b79a; }
  .btn.done { background: var(--orange); color: #fff; box-shadow: 0 3px 0 #b65e12; flex: 1.6; font-size: 17px; }
  .btn.share { background: #16120f; color: #fff; box-shadow: 0 3px 0 #000; font-size: 13px; }
  .btn:focus-visible { outline: 3px solid #ffbf2e; outline-offset: 2px; }
  h1, .btn, .top { white-space: nowrap; }
  @media (max-width: 340px) {
    .help { width: 26px; height: 26px; font-size: 14px; line-height: 26px; }
    header { padding: 0 6px; }
    h1 { font-size: 13px; letter-spacing: 0; }
    .top { font-size: 11px; padding: 5px 8px; }
    .best { font-size: 10px; min-width: 0; }
    .btn { font-size: 12px; }
    .btn.done { font-size: 14px; }
    .btn.share { font-size: 10px; }
    .bubble { font-size: 12px; }
    .scoreLine .num { font-size: 32px; }
  }
  @media (max-width: 230px) { h1 { display: none; } }
  .toast {
    position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(58,42,30,0.88); color: #fff;
    padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 15px; z-index: 60; pointer-events: none;
    opacity: 0; transition: opacity 0.2s;
  }
  .toast.on { opacity: 1; }
  .result {
    position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 560px; box-sizing: border-box;
    background: var(--panel); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 16px rgba(80,50,20,0.25);
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); z-index: 50;
  }
  .rowT { display: flex; gap: 8px; align-items: flex-end; }
  #teacher { width: 112px; height: 140px; flex: none; }
  .bubble {
    position: relative; flex: 1; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px;
    font-size: 14px; font-weight: 700; line-height: 1.5; margin-bottom: 30px; min-height: 42px;
  }
  .bubble.hasStamps { padding-top: 26px; margin-top: 30px; }
  .stampRow { position: absolute; right: -4px; top: -40px; display: flex; pointer-events: none; }
  .stampRow canvas { width: 70px; height: 70px; margin-left: -12px; }
  .bubble::before {
    content: ""; position: absolute; left: -11px; bottom: 14px; border: 6px solid transparent; border-right: 9px solid var(--ink);
  }
  .bubble::after {
    content: ""; position: absolute; left: -7px; bottom: 15px; border: 5px solid transparent; border-right: 7px solid #fff;
  }
  .scoreLine { display: flex; align-items: baseline; gap: 8px; margin-top: -30px; padding-left: 120px; }
  .scoreLine .lab { font-size: 13px; font-weight: 800; }
  .scoreLine .num { font-size: 40px; font-weight: 900; color: var(--red); line-height: 1; }
  .scoreLine .rank { font-size: 16px; font-weight: 900; }
  .result .btns { margin-top: 12px; }
  .note { font-size: 11px; text-align: center; min-height: 14px; margin-top: 4px; }
  /* ---- 遊び方の説明。左上の ? で全画面に開き、× / Esc で閉じる。開いている間はゲームを止める ---- */
  .lefts { display: flex; align-items: center; gap: 6px; position: relative; z-index: 100; }
  .help {
    position: relative; z-index: 100;
    width: 31px; height: 31px; padding: 0; border: 0; border-radius: 50%;
    color: #fff; font: 800 16px/31px system-ui, sans-serif; text-align: center; cursor: pointer;
    background: rgba(58,42,30,0.75);
  }
  .help:focus-visible { outline: 3px solid #ffbf2e; outline-offset: 2px; }
  .guide {
    position: fixed; inset: 0; z-index: 1000;
    overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
    background: #F8F4E6; color: #5a4632;
    font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
    line-height: 1.8; line-break: strict;
    user-select: text; -webkit-user-select: text; -webkit-touch-callout: default;
  }
  .guide-close {
    position: fixed; top: 10px; left: 12px; z-index: 1001;
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
    background: #5a4632; color: #fff; font: 700 22px/40px system-ui, sans-serif; text-align: center; cursor: pointer;
    box-shadow: 0 2px 6px rgba(90, 70, 50, 0.3);
  }
  .guide-close:focus-visible, .guide-back:focus-visible { outline: 3px solid #AFD4E4; outline-offset: 2px; }
  .guide-in { max-width: 720px; margin: 0 auto; padding: 64px 18px 40px; }
  .guide h2 { margin: 0 0 12px; font-size: 22px; font-weight: 900; line-height: 1.4; }
  .guide h2 span { background: linear-gradient(transparent 62%, #AFD4E4 62%, #AFD4E4 92%, transparent 92%); padding: 0 4px; }
  .guide h3 { margin: 24px 0 6px; font-size: 16px; font-weight: 800; }
  .guide p { margin: 0 0 10px; }
  .guide ul { margin: 0 0 10px; padding-left: 1.4em; }
  .guide li { margin-bottom: 4px; }
  .guide kbd { font: 700 12px/1 ui-monospace, Menlo, monospace; padding: 2px 6px; border: 1px solid #e8e0cb; border-bottom-width: 2px; border-radius: 5px; background: #fff; }
  .guide a { color: #3a7495; }
  .guide-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 28px; }
  .guide-back {
    border: 0; border-radius: 999px; padding: 10px 24px; cursor: pointer;
    background: #5a4632; color: #fff; font: 700 15px "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  }
  .guide-foot a { font-weight: 700; text-decoration: none; }

.app>.foot,#btnCdReport{display:none!important}body:not(.game-ready) :is(#btnStart,#btnGo,#bStart,[data-mode],#btnPick){visibility:hidden}html{overflow-x:hidden}button{overflow-wrap:break-word}.res-btns button{line-height:1.12}