/* 月の湯タイルパズル — 色は CSS 変数（ダークモードは mn.css の変数と合わせる） */
:root {
  --accent: #23668f; --accent-ink: #ffffff; --accent-soft: #dcebf4;
  --grout: #e6e1d6; --cell: rgba(255, 255, 255, .58); --cell-line: rgba(70, 90, 110, .14); --wall: #2d4c63;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #7cc4e8; --accent-ink: #0d1d29; --accent-soft: #1b3346;
    --grout: #1c2638; --cell: rgba(20, 30, 46, .55); --cell-line: rgba(160, 190, 220, .14); --wall: #0c1622;
  }
}
:root[data-theme="dark"] {
  --accent: #7cc4e8; --accent-ink: #0d1d29; --accent-soft: #1b3346;
  --grout: #1c2638; --cell: rgba(20, 30, 46, .55); --cell-line: rgba(160, 190, 220, .14); --wall: #0c1622;
}

/* タイトル */
.ty-hero { border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(160deg, #1d4a66, #0e2436); }
.ty-hero video, .ty-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ty-goal-note { margin-top: 6px !important; }
.ty-story-list { display: grid; gap: 6px; margin-top: 10px; }
.ty-story-btn { justify-content: flex-start; min-height: 42px; font-size: 14px; text-align: left; }
.ty-reopen b { color: var(--accent); }

/* プレイ画面 */
.ty-play { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ty-hud { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 6px; }
.ty-hud-l { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.ty-kick { font-weight: 800; font-size: 14px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ty-goal { font-size: 13px; color: var(--text-sub); }
.ty-hud-r { display: flex; align-items: center; gap: 8px; flex: none; }
.ty-score-wrap { font-variant-numeric: tabular-nums; }
.ty-score { font-size: 30px; font-weight: 900; line-height: 1; }
.ty-score-wrap small { font-size: 13px; margin-left: 2px; color: var(--text-sub); }
.ty-combo { font-size: 13px; font-weight: 900; padding: 3px 10px; border-radius: 999px; background: #ffd27a; color: #4a3200; opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s; }
.ty-combo.on { opacity: 1; transform: none; }
.ty-prog { height: 6px; margin-bottom: 10px; }

.ty-board-wrap { position: relative; width: min(100%, 460px, calc(100dvh - 330px)); min-width: min(100%, 280px); margin: 0 auto; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--wall);
  --mural: .2; --mbri: .6; --msat: .4; --mz: 160%; --mx: 10%; --my: 90%; box-shadow: var(--shadow); }
/* 盤の背景にうっすら富士山の壁画。物語が進むほど明るく、広く見える */
.ty-mural { position: absolute; inset: 0; background-color: #31566f; background-image: url(assets/bg.webp); background-repeat: no-repeat; background-size: auto var(--mz); background-position: var(--mx) var(--my);
  opacity: var(--mural); filter: brightness(var(--mbri)) saturate(var(--msat)); transition: opacity 1.2s, filter 1.2s, background-size 1.2s, background-position 1.2s; }
.ty-board { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); gap: 3px; padding: 6px; touch-action: none; }
.ty-cell { border-radius: 5px; background: var(--cell); box-shadow: inset 0 0 0 1px var(--cell-line); background-size: cover; background-position: center; transition: filter .15s; }
.ty-board-wrap .ty-cell:not(.ty-tile) { background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
/* タイル（1マス）＝ assets/tile0〜5.webp。読めないときは style の背景色が見える */
.ty-tile { background-size: cover; background-position: center; background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 1px 0 rgba(0, 0, 0, .18); }
.ty-tile.t0 { background-image: url(assets/tile0.webp); }
.ty-tile.t1 { background-image: url(assets/tile1.webp); }
.ty-tile.t2 { background-image: url(assets/tile2.webp); }
.ty-tile.t3 { background-image: url(assets/tile3.webp); }
.ty-tile.t4 { background-image: url(assets/tile4.webp); }
.ty-tile.t5 { background-image: url(assets/tile5.webp); }
.ty-cell.pv { opacity: .5; }
.ty-cell.hl { filter: brightness(1.35) drop-shadow(0 0 4px #fff4c2); }
.ty-board-wrap .ty-cell.hl:not(.ty-tile) { background: rgba(255, 244, 194, .35); }
.ty-cell.pop { animation: ty-pop .38s ease-in forwards; }
@keyframes ty-pop { 0% { transform: scale(1); filter: brightness(1.8); } 100% { transform: scale(.2); opacity: 0; } }
.ty-shake { animation: ty-shake .28s; }
@keyframes ty-shake { 30% { transform: translateY(2px); } 60% { transform: translateY(-2px); } }

.ty-fx { position: absolute; inset: 0; pointer-events: none; }
.ty-float { position: absolute; left: 50%; transform: translate(-50%, -50%); white-space: nowrap; font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 2px 0 rgba(10, 30, 50, .7), 0 0 8px rgba(10, 30, 50, .6); animation: ty-up 1.2s ease-out forwards; }
.ty-float.big { font-size: 26px; }
.ty-float.combo { color: #ffd27a; font-size: 18px; }
.ty-float.sub { font-size: 14px; opacity: .8; }
@keyframes ty-up { 0% { opacity: 0; margin-top: 8px; } 15% { opacity: 1; margin-top: 0; } 80% { opacity: 1; } 100% { opacity: 0; margin-top: -26px; } }
.ty-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8, 20, 32, .55); padding: 16px; }
.ty-overlay[hidden] { display: none; }
.ty-ov-box { background: var(--surface); color: var(--text); border-radius: 16px; padding: 18px 16px; width: min(320px, 100%); display: flex; flex-direction: column; gap: 8px; text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.ty-ov-big { font-size: 22px; font-weight: 900; color: var(--accent); }

.ty-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px auto 4px; max-width: 460px; }
.ty-slot { height: 118px; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--surface-2); border: 2px solid transparent; touch-action: none; cursor: grab; transition: border-color .15s, opacity .15s; }
.ty-slot.is-empty { cursor: default; background: transparent; border: 2px dashed var(--line); }
.ty-slot.is-sel { border-color: var(--accent); background: var(--accent-soft); }
.ty-slot.is-dead { opacity: .35; }
.ty-slot.is-drag .ty-piece { opacity: .2; }
.ty-piece { display: grid; pointer-events: none; }
.ty-piece i { display: block; border-radius: 4px; }
.ty-ghost { position: fixed; left: 0; top: 0; z-index: 800; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); opacity: .9; }
.ty-ghost i { border-radius: 5px; }
.ty-help { margin: 4px 0 0; }
.ty-foot { margin-top: 6px; }
.ty-quit { min-height: 40px; font-size: 13px; padding: 6px 12px; }

/* 結果 */
.ty-unit { font-size: 22px; margin-left: 4px; color: var(--text); }
.ty-res-line { margin: 8px 0 0; font-weight: 700; }
.ty-res-tags { justify-content: center; margin-bottom: 0; }
.ty-tsuru { font-family: var(--font-serif); margin: 10px 0 0; }

@media (min-width: 700px) {
  .ty-slot { height: 130px; }
}
