/* ハロウィン版の見た目（決定画像 A に寄せる）。背景はスマホ＝画像 B、PC＝画像 C。
   見た目だけ：ボタンの構造・押せる範囲・重なり順・ドラッグの設定・ゲームの動きには触れない。
   飾りとして足すのは背景の層（body::before）だけで、タップに反応しない（pointer-events: none）。
   通常版に戻す時は、index.html のこのファイルの読み込み1行を外す（または別テーマの CSS に替える）。
   原画：artwork-source/garden-halloween/（A 決定画像、B スマホ背景、C PC 背景） */
/* タイトル文字「Wan-Coco Bow Pop!」：決定画像の丸っこいロゴに合わせた、太く丸いフォント（Fredoka、Google Fonts、OFL）。
   読み込めない時は、端末の丸い文字（iPhone の SF Rounded など）で表示する */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@600;700&display=swap');


/* ---------- 背景：月夜の海辺の Wan-Coco Garden ---------- */
:root { background: #1b2048; }
body { background: transparent; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: #1b2048 url('theme/halloween/bg-mobile.webp') center / cover no-repeat;
}
@media (min-width: 721px) {
  body::before { background-image: url('theme/halloween/bg-pc.webp'); }
}
/* スマホ：画面の下（盤と案内の下のすき間）に、庭の手前のジャックオランタン（画像の高さの約71.5%、左右の端寄り）が見えるようにする。
   背景はページそのもの（html）に描き、上端に合わせる。かぼちゃの中心を、見えている画面（100dvh）の下から 45px に置く高さ（--bgh）に拡大する。
   ただし幅は画面幅以上。横に広い画面で幅が勝つ時は、上へずらしてかぼちゃの位置を保つ（下に空きは出さない）。
   左右の切れは片側 約40px まで（かぼちゃはほぼ全部入る）。ページの高さは増やさない */
@media (max-width: 720px) {
  :root {
    --bgh: max(calc(100vw / 0.4626), calc((100vh - 45px) / 0.715));
    background: #1b2048 url('theme/halloween/bg-mobile.webp') no-repeat;
    background-size: auto var(--bgh);
    background-position: center min(0px, calc(100vh - 45px - 0.715 * var(--bgh)));
  }
  body::before { display: none; }
}
@supports (height: 100dvh) {
  @media (max-width: 720px) {
    :root {
      --bgh: max(calc(100vw / 0.4626), calc((100dvh - 45px) / 0.715));
      background-position: center min(0px, calc(100dvh - 45px - 0.715 * var(--bgh)));
    }
  }
}

/* ---------- 上部：ロゴ「Wan-Coco Bow Pop!」と、左右の丸いボタン ---------- */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: auto; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 6px;
}
.tools { display: contents; }
#sound { grid-column: 1; grid-row: 1; justify-self: start; }
#help { grid-column: 3; grid-row: 1; justify-self: end; }
.iconbtn, #sound {
  height: 44px; border-radius: 13px; color: #6b4b38; border: 2px solid #f3dcae;
  background: radial-gradient(ellipse at 30% 10%, #fffdf5, transparent 70%), linear-gradient(#fff6e3, #f1dfbd);
  box-shadow: inset 0 1px 1px #fff, 0 3px 0 #b8925d, 0 5px 10px #10123366;
}
.iconbtn { width: 44px; }
#sound { width: 64px; font-size: 13px; }
/* タイトル「Wan-Coco Bow Pop!」：太く丸い文字＋紫のふち＋白い外ふち＋下の厚み（ぷっくりしたロゴ）。
   今後タイトルを出す画面でも .brand（または .wc-logo）を使えば同じ見た目になる */
.brand, .wc-logo {
  grid-column: 2; grid-row: 1; flex-direction: column; align-items: center; gap: 0;
  font-family: 'Fredoka', 'Arial Rounded MT Bold', ui-rounded, 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  font-size: 28px; line-height: .95; letter-spacing: .3px; font-weight: 700; color: #ffd84f;
  --ink: #4a2378; --rim: #fff8ee;
  text-shadow:
    2.5px 0 0 var(--ink), -2.5px 0 0 var(--ink), 0 2.5px 0 var(--ink), 0 -2.5px 0 var(--ink),
    1.8px 1.8px 0 var(--ink), -1.8px 1.8px 0 var(--ink), 1.8px -1.8px 0 var(--ink), -1.8px -1.8px 0 var(--ink),
    4.5px 0 0 var(--rim), -4.5px 0 0 var(--rim), 0 4.5px 0 var(--rim), 0 -4.5px 0 var(--rim),
    3.2px 3.2px 0 var(--rim), -3.2px 3.2px 0 var(--rim), 3.2px -3.2px 0 var(--rim), -3.2px -3.2px 0 var(--rim),
    0 7px 0 #2c1352, 0 9px 10px #0a0b2588;
}
.brandmark { display: none; }
.brand b, .wc-logo b {
  display: block; font-size: 35px; font-weight: 700; letter-spacing: .5px; color: #ff86c0; margin-top: 1px;
  text-shadow:
    2.8px 0 0 var(--ink), -2.8px 0 0 var(--ink), 0 2.8px 0 var(--ink), 0 -2.8px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
    5px 0 0 var(--rim), -5px 0 0 var(--rim), 0 5px 0 var(--rim), 0 -5px 0 var(--rim),
    3.6px 3.6px 0 var(--rim), -3.6px 3.6px 0 var(--rim), 3.6px -3.6px 0 var(--rim), -3.6px -3.6px 0 var(--rim),
    0 8px 0 #2c1352, 0 10px 12px #0a0b2588;
}
/* ---------- ブロック：輪郭くっきり・立体・ツヤ。面の画像は今のまま、テーマの色味（--block-tint-N）を重ねて鮮やかに ---------- */
.tile.c0:not(.special) { --tint: var(--block-tint-0, #0000); }
.tile.c1:not(.special) { --tint: var(--block-tint-1, #0000); }
.tile.c2:not(.special) { --tint: var(--block-tint-2, #0000); }
.tile.c3:not(.special) { --tint: var(--block-tint-3, #0000); }
.tile.c0:not(.special), .tile.c1:not(.special), .tile.c2:not(.special), .tile.c3:not(.special) {
  background: linear-gradient(172deg, #ffffff3d 0%, #ffffff00 46%), linear-gradient(var(--tint), var(--tint)), var(--piece-surface) center / 100% 100% no-repeat;
  box-shadow: inset 0 0 0 1.5px #ffffff5c, 0 3px 0 var(--tile-edge), 0 5px 5px #0b0920a6;
}
.dogface { width: 86%; height: 86%; filter: drop-shadow(0 1.5px 1px #2a123055); }
/* 絵の大きさ（テーマの iconSize）。ジャックオランタンは少し大きめで存在感をそろえる */
.tile.c0:not(.special) > .dogface { width: var(--block-icon-size-0, 86%); height: var(--block-icon-size-0, 86%); }
.tile.c1:not(.special) > .dogface { width: var(--block-icon-size-1, 86%); height: var(--block-icon-size-1, 86%); }
.tile.c2:not(.special) > .dogface { width: var(--block-icon-size-2, 86%); height: var(--block-icon-size-2, 86%); }
.tile.c3:not(.special) > .dogface { width: var(--block-icon-size-3, 86%); height: var(--block-icon-size-3, 86%); }
/* 灯りのあるブロック（テーマの glow: true。ハロウィンはジャックオランタン）：面の中心にあたたかい光、絵にやわらかい発光 */
:root[data-block-glow~="0"] .tile.c0:not(.special), :root[data-block-glow~="1"] .tile.c1:not(.special),
:root[data-block-glow~="2"] .tile.c2:not(.special), :root[data-block-glow~="3"] .tile.c3:not(.special) {
  background: linear-gradient(172deg, #ffffff3d 0%, #ffffff00 46%), radial-gradient(circle at 50% 56%, #ffe0a066 0%, #ffb35a22 42%, #fff0 70%), linear-gradient(var(--tint), var(--tint)), var(--piece-surface) center / 100% 100% no-repeat;
}
:root[data-block-glow~="0"] .tile.c0:not(.special) > .dogface, :root[data-block-glow~="1"] .tile.c1:not(.special) > .dogface,
:root[data-block-glow~="2"] .tile.c2:not(.special) > .dogface, :root[data-block-glow~="3"] .tile.c3:not(.special) > .dogface {
  filter: drop-shadow(0 1.5px 1px #5a240c66) drop-shadow(0 0 3px #ffd08a99);
}
/* 面を描かないブロック（テーマで framed: false。ハロウィンは c2 ジャックオランタン）：絵そのものを大きく */
:root[data-block-frameless~="0"] .tile.c0:not(.special),
:root[data-block-frameless~="1"] .tile.c1:not(.special),
:root[data-block-frameless~="2"] .tile.c2:not(.special),
:root[data-block-frameless~="3"] .tile.c3:not(.special) { background: none; box-shadow: none; border-color: transparent; }
:root[data-block-frameless~="0"] .tile.c0:not(.special) > .dogface,
:root[data-block-frameless~="1"] .tile.c1:not(.special) > .dogface,
:root[data-block-frameless~="2"] .tile.c2:not(.special) > .dogface,
:root[data-block-frameless~="3"] .tile.c3:not(.special) > .dogface { width: 100%; height: 100%; filter: drop-shadow(0 3px 2px #0d081fb3); }

/* ---------- 盤面：上品な細いクリームの縁、濃い紺の中、少し立体的に ---------- */
.boardwrap {
  background: radial-gradient(ellipse at 30% 0%, #353b72, transparent 80%), linear-gradient(#262a5a, #1d2049);
  outline: 3px solid #f4e1b6; outline-offset: 0;
  box-shadow: 0 0 0 5px #c49a62, inset 0 2px 6px #0a0b2588, 0 8px 18px #06071a99;
}

/* ---------- 盤の下：夜の背景でも読める明るい文字、案内は半透明のクリーム ---------- */
.scoreline, .scoreline b, #feedback { text-shadow: 0 1px 2px #0b0b28cc; }
.scoreline { color: #f1e6ff; }
.scoreline b { color: #ffd27a; }
#feedback { color: #fff3d8; }
.savehint { color: #ece2f8; text-shadow: 0 1px 2px #0b0b28cc; }
.powerguide { background: linear-gradient(#fff9ecf0, #f3e4c8f0); border: 2px solid #f6e7c8; }

/* ---------- スマホ：決定画像の配置（STAGE のタブ、3匹のパネル＋GOAL＋MOVES、大きな盤） ---------- */
@media (max-width: 720px) {
  .topbar { padding-left: 12px; padding-right: 12px; }
  .layout { padding: 0 10px max(14px, env(safe-area-inset-bottom)); }
  .play {
    background: none; border: 0; box-shadow: none; padding: 0; max-width: 460px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px;
  }
  .play > * { grid-column: 1 / -1; }
  .play > .mobile-dogs { grid-column: 1; }
  .play > .hud { grid-column: 2; }
  /* STAGE のタブと「やり直す」 */
  .stagebar { margin: 2px 0 0; align-items: flex-end; }
  .stagebtn {
    font-size: 0; gap: 6px; padding: 7px 16px 5px; border-radius: 15px 15px 0 0;
    background: linear-gradient(#fffaf0, #f7e9cd); border: 2px solid #f3dcae; border-bottom: 0;
  }
  .stagebtn::before { content: 'STAGE'; font-size: 17px; font-weight: 900; letter-spacing: .6px; color: #5f4b78; }
  .stagebtn .gridicon { display: none; }
  .stagebtn strong { font-size: 23px; color: #c0662d; }
  .stagebtn > span:last-child { font-size: 12px; color: #8a6f8f; }
  .textbtn {
    margin-bottom: 5px; padding: 6px 12px; border-radius: 999px; font-size: 13px; color: #6a4c79;
    background: #fff8eae8; border: 1.5px solid #f3dcae; box-shadow: 0 2px 0 #b8925d;
  }
  /* 3匹のパネル（中は背景が透けて庭が見える）。3匹を大きく */
  .mobile-dogs {
    --u: clamp(1.1px, calc((100vw - 214px) / 125), 1.55px);
    position: relative; height: auto; margin: 0; padding: 4px 4px 0;
    align-items: flex-end; justify-content: center;
    border-radius: 0 16px 16px 16px; border: 3px solid #f6e5c3;
    background: linear-gradient(#1c2152, #1c215200 42%), #20255a40;
    box-shadow: inset 0 0 0 1px #c49a6266, 0 4px 10px #0a0b2577;
  }
  .mobile-dogs > img { width: calc(125 * var(--u)); height: calc(69 * var(--u)); }
  .mobile-dogs.idle-ready > .idle-dogs { --u: inherit; height: calc(69 * var(--u)); --y: calc((69 * var(--u) - 360 * var(--s)) / 2); }
  .mobile-dogs > div:not(.idle-dogs) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* GOAL と MOVES のカード */
  .hud { display: flex; align-items: stretch; gap: 6px; margin: 0; padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0; }
  .goals {
    flex: none; padding: 6px 9px 7px; border-radius: 14px; border: 2px solid #f4e3c0;
    background: radial-gradient(ellipse at 30% 0%, #fffdf6, transparent 75%), linear-gradient(#fbf1e2, #efdcbf);
    box-shadow: inset 0 1px 1px #fff, 0 3px 0 #b8925d, 0 5px 10px #0a0b2566;
  }
  .moves {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 66px; padding: 6px 8px; border-radius: 14px; border: 2px solid #f4e3c0;
    background: radial-gradient(ellipse at 30% 0%, #fffdf6, transparent 75%), linear-gradient(#fbf1e2, #efdcbf);
    box-shadow: inset 0 1px 1px #fff, 0 3px 0 #b8925d, 0 5px 10px #0a0b2566;
  }
  .hudlabel { font-size: 0; margin-bottom: 4px; }
  .goals .hudlabel::before { content: 'GOAL'; }
  .moves .hudlabel::before { content: 'MOVES'; }
  .hudlabel::before { font-size: 14px; font-weight: 900; letter-spacing: .6px; color: #6a5890; }
  #targets { display: grid; grid-template-columns: repeat(2, auto); gap: 5px 9px; }
  .target { font-size: 16px; color: #5a4060; gap: 4px; }
  .mini { box-shadow: inset 0 1px 1px #fff8, 0 2px 0 #a07a4f66; }
  .mini { width: 26px; height: 26px; }
  .moves strong { font-size: 34px; color: #8b4a22; }
  .moves > span:last-child { display: none; }
  /* 大きな盤 */
  .boardwrap { margin-top: 9px; padding: 5px; border-radius: 15px; }
  #board { gap: 4px; }
  .scoreline { margin: 11px 2px 7px; }
  .powerguide { padding: 6px 3px; }
}
@media (max-width: 350px) {
  .brand { font-size: 23px; }
  .brand b { font-size: 29px; }
  .stagebtn::before { font-size: 15px; }
  .goals { padding: 5px 6px 6px; }
  #targets { gap: 4px 6px; }
  .target { font-size: 14px; }
  .mini { width: 22px; height: 22px; }
  .moves { min-width: 54px; }
  .moves strong { font-size: 28px; }
}

/* ---------- PC：横長の背景、左は3匹と説明、右は盤（今の配置のまま、色だけ夜に合わせる） ---------- */
@media (min-width: 721px) {
  .topbar { padding-left: 32px; padding-right: 32px; }
  .play { background: linear-gradient(#fffaf0f2, #f3e6d0f2); }
  .companion { background: #1b204899; border-radius: 26px; padding: 20px 18px 6px; box-shadow: 0 8px 22px #07081c66; }
  .hud .hudlabel { font-size: 0; }
  .goals .hudlabel::before { content: 'GOAL'; font-size: 14px; font-weight: 900; letter-spacing: .6px; color: #6a5890; }
  .moves .hudlabel::before { content: 'MOVES'; font-size: 14px; font-weight: 900; letter-spacing: .6px; color: #6a5890; }
  .moves > span:last-child { display: none; }
  .stagebtn { font-size: 0; gap: 6px; }
  .stagebtn::before { content: 'STAGE'; font-size: 16px; font-weight: 900; letter-spacing: .6px; color: #5f4b78; }
  .stagebtn .gridicon { display: none; }
  .stagebtn strong { font-size: 22px; }
  .stagebtn > span:last-child { font-size: 12px; }
}

/* ---------- スマホ：縦スクロールなしの1画面（実際に見えている画面の高さ 100dvh が基準） ----------
   盤以外の段の高さを固定し（タイトル 58／STAGE 36／3匹・GOAL・MOVES 84／盤の上 6／SCORE 36／特殊ピースの案内 44／下の余白）、
   盤の一辺 ＝ 画面幅いっぱい と「見えている高さ − それらの合計（--chrome）」の小さい方。押せる大きさのため最低 240px。
   タイトルは折り返さない（2段：Wan-Coco ／ Bow Pop!）。文字の大きさは画面幅に合わせる。
   ボタンの位置関係・押せる範囲の仕組み・ゲームの動きは変えない。クリア記録の注意書きはスマホでは隠す */
@media (max-width: 720px) {
  .play { --chrome: calc(270px + env(safe-area-inset-top) + max(6px, env(safe-area-inset-bottom))); }
  /* タイトル（2段のまま） */
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 6px;
    height: calc(58px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-bottom: 0;
  }
  .brand, .wc-logo, .brand b, .wc-logo b { white-space: nowrap; }
  .brand, .wc-logo { justify-self: center; font-size: clamp(18px, 6.2vw, 26px); }
  .brand b, .wc-logo b { font-size: clamp(22px, 7.8vw, 32px); }
  .iconbtn, #sound { height: 40px; }
  .iconbtn { width: 40px; }
  #sound { width: 58px; font-size: 12px; }
  .layout { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  /* STAGE のタブ */
  .stagebar { height: 36px; margin: 0; }
  .stagebtn { height: 36px; padding: 0 14px; }
  .stagebtn::before { font-size: 15px; }
  .stagebtn strong { font-size: 20px; }
  .textbtn { margin-bottom: 4px; padding: 3px 11px; font-size: 12px; }
  /* 3匹のパネル・GOAL・MOVES（高さ 84px） */
  .mobile-dogs, .hud { height: 84px; }
  .mobile-dogs { --u: clamp(1px, calc((100vw - 214px) / 125), 1.16px); padding: 2px 4px 0; }
  .goals, .moves { padding-top: 4px; padding-bottom: 4px; }
  .hudlabel { margin-bottom: 2px; }
  .hudlabel::before { font-size: 13px; }
  .mini { width: 23px; height: 23px; }
  .target { font-size: 15px; }
  .moves strong { font-size: 30px; }
  /* 盤：見えている高さに合わせる */
  .boardwrap { margin-top: 6px; justify-self: center; width: min(100%, max(240px, calc(100vh - var(--chrome)))); }
  /* SCORE と案内の文字（2行でも 30px に収まる）、特殊ピースの案内（44px） */
  .scoreline { height: 30px; margin: 4px 2px 2px; align-items: center; }
  #feedback { font-size: 12px; line-height: 1.2; }
  .powerguide { height: 44px; padding: 0 3px; align-items: center; }
  .savehint { display: none; }
}
@supports (height: 100dvh) {
  @media (max-width: 720px) {
    .boardwrap { width: min(100%, max(240px, calc(100dvh - var(--chrome)))); }
  }
}
