/* =====================================================================================
   ひきどき（Tidemark）— 暁の磯
   -------------------------------------------------------------------------------------
   世界観：明治の終わりの外海の磯。大潮の夜明け前、四時四十分。
   持ち帰ったものは、その日のうちに青写真（シアノタイプ）に焼く。

   ・磯札は「日光で焼いた印画」。輪郭線を1本も引かない。濃淡だけで生き物が出る
   ・波札だけが明度95を超える白（#F4F7F5）。めくった瞬間に明るさが跳ねる
   ・しるべ札だけが紙の色（海図の切れ端）。青い印画の束のなかで唯一 生成り
   ・光源を置かない。落ち影を作らない。真鍮は刻印の色で、光源にしない
   ・グラデーションは印画に使わない（濃淡は重ね塗りとにじみで作る）

   このファイルは共通CSS（rin-nav.css / rin-guide.css / rin-ads.css）より「後」に読む。
   共通ファイルは書き換えず、--rn-* / --rg-* をここで上書きする。

   枚数はすべて最終ルールに合わせてある：しるべ3枚・かご4枚・列6枚・3ラウンド。
   ===================================================================================== */

/* =====================================================================================
   1. 色と寸法のトークン（ダークが既定）
   ===================================================================================== */
:root {
  color-scheme: dark;

  /* ── 地と光 ───────────────────────────────────────── */
  --ht-ground:      #0B141E;               /* 暁闇（空と海） */
  --ht-ground-2:    #16212A;               /* 濡れ岩（2層目・札の背） */
  --ht-ground-3:    #1B2A36;               /* 海の2本目のサインカーブ */
  --ht-sky-top:     #35506B;               /* 半球光の上（薄明の空） */
  --ht-sky-bottom:  #0A0F14;               /* 同・下 */
  --ht-lantern:     #E8B96A;               /* 卓のカンテラ（右下25°） */

  /* ── 文字 ────────────────────────────────────────── */
  --ht-ink:         #C7D3D8;               /* 潮明かり（本文・12.12:1） */
  --ht-ink-dim:     #8A9AA3;               /* 沖明かり（副次・6.38:1） */
  --ht-ink-faint:   rgba(199, 211, 216, .40);

  /* ── 印画（青写真の露光） ──────────────────────────── */
  --ht-expose:      #E4EAF4;               /* 露光白（紙に触れていた所） */
  --ht-expose-2:    #B1C1DC;               /* 露光淡（浮いていた所） */
  --ht-expose-hi:   #F2F6FF;               /* 最も密着していた芯 */

  /* ── しるべ札（海図の切れ端） ───────────────────────── */
  --ht-chart:       #ECE4D0;               /* 海図紙 */
  --ht-chart-2:     #E2D8C0;               /* 海図紙の陰（折れ・破れ口） */
  --ht-chart-ink:   #3A4436;               /* 銅版墨（8.05:1） */

  /* ── 刻印・危険・波 ────────────────────────────────── */
  --ht-brass:       #B08D4A;               /* 真鍮（文字用。5.96:1） */
  --ht-brass-line:  #B08D4A;               /* 真鍮（罫・図形用） */
  --ht-brass-soft:  rgba(176, 141, 74, .30);
  --ht-brass-faint: rgba(176, 141, 74, .16);
  --ht-crimson:     #C0392B;               /* 緋（波の帯・バースト） */
  --ht-unfixed:     #F4F7F5;               /* 未定着＝波札。暁闇との比 17.18 */
  --ht-cardback:    #16212A;               /* 札の裏（濡れ岩）。物なのでテーマで変えない */
  --ht-crimson-paper: #A3302A;             /* 紙もの（海図紙）の上に置く緋。比 5.6。テーマで変えない */
  --ht-paper-edge:  transparent;           /* 紙ものの縁。暗い地では要らない */
  --ht-wave-edge:   transparent;           /* 波札の縁。暗い地では白そのものが段差 */
  --ht-wave-ink:    #F4F7F5;               /* 「波 5」の数字。暗い地では未定着の白 */

  /* ── 罫と面 ───────────────────────────────────────── */
  --ht-line:        rgba(176, 141, 74, .26);
  --ht-line-soft:   rgba(199, 211, 216, .13);
  --ht-panel:       rgba(22, 33, 42, .72);
  --ht-slot:        rgba(199, 211, 216, .05);
  --ht-shadow:      0 6px 18px rgba(0, 0, 0, .28);   /* 接地影だけ。落ち影は作らない */
  --ht-sea-a:       #16212A;
  --ht-sea-b:       #1B2A36;

  /* ── 磯札5色：シアノタイプの調色。テーマで変えない ───────
     印画と紙は「物」なので、卓の明るさが変わっても色は変わらない。
     ライトのブロックでも、この5つだけは上書きしない。 */
  --ht-tone-aosa:      #343569;            /* アオサ：素のプルシアンブルー */
  --ht-tone-uni:       #4A3550;            /* ウニ：タンニン調色（紫褐） */
  --ht-tone-isogin:    #4A5138;            /* イソギンチャク：緑茶調色（オリーブ） */
  --ht-tone-yadokari:  #5A4232;            /* ヤドカリ：紅茶調色（茶） */
  --ht-tone-tako:      #2A4A5E;            /* タコ：漂白して再露光（鉄紺） */
  --ht-tone:           var(--ht-tone-aosa);/* 現在の種。.ht-sp--* が差し替える */

  /* ── 書体 ────────────────────────────────────────── */
  /* Yuji Syuku を index.html が読み込めば題字だけ自動で筆の楷書になる（アートディレクション 2-3）。
     読み込まない場合は Zen Old Mincho に落ちる。どちらでも成立する順序にしてある。 */
  --ht-font-display: "Yuji Syuku", "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --ht-font-serif:   "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --ht-font-body:    "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  --ht-font-num:     "Spectral", "Hiragino Mincho ProN", Georgia, "Times New Roman", serif;

  /* ── 寸法 ────────────────────────────────────────── */
  --ht-max:        460px;                  /* 盤面の最大幅（iPhone 縦を基準に少しだけ広げる） */
  --ht-pad:        clamp(14px, 4.2vw, 20px);
  --ht-gap:        clamp(8px, 2.4vw, 14px);
  --ht-radius:     4px;                    /* 角丸はここまで。ピル型にしない */
  --ht-tap:        56px;                   /* 最小タップ領域 */

  --ht-card-ratio: 57 / 89;                /* 磯札・波札（物理版と同じ比） */
  --ht-mark-ratio: 44 / 68;                /* しるべ札（一回り小さい） */
  --ht-deck-h:     clamp(94px, 15.5svh, 150px);
  --ht-mark-h:     clamp(84px, 13.5svh, 128px);
  --ht-reveal-h:   clamp(70px, 11.5svh, 108px);
  --ht-pile-step:  clamp(6px, 1.8vw, 9px);
  --ht-pile-unit:  clamp(8px, 2.2vw, 11px);

  /* 右上の共通ナビ（rin-nav）を避ける帯の余白 */
  --ht-nav-gap:    64px;

  /* ── 動き ────────────────────────────────────────── */
  --ht-ease:       cubic-bezier(.22, 1, .36, 1);      /* 波打ち際から滑り出す */
  --ht-ease-flash: cubic-bezier(.16, 1, .3, 1);       /* 波札の見せ場 */
  --ht-dur:        220ms;
  --ht-dur-slow:   300ms;

  /* AdSense 自動広告のサイドレールの逃げ場（rin-ads.css と同じ考え方） */
  --rail-left:  0px;
  --rail-right: 0px;

  /* ── 共通ナビ（rin-nav）を暁の磯に寄せる ───────────────── */
  --rn-fg:       #C7D3D8;
  --rn-fg-dim:   #8A9AA3;
  --rn-bg:       rgba(11, 20, 30, .88);
  --rn-bg-hover: rgba(176, 141, 74, .16);
  --rn-line:     rgba(176, 141, 74, .38);
  --rn-accent:   #B08D4A;
  --rn-radius:   4px;
  --rn-shadow:   0 10px 30px rgba(0, 0, 0, .5);
  --rn-top:      10px;
  --rn-right:    10px;

  /* ── 共通の遊び方パネル（rin-guide）を暁の磯に寄せる ───────── */
  --rg-bg:       #0B141E;
  --rg-fg:       #C7D3D8;
  --rg-line:     rgba(176, 141, 74, .22);
  --rg-btn-bg:   rgba(176, 141, 74, .10);
  --rg-btn-fg:   #C7D3D8;
  --rg-btn-line: rgba(176, 141, 74, .40);
  --rg-accent:   #B08D4A;
  --rg-radius:   4px;
  --rg-font:     var(--ht-font-serif);
  --rg-max:      760px;
}

@media (min-width: 1100px) {
  :root { --rail-left: 180px; --rail-right: 180px; }
}
@media (min-width: 481px) {
  /* 481px 以上では rin-nav のボタンに文字ラベルが出るぶん広く空ける */
  :root { --ht-nav-gap: 124px; }
}
@media (min-width: 760px) {
  /* 盤面（最大460px）の外側にナビが出るので、帯の余白は要らない */
  :root { --ht-nav-gap: 0px; }
}

/* =====================================================================================
   2. ライト（日が昇ったあと、浜に広げた白い台紙）
   -------------------------------------------------------------------------------------
   ダークが正。OS がライトを好み、かつ明示指定が無いときだけライトに落ちる。
   [data-theme] は両方向で勝つ。
   ===================================================================================== */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ht-ground:      #EFEDE6;
    --ht-ground-2:    #E5E2D8;
    --ht-ground-3:    #DAD7CB;
    --ht-sky-top:     #C9CFD4;
    --ht-sky-bottom:  #EFEDE6;
    --ht-lantern:     #C89A4E;
    --ht-ink:         #1A1F22;
    --ht-ink-dim:     #5B6266;
    --ht-ink-faint:   rgba(26, 31, 34, .42);
    --ht-chart:       #ECE4D0;
    --ht-chart-2:     #DED4BA;
    --ht-chart-ink:   #3A4436;
    --ht-brass:       #6E541C;
    --ht-brass-line:  #96762F;
    --ht-brass-soft:  rgba(150, 118, 47, .34);
    --ht-brass-faint: rgba(150, 118, 47, .18);
    --ht-crimson:     #A3302A;
    --ht-unfixed:     #FFFFFF;
    --ht-line:        rgba(42, 57, 69, .26);
    --ht-line-soft:   rgba(42, 57, 69, .14);
    --ht-panel:       rgba(255, 255, 255, .58);
    --ht-slot:        rgba(42, 57, 69, .05);
    --ht-shadow:      0 6px 18px rgba(42, 57, 69, .16);
    --ht-sea-a:       #D8DCD6;
    --ht-sea-b:       #C7CFCC;
    --ht-paper-edge:  rgba(58, 68, 54, .42);   /* 海図紙 #ECE4D0 は台紙 #EFEDE6 に埋もれるので縁を引く */
    --ht-wave-edge:   #2A3945;                 /* 波札は白なので鉄紺の2px罫（AD ライトの表） */
    --ht-wave-ink:    #2A3945;

    --rn-fg:       #1A1F22;
    --rn-fg-dim:   #5B6266;
    --rn-bg:       rgba(239, 237, 230, .92);
    --rn-bg-hover: rgba(150, 118, 47, .14);
    --rn-line:     rgba(110, 84, 28, .34);
    --rn-accent:   #6E541C;
    --rn-shadow:   0 10px 30px rgba(42, 57, 69, .18);

    --rg-bg:       #EFEDE6;
    --rg-fg:       #1A1F22;
    --rg-line:     rgba(42, 57, 69, .18);
    --rg-btn-bg:   rgba(150, 118, 47, .10);
    --rg-btn-fg:   #1A1F22;
    --rg-btn-line: rgba(110, 84, 28, .38);
    --rg-accent:   #6E541C;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --ht-ground:      #EFEDE6;
  --ht-ground-2:    #E5E2D8;
  --ht-ground-3:    #DAD7CB;
  --ht-sky-top:     #C9CFD4;
  --ht-sky-bottom:  #EFEDE6;
  --ht-lantern:     #C89A4E;
  --ht-ink:         #1A1F22;
  --ht-ink-dim:     #5B6266;
  --ht-ink-faint:   rgba(26, 31, 34, .42);
  --ht-chart:       #ECE4D0;
  --ht-chart-2:     #DED4BA;
  --ht-chart-ink:   #3A4436;
  --ht-brass:       #6E541C;
  --ht-brass-line:  #96762F;
  --ht-brass-soft:  rgba(150, 118, 47, .34);
  --ht-brass-faint: rgba(150, 118, 47, .18);
  --ht-crimson:     #A3302A;
  --ht-unfixed:     #FFFFFF;
  --ht-line:        rgba(42, 57, 69, .26);
  --ht-line-soft:   rgba(42, 57, 69, .14);
  --ht-panel:       rgba(255, 255, 255, .58);
  --ht-slot:        rgba(42, 57, 69, .05);
  --ht-shadow:      0 6px 18px rgba(42, 57, 69, .16);
  --ht-sea-a:       #D8DCD6;
  --ht-sea-b:       #C7CFCC;
  --ht-paper-edge:  rgba(58, 68, 54, .42);
  --ht-wave-edge:   #2A3945;
  --ht-wave-ink:    #2A3945;

  --rn-fg:       #1A1F22;
  --rn-fg-dim:   #5B6266;
  --rn-bg:       rgba(239, 237, 230, .92);
  --rn-bg-hover: rgba(150, 118, 47, .14);
  --rn-line:     rgba(110, 84, 28, .34);
  --rn-accent:   #6E541C;
  --rn-shadow:   0 10px 30px rgba(42, 57, 69, .18);

  --rg-bg:       #EFEDE6;
  --rg-fg:       #1A1F22;
  --rg-line:     rgba(42, 57, 69, .18);
  --rg-btn-bg:   rgba(150, 118, 47, .10);
  --rg-btn-fg:   #1A1F22;
  --rg-btn-line: rgba(110, 84, 28, .38);
  --rg-accent:   #6E541C;
}

/* 明示的にダークを選んだとき（OS がライトでも必ず暁闇に戻す） */
:root[data-theme="dark"] { color-scheme: dark; }

/* =====================================================================================
   3. 土台
   ===================================================================================== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  padding-left: max(0px, var(--rail-left));
  padding-right: max(0px, var(--rail-right));
  color: var(--ht-ink);
  font-family: var(--ht-font-body);
  font-size: 15px;
  line-height: 1.85;
  background-color: var(--ht-ground);
  /* 薄明の半球光1灯（上）と、右下25°のカンテラ。どちらも弱い。これ以外は光らせない */
  background-image:
    radial-gradient(120% 52% at 50% -8%,  var(--ht-sky-top) 0%, rgba(53, 80, 107, 0) 62%),
    radial-gradient(46% 30% at 92% 92%,   rgba(232, 185, 106, .10) 0%, rgba(232, 185, 106, 0) 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: var(--ht-brass); text-underline-offset: 3px; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--ht-brass-line); outline-offset: 3px; }

/* 数字は Spectral の等幅（既定で幅500なので tnum の指定は不要だが、環境差を吸収して明示する） */
.ht-num {
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: .04em;
}
.ht-label {
  font-family: var(--ht-font-serif);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .18em;
  line-height: 1.5;
  color: var(--ht-ink-dim);
}
.ht-rule { height: 1px; border: 0; margin: 0; background: var(--ht-line); }
.ht-vertical { writing-mode: vertical-rl; text-orientation: upright; }
.ht-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* =====================================================================================
   4. 盤面の器と画面の切り替え
   ===================================================================================== */
.ht {
  position: relative;
  z-index: 1;
}

.ht-stage {
  position: relative;
  width: 100%;
  max-width: var(--ht-max);
  margin-inline: auto;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) var(--ht-pad) calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  flex-direction: column;
}

/* 背景の海：2本のサインカーブを重ねるだけ。泡・気泡・光条は描かない（AD 2-4） */
.ht-sea {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 96px;
  z-index: 0;
  overflow: hidden;      /* 200% 幅の波を切り落とすのはここだけ。盤面は切らない */
  pointer-events: none;
}
.ht-sea__wave {
  position: absolute;
  left: -50%;
  bottom: 0;
  width: 200%;
  --ht-wave-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='28' viewBox='0 0 240 28' preserveAspectRatio='none'%3E%3Cpath d='M0 14 C 30 3 90 3 120 14 C 150 25 210 25 240 14 L240 28 L0 28 Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-image: var(--ht-wave-mask);
          mask-image: var(--ht-wave-mask);
  -webkit-mask-repeat: repeat-x;
          mask-repeat: repeat-x;
  -webkit-mask-position: left bottom;
          mask-position: left bottom;
}
.ht-sea__wave--a {
  height: 34px;
  background: var(--ht-sea-a);
  -webkit-mask-size: 240px 28px;  mask-size: 240px 28px;
  animation: ht-swell-a 3.2s linear infinite;
}
.ht-sea__wave--b {
  height: 52px;
  opacity: .72;
  background: var(--ht-sea-b);
  -webkit-mask-size: 340px 44px;  mask-size: 340px 44px;
  animation: ht-swell-b 5.1s linear infinite;
}
@keyframes ht-swell-a { from { transform: translateX(0); }    to { transform: translateX(240px); } }
@keyframes ht-swell-b { from { transform: translateX(340px); } to { transform: translateX(0); } }

.ht-view {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--ht-gap);
  animation: ht-view-in var(--ht-dur) var(--ht-ease) both;
}
@keyframes ht-view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =====================================================================================
   5. 上の帯（今日の潮）
   ===================================================================================== */
.ht-tideband {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 12px;
  min-height: 40px;
  padding: 6px var(--ht-nav-gap) 8px 0;
  border-bottom: 1px solid var(--ht-line);
}
.ht-tideband__date {
  font-family: var(--ht-font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .10em;
  line-height: 1.5;
  color: var(--ht-ink);
}
.ht-tideband__tide,
.ht-tideband__time,
.ht-tideband__round {
  font-family: var(--ht-font-serif);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ht-ink-dim);
}
.ht-tideband__round { margin-left: auto; color: var(--ht-brass); }

/* =====================================================================================
   6. 卓（山札と、いま めくった1枚）
   -------------------------------------------------------------------------------------
   アートディレクションのモックは山札を中央に単独で置いていたが、しるべ3枚・かご4枚・列6枚の
   最終ルールを 390×844 に収めるため、山札と「いま めくった1枚」を横に並べた（deviations 参照）。
   ===================================================================================== */
.ht-table {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 5vw, 28px);
  padding-top: 2px;
}

.ht-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.ht-deck__stack {
  position: relative;
  height: var(--ht-deck-h);
  aspect-ratio: var(--ht-card-ratio);
  flex: none;
}
/* 残り枚数に応じた厚み。app.js が --ht-stack（0〜1）を書く */
.ht-deck__stack::before,
.ht-deck__stack::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--ht-radius);
  background: var(--ht-cardback);
  box-shadow: inset 0 0 0 1px var(--ht-brass-faint);
}
.ht-deck__stack::before { transform: translate(calc(var(--ht-stack, 1) * 5px),  calc(var(--ht-stack, 1) * 5px)); opacity: .55; }
.ht-deck__stack::after  { transform: translate(calc(var(--ht-stack, 1) * 2.5px), calc(var(--ht-stack, 1) * 2.5px)); opacity: .8; }

/* 札の裏（濡れ岩に真鍮の二重罫、白く抜けた潮位線5本） */
.ht-card--back,
.ht-deck__card {
  position: relative;
  z-index: 2;
  border-radius: var(--ht-radius);
  background-color: var(--ht-cardback);
  box-shadow: inset 0 0 0 1px var(--ht-brass-soft), var(--ht-shadow);
}
.ht-card.ht-card--back::before,
.ht-deck__card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--ht-brass-faint);
  border-radius: 2px;
}
.ht-card.ht-card--back::after,
.ht-deck__card::after {
  /* 白く抜けた5本の潮位線（アイコンと同じ図案。下から62/70/78/86/94%、下から2本目だけ真鍮） */
  content: "";
  position: absolute;
  inset: 16% 22%;
  background-image:
    linear-gradient(var(--ht-expose),  var(--ht-expose)),
    linear-gradient(var(--ht-brass-line), var(--ht-brass-line)),
    linear-gradient(var(--ht-expose),  var(--ht-expose)),
    linear-gradient(var(--ht-expose),  var(--ht-expose)),
    linear-gradient(var(--ht-expose),  var(--ht-expose));
  background-repeat: no-repeat;
  background-size: 62% 2px, 70% 2px, 78% 2px, 86% 2px, 94% 2px;
  background-position: left 100%, left 76%, left 52%, left 28%, left 4%;
  opacity: .34;
}
.ht-deck__card { position: absolute; inset: 0; }

.ht-deck__count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: .04em;
  color: var(--ht-ink-dim);
}
.ht-deck__count b { font-weight: 500; color: var(--ht-ink); }
.ht-deck__count .ht-deck__waves { color: var(--ht-wave-ink); }
.ht-deck__count.is-hidden { visibility: hidden; }

/* 潮が返った（捨て札を混ぜ直した）ときの一行 */
.ht-deck__shuffle {
  font-family: var(--ht-font-serif);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--ht-brass);
  animation: ht-fade-out 2.4s var(--ht-ease) both;
}
@keyframes ht-fade-out { 0%, 62% { opacity: 1; } 100% { opacity: 0; } }

/* =====================================================================================
   7. 札（磯札・波札）
   -------------------------------------------------------------------------------------
   絵は app.js が Canvas で焼き、data URL を --ht-face に書き込む。
   焼く前・焼けなかった場合でも、調色の地色と種の記号で読めるようにしてある。
   ===================================================================================== */
.ht-card {
  position: relative;
  border-radius: var(--ht-radius);
  overflow: hidden;
  background-color: var(--ht-tone);
  box-shadow: var(--ht-shadow);
  user-select: none;
  -webkit-user-select: none;
}
/* 紙の質（300gsm マットPP）。上辺に内側ハイライト、下辺に沈み。ベベルを描かない */
.ht-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0  1px 0 rgba(255, 255, 255, .10),
    inset 0 -1px 0 rgba(0, 0, 0, .22);
  border-radius: inherit;
}
.ht-card__face {
  position: absolute;
  inset: 0;
  background-color: var(--ht-tone);
  background-image: var(--ht-face, none);
  background-size: cover;
  background-position: center;
}
/* 左上の通し番号（押し葉標本のラベルの作法。種ごとに頭2桁が固定 11〜15） */
.ht-card__no {
  position: absolute;
  top: 5%;
  left: 7%;
  z-index: 2;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: clamp(7px, 2.4cqw, 10px);
  font-weight: 300;
  letter-spacing: .06em;
  color: var(--ht-brass-line);
  opacity: .72;
}
/* かご入り／海に返した の小さな印（右下） */
.ht-card__mark {
  position: absolute;
  right: 6%;
  bottom: 5%;
  z-index: 2;
  font-family: var(--ht-font-serif);
  font-size: clamp(8px, 2.6cqw, 11px);
  letter-spacing: .04em;
  color: var(--ht-expose);
  opacity: .82;
}

/* 種（磯札5色）。.ht-sp--* は札・浜の山・かごの点・凡例で共用する */
.ht-sp--aosa     { --ht-tone: var(--ht-tone-aosa); }
.ht-sp--uni      { --ht-tone: var(--ht-tone-uni); }
.ht-sp--isogin   { --ht-tone: var(--ht-tone-isogin); }
.ht-sp--yadokari { --ht-tone: var(--ht-tone-yadokari); }
.ht-sp--tako     { --ht-tone: var(--ht-tone-tako); }

/* 波札：暗い画面で唯一 明度95を超える白。長辺（左）に緋の帯 */
.ht-card--wave {
  --ht-tone: var(--ht-unfixed);
  background-color: var(--ht-unfixed);
}
.ht-card--wave .ht-card__face { background-color: var(--ht-unfixed); }
.ht-card--wave { box-shadow: inset 0 0 0 2px var(--ht-wave-edge), var(--ht-shadow); }
.ht-card--wave::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 8%;
  min-width: 3px;
  z-index: 2;
  background: var(--ht-crimson);
}
.ht-card--wave .ht-card__no { color: var(--ht-chart-ink); opacity: .55; }
.ht-card--wave::after {
  box-shadow:
    inset 0  1px 0 rgba(255, 255, 255, .5),
    inset 0 -1px 0 rgba(0, 0, 0, .12);
}

/* 状態 */
.ht-card.is-kept     { transform: translateY(-8px); }       /* かごに入れた＝手前に寄せる */
.ht-card.is-released { transform: translateY(6px); opacity: .42; filter: saturate(.7); }  /* 海に返した */
.ht-card.is-pending  { box-shadow: 0 0 0 1px var(--ht-brass-line), var(--ht-shadow); }
.ht-card.is-lost     { animation: ht-lost var(--ht-dur-slow) var(--ht-ease) forwards; }
@keyframes ht-lost { to { transform: translateY(26px); opacity: 0; } }

/* 波打ち際から滑り出す（Y軸回転でめくらない） */
.ht-card.is-new { animation: ht-slide-in var(--ht-dur) var(--ht-ease) both; }
@keyframes ht-slide-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* =====================================================================================
   8. 判断待ちの1枚（大きく出す）
   ===================================================================================== */
.ht-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: calc(var(--ht-reveal-h) + 22px);
}
.ht-reveal__card {
  position: relative;
  height: var(--ht-reveal-h);
  aspect-ratio: var(--ht-card-ratio);
  flex: none;
  container-type: inline-size;
}
/* 札は、入れ物（列の枠・めくった1枚・山札）いっぱいに置く */
.ht-row__slot > .ht-card,
.ht-reveal__card > .ht-card,
.ht-deck__stack > .ht-card { position: absolute; inset: 0; }
.ht-reveal__card.is-wave { animation: ht-wave-pop 120ms var(--ht-ease-flash) both; }
@keyframes ht-wave-pop { from { transform: scale(1); } to { transform: scale(1.06); } }
.ht-reveal__text {
  min-width: 0;
  font-family: var(--ht-font-serif);
  font-size: 12.5px;
  letter-spacing: .08em;
  line-height: 1.5;
  text-align: center;
  color: var(--ht-ink-dim);
}
.ht-reveal__text b { font-size: 13.5px; font-weight: 700; color: var(--ht-ink); }
.ht-reveal__text .ht-danger { color: var(--ht-crimson); }
/* 何もめくっていないときの空き。潮位線1本だけ引いて、場所だけ取っておく */
.ht-reveal__empty {
  width: 100%;
  border-top: 1px solid var(--ht-line-soft);
  font-family: var(--ht-font-serif);
  font-size: 12px;
  letter-spacing: .14em;
  text-align: center;
  color: var(--ht-ink-faint);
  padding-top: 10px;
}

/* =====================================================================================
   9. めくった列（6枠。海に返した札も波札も数える）
   -------------------------------------------------------------------------------------
   物理版の「めくった札は必ず手前に一列に並べる。かごに入れたものだけ手前に寄せる」を
   そのまま写す。6枠を常に見せるので、上限が規則を読まなくても見える。
   ===================================================================================== */
.ht-row { display: flex; flex-direction: column; gap: 6px; }
.ht-row__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.ht-row__slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(4px, 1.4vw, 7px);
  align-items: start;
}
.ht-row__slot {
  position: relative;
  aspect-ratio: var(--ht-card-ratio);
  border-radius: var(--ht-radius);
  container-type: inline-size;
}
.ht-row__slot.is-empty {
  background: var(--ht-slot);
  box-shadow: inset 0 0 0 1px var(--ht-line-soft);
}
.ht-row__slot > .ht-card { transition: transform var(--ht-dur) var(--ht-ease), opacity var(--ht-dur) var(--ht-ease); }
/* 6枠目＝潮が戻る限界。薄い緋の刻みを1本 */
.ht-row__slot--last.is-empty { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ht-crimson) 42%, transparent); }
/* 最低めくり枚数まで＝濃い足あと。しるべ札の足あとと同じ記号 */
.ht-row__slot::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--ht-brass-line);
  opacity: 0;
}
.ht-row__slot.is-min::after { opacity: .85; }
/* 次にめくる枠 */
.ht-row__slot.is-next.is-empty { box-shadow: inset 0 0 0 1px var(--ht-brass-soft); }

.ht-row__count {
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--ht-ink-dim);
}
.ht-row__count b { color: var(--ht-ink); font-weight: 500; }
/* 許した波の数（しるべの上限に近づくほど緋に寄る） */
.ht-row__waves { margin-left: .55em; color: var(--ht-wave-ink); }
.ht-row__waves.is-limit { color: var(--ht-crimson); }

/* =====================================================================================
   10. 操作（角丸4px・真鍮の二重罫。ピル型にしない）
   ===================================================================================== */
.ht-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 3vw, 18px);
}
.ht-actions--single { grid-template-columns: 1fr; }

.ht-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ht-tap);
  padding: 12px 18px;
  border: 1px solid var(--ht-brass-line);
  border-radius: var(--ht-radius);
  background: transparent;
  color: var(--ht-ink);
  font-family: var(--ht-font-serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .16em;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ht-dur) var(--ht-ease), border-color var(--ht-dur) var(--ht-ease), color var(--ht-dur) var(--ht-ease);
}
/* 二重罫：内側3px にもう1本（明治の活版の罫線） */
.ht-btn::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--ht-brass-line);
  border-radius: 2px;
  opacity: .45;
  pointer-events: none;
}
.ht-btn:hover:not(:disabled) { background: var(--ht-brass-faint); }
.ht-btn:active:not(:disabled) { transform: translateY(1px); }
.ht-btn--primary { background: var(--ht-brass-faint); color: var(--ht-brass); }
.ht-btn--primary:hover:not(:disabled) { background: var(--ht-brass-soft); }
.ht-btn--ghost { border-color: var(--ht-line-soft); color: var(--ht-ink-dim); }
.ht-btn--ghost::after { border-color: var(--ht-line-soft); }
.ht-btn--danger { border-color: var(--ht-crimson); color: var(--ht-crimson); }
.ht-btn--danger::after { border-color: var(--ht-crimson); }
.ht-btn--wide { grid-column: 1 / -1; }
.ht-btn--sm { min-height: 44px; padding: 9px 14px; font-size: 13.5px; letter-spacing: .10em; }
.ht-btn:disabled,
.ht-btn.is-disabled {
  border-color: var(--ht-line-soft);
  color: var(--ht-ink-faint);
  cursor: not-allowed;
  background: transparent;
}
.ht-btn:disabled::after,
.ht-btn.is-disabled::after { border-color: var(--ht-line-soft); opacity: .3; }

/* 56×56 の四角いボタン（音・表示切替・テーマ） */
.ht-iconbtn {
  width: var(--ht-tap);
  height: var(--ht-tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ht-line);
  border-radius: var(--ht-radius);
  background: transparent;
  color: var(--ht-ink-dim);
  font-size: 13px;
  cursor: pointer;
}
.ht-iconbtn:hover { color: var(--ht-brass); border-color: var(--ht-brass-soft); }
.ht-iconbtn.is-on { color: var(--ht-brass); border-color: var(--ht-brass-line); }

/* 「あと2枚めくると戻れます」等の1行。空でも高さを持たせて画面が跳ねないようにする */
.ht-hint {
  min-height: 1.6em;
  font-family: var(--ht-font-serif);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: .04em;
  text-align: center;
  color: var(--ht-ink-dim);
}
.ht-hint.is-danger { color: var(--ht-crimson); }
.ht-hint .ht-num { color: var(--ht-ink); }

/* =====================================================================================
   11. しるべ札 3枚（海図の切れ端）
   -------------------------------------------------------------------------------------
   沖の岩（波0／3〜6枚／1枚3点）・中の瀬（波1／2〜6枚／1点）・岸の溜まり（波3／1〜6枚／0点）。
   青い印画の束のなかで、ここだけが紙の色をしている。
   線は銅版線（0.6px 相当）だけで、色を面に使わない。
   ===================================================================================== */
.ht-marks { display: flex; flex-direction: column; gap: 7px; }
.ht-marks__list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 3vw, 16px);
  align-items: end;
}

.ht-mark {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: var(--ht-mark-h);
  padding: 8px 7px 7px;
  border: 0;
  border-radius: 1px;
  background: var(--ht-chart);
  color: var(--ht-chart-ink);
  font-family: var(--ht-font-serif);
  text-align: left;
  cursor: pointer;
  container-type: inline-size;
  box-shadow: inset 0 0 0 1px var(--ht-paper-edge), 0 2px 10px rgba(0, 0, 0, .26);
  transition: transform var(--ht-dur-slow) var(--ht-ease), opacity var(--ht-dur-slow) var(--ht-ease), box-shadow var(--ht-dur) var(--ht-ease);
}
/* 海図の切れ端なので、外枠は罫ではなく「破れ口」。下辺だけ不揃いに刻む */
.ht-mark::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background:
    linear-gradient(var(--ht-ground), var(--ht-ground)) left  bottom / 18% 2px no-repeat,
    linear-gradient(var(--ht-ground), var(--ht-ground)) 34%   bottom / 14% 3px no-repeat,
    linear-gradient(var(--ht-ground), var(--ht-ground)) 62%   bottom / 22% 1px no-repeat,
    linear-gradient(var(--ht-ground), var(--ht-ground)) right bottom / 12% 3px no-repeat;
}
.ht-mark__name {
  font-family: var(--ht-font-display);
  font-size: clamp(11px, 13cqw, 15px);
  font-weight: 500;
  letter-spacing: .06em;
  line-height: 1.35;
  color: var(--ht-chart-ink);
}
/* 岩に残る潮位の線。3枚を並べると線の高さが階段状に上がる（＝許せる波の数） */
.ht-mark__level {
  position: relative;
  flex: 1;
  min-height: 22px;
  margin: 5px 0 4px;
}
.ht-mark__level::before {
  /* 岩の断面（銅版線1本） */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--ht-chart-ink);
  opacity: .35;
}
.ht-mark__level::after {
  /* 潮位線。--ht-level は 0〜1（0＝低い＝沖の岩、1＝高い＝岸の溜まり） */
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--ht-level, .3) * 100%);
  height: 1px;
  background: var(--ht-chart-ink);
  box-shadow: 0 3px 0 -2px var(--ht-chart-ink);
}
.ht-mark--oki   { --ht-level: .26; }
.ht-mark--naka  { --ht-level: .52; }
.ht-mark--kishi { --ht-level: .80; }

/* しぶき3つ＝許せる波の数（0／1／3）。塗ってある数が上限 */
.ht-mark__drops { display: flex; gap: 3px; }
.ht-drop {
  width: 6px;
  height: 6px;
  border: 1px solid var(--ht-chart-ink);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  opacity: .45;
}
.ht-drop.is-on { background: var(--ht-chart-ink); opacity: 1; }

/* 足あと6つ＝めくり枚数。濃い＝最低（3／2／1）、全部で6つ＝最大 */
.ht-mark__steps { display: flex; gap: 2px; margin-top: 4px; }
.ht-step {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ht-chart-ink);
  opacity: .22;
}
.ht-step.is-min { opacity: .95; }

.ht-mark__score {
  position: absolute;
  top: 7px;
  right: 7px;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: clamp(11px, 13cqw, 14px);
  font-weight: 500;
  color: var(--ht-chart-ink);
}

.ht-mark:hover:not(.is-used):not(:disabled) { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--ht-paper-edge), 0 6px 16px rgba(0, 0, 0, .34); }
.ht-mark.is-selected { box-shadow: inset 0 0 0 1px var(--ht-paper-edge), 0 0 0 2px var(--ht-brass-line), 0 6px 16px rgba(0, 0, 0, .34); }
/* 使ったしるべは沈む（下へ28px、不透明度 1.0 → 0.35） */
.ht-mark.is-used {
  transform: translateY(28px);
  opacity: .35;
  cursor: default;
  pointer-events: none;
}
.ht-mark:disabled { cursor: default; }

/* =====================================================================================
   12. かご（上限4枚）と得点
   ===================================================================================== */
.ht-basket {
  position: relative;
  z-index: 2;              /* 沈んだしるべ札（translateY 28px）より手前に置き、得点を読めるようにする */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--ht-line);
  /* 背負った竹かごの編み目。かごが埋まるほど左から隠れる（--ht-basket-fill は 0〜1） */
  background-image:
    repeating-linear-gradient(45deg,  var(--ht-brass-faint) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, var(--ht-brass-faint) 0 1px, transparent 1px 7px);
  background-size: calc((1 - var(--ht-basket-fill, 0)) * 100%) 100%;
  background-repeat: no-repeat;
  background-position: right bottom;
}
.ht-basket__slots { display: flex; gap: 6px; }
.ht-basket__slot {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--ht-line-soft);
}
.ht-basket__slot.is-filled {
  background: var(--ht-tone);
  box-shadow: inset 0 0 0 1px rgba(228, 234, 244, .28);
}
.ht-basket__count,
.ht-score {
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--ht-ink-dim);
}
.ht-basket__count b,
.ht-score b { font-size: 17px; font-weight: 500; color: var(--ht-ink); }
.ht-score b { color: var(--ht-brass); }

/* =====================================================================================
   13. 最初の画面（題字と遊び方の選択）
   ===================================================================================== */
.ht-view--dive { justify-content: space-between; }

.ht-view--title {
  justify-content: center;
  align-items: center;
  gap: clamp(16px, 4vh, 30px);
  text-align: center;
}
.ht-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.ht-title__ja {
  /* 題字だけ縦組み（アートディレクション 2-3）。UI のラベルは横組みのまま */
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--ht-font-display);
  font-size: clamp(34px, 10vw, 48px);
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1.1;
  color: var(--ht-ink);
}
.ht-title__en {
  font-family: var(--ht-font-num);
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ht-brass);
  writing-mode: vertical-rl;
}
.ht-title__lead {
  max-width: 19em;
  font-family: var(--ht-font-serif);
  font-size: 14px;
  line-height: 2;
  letter-spacing: .04em;
  color: var(--ht-ink-dim);
}
.ht-menu { display: flex; flex-direction: column; gap: 12px; width: min(300px, 100%); }

/* 人数の増減（ローカル対戦） */
.ht-seats { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ht-seats__num {
  min-width: 3ch;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  color: var(--ht-ink);
}

/* =====================================================================================
   14. 席（ローカル対戦。1台を回す）
   ===================================================================================== */
.ht-players { display: flex; gap: 6px; flex-wrap: wrap; }
.ht-player {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--ht-line-soft);
  font-size: 12px;
  color: var(--ht-ink-dim);
}
.ht-player.is-turn { box-shadow: inset 0 0 0 1px var(--ht-brass-line); color: var(--ht-ink); }
.ht-player.is-done { opacity: .5; }
.ht-player__name { font-family: var(--ht-font-serif); letter-spacing: .06em; }
.ht-player__score { font-family: var(--ht-font-num); font-variant-numeric: tabular-nums; color: var(--ht-brass); }
.ht-player__marks { display: flex; gap: 3px; }
.ht-player__marks i { width: 4px; height: 4px; border-radius: 50%; background: var(--ht-chart); opacity: .3; }
.ht-player__marks i.is-left { opacity: .95; }

/* =====================================================================================
   15. 浜（1局の終わり）
   -------------------------------------------------------------------------------------
   三角数の得点表が、そのまま浜に積まれた獲物の山の形になる。
   1枚＝1段。k 段目の幅は k × --ht-pile-step（app.js が各段に style="--i:k" を書く）。
   ===================================================================================== */
.ht-beach { display: flex; flex-direction: column; gap: clamp(12px, 3vh, 22px); }
.ht-beach__title {
  font-family: var(--ht-font-display);
  font-size: 20px;
  font-weight: 500;
  /* もとは「浜 に な ら べ た も の」と字の間に半角空白を入れていたが、空白はどの検索語とも
     一致しないので外した。字と字のあいだは .26em＋半角空白 .25em＋.26em だったので、
     同じ字送りになるよう字間を .77em にする。ただし字間は最後の字のうしろにも付くため、
     元より .51em ぶん行が長くなり、中央がずれて狭い画面では折り返してしまう。
     その .51em を margin-right で戻すと、字の位置も折り返す幅も元とまったく同じになる。
     はみ出す .51em は .ht-stage の右の余白の内側に収まるので、横スクロールは出ない */
  letter-spacing: .77em;
  margin-right: -.51em;
  text-align: center;
  color: var(--ht-ink);
}

.ht-piles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(5px, 2vw, 10px);
  align-items: end;
  justify-items: center;
}
.ht-pile { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.ht-pile__stack {
  /* 上が細く、底辺が一番広い ▲。app.js は --i:1 から順に段を出す（1段目が頂点） */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;               /* 段の縁に線は引かない。札どうしを台紙で離す（AD 2-8） */
  min-height: 12px;
}
.ht-pile__unit {
  width: calc(var(--i, 1) * var(--ht-pile-step));
  height: var(--ht-pile-unit);
  border-radius: 1px;
  background: var(--ht-tone);
  animation: ht-pile-in 260ms var(--ht-ease) both;
  animation-delay: calc((9 - var(--i, 1)) * 26ms);   /* 底から積み上がる */
}
@keyframes ht-pile-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ht-pile__name {
  max-width: 100%;
  font-family: var(--ht-font-serif);
  font-size: clamp(9px, 2.6vw, 11.5px);
  letter-spacing: 0;
  color: var(--ht-ink-dim);
  /* 長い名前は app.js 側で「イソギン」と短く出す。それでも溢れたら切る */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ht-pile__pts {
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: clamp(10px, 3vw, 13px);
  color: var(--ht-ink);
}
/* 【浜の主】＝その色の最多。真鍮の小さな刻み */
.ht-pile.is-lord .ht-pile__pts { color: var(--ht-brass); }
.ht-pile.is-lord .ht-pile__name::after { content: "　主"; color: var(--ht-brass); }

/* 使ったしるべ3枚（使った順）。バーストした潜りは空のかご */
.ht-used-marks { display: flex; justify-content: center; gap: clamp(8px, 3vw, 16px); }
.ht-used {
  position: relative;
  width: clamp(54px, 17vw, 74px);
  aspect-ratio: var(--ht-mark-ratio);
  border-radius: 1px;
  background: var(--ht-chart);
  color: var(--ht-chart-ink);
  font-family: var(--ht-font-serif);
  font-size: clamp(10px, 3vw, 12px);
  letter-spacing: .04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: inset 0 0 0 1px var(--ht-paper-edge);
}
.ht-used > * { position: relative; z-index: 1; }
.ht-used__order {
  position: absolute;
  top: 3px;
  left: 5px;
  font-family: var(--ht-font-num);
  font-size: 10px;
  opacity: .6;
}
.ht-used__pts { font-family: var(--ht-font-num); font-variant-numeric: tabular-nums; }
/* バースト＝空のかご。紙の上に緋の ✕（紙は常に明るいので、緋は濃いほうを使う） */
.ht-used.is-burst { background: var(--ht-chart-2); color: var(--ht-chart-ink); }
.ht-used.is-burst .ht-used__pts { color: var(--ht-crimson-paper); }
.ht-used.is-burst::after {
  content: "";
  position: absolute;
  inset: 26%;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1px), var(--ht-crimson-paper) calc(50% - 1px), var(--ht-crimson-paper) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom left,  transparent calc(50% - 1px), var(--ht-crimson-paper) calc(50% - 1px), var(--ht-crimson-paper) calc(50% + 1px), transparent calc(50% + 1px));
  opacity: .34;
}
.ht-used.is-burst .ht-used__pts { text-decoration: line-through; }

/* 合計点 */
.ht-total { text-align: center; }
.ht-total__num {
  display: block;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: clamp(44px, 15vw, 64px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: .04em;
  color: var(--ht-brass);
}
.ht-total__unit { font-size: .38em; letter-spacing: .18em; margin-left: .3em; }
.ht-total__rank { font-family: var(--ht-font-num); font-size: 14px; color: var(--ht-ink-dim); }

/* 内訳（浜／しるべ／浜の主） */
.ht-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ht-breakdown th,
.ht-breakdown td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--ht-line-soft);
  text-align: left;
  font-weight: 400;
  color: var(--ht-ink-dim);
}
.ht-breakdown th { font-family: var(--ht-font-serif); letter-spacing: .08em; }
.ht-breakdown td {
  text-align: right;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  color: var(--ht-ink);
}
.ht-breakdown tr:last-child th,
.ht-breakdown tr:last-child td { border-bottom: 0; color: var(--ht-brass); }

/* 保存・共有の2列。3つ目の「1枚を見る」は ht-btn--wide で2列ぶんの幅にして下段に置く */
.ht-share { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 3vw, 18px); }

/* 相互紹介の枠：結果画面の共有ボタンの下、1か所だけ。広告の体裁にしない。
   結果画面と同じ紙と線で描いた、もう1枚のカードにする（設計書 9-④(2)） */
.ht-cross {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 1px;
  background: var(--ht-chart);
  color: var(--ht-chart-ink);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--ht-paper-edge);
}
.ht-cross__label {
  font-family: var(--ht-font-serif);
  font-size: 11px;
  letter-spacing: .18em;
  opacity: .7;
}
.ht-cross__title { font-family: var(--ht-font-display); font-size: 15px; letter-spacing: .06em; }
.ht-cross__desc { font-size: 12px; line-height: 1.6; opacity: .8; }

/* 共有の1枚（押し葉標本のシート）を描く canvas の置き場 */
.ht-sheet {
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
  aspect-ratio: 9 / 16;
  background: #EFEDE6;
  box-shadow: var(--ht-shadow);
}

/* =====================================================================================
   16. 今日の潮（デイリー）
   ===================================================================================== */
.ht-tide { display: flex; flex-direction: column; gap: clamp(14px, 3.4vh, 26px); }

.ht-dist { display: flex; align-items: flex-end; gap: 3px; height: 92px; }
.ht-dist__bar {
  flex: 1;
  min-width: 0;
  height: calc(var(--h, 0) * 1%);
  min-height: 2px;
  background: var(--ht-ink-dim);
  opacity: .55;
}
.ht-dist__bar.is-me { background: var(--ht-brass-line); opacity: 1; }
.ht-dist__axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--ht-font-num);
  font-size: 11px;
  color: var(--ht-ink-faint);
}

/* しるべの使い順：3行（しるべ）× 3列（何手目）。最終ルールでしるべは3枚 */
.ht-grid3 {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr);
  gap: 3px;
  font-size: 12px;
}
.ht-grid3__head,
.ht-grid3__rowhead {
  font-family: var(--ht-font-serif);
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--ht-ink-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ht-grid3__rowhead { justify-content: flex-start; padding-right: 6px; white-space: nowrap; }
.ht-grid3__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--ht-ink);
  /* --ht-heat は 0〜1。セルの濃さ＝真鍮の alpha */
  background: rgba(176, 141, 74, calc(var(--ht-heat, 0) * .55));
}
.ht-grid3__cell.is-me { box-shadow: inset 0 0 0 1px var(--ht-crimson); }

/* あなたの七日間（折れ線はインライン SVG） */
.ht-trend { width: 100%; height: 92px; display: block; }
.ht-trend__line { fill: none; stroke: var(--ht-brass-line); stroke-width: 2; }
.ht-trend__dot { fill: var(--ht-brass-line); }
.ht-trend__tide { fill: none; stroke: var(--ht-ink-faint); stroke-width: 1; }
.ht-trend__note { margin: 2px 0 0; font-family: var(--ht-font-serif); font-size: 12px; color: var(--ht-ink-dim); }

.ht-tide__nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ht-tide__day {
  font-family: var(--ht-font-display);
  font-size: 17px;
  letter-spacing: .18em;
  color: var(--ht-ink);
}

/* =====================================================================================
   17. 見せ場（波札が出る瞬間）と、バースト
   -------------------------------------------------------------------------------------
   光らせるのはここだけ。グロー・加算合成・走査線は使わない。
   ===================================================================================== */
.ht-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: var(--ht-unfixed);
  opacity: 0;
}
.ht-flash.is-on { animation: ht-flash 330ms var(--ht-ease-flash) both; }
@keyframes ht-flash {
  0%   { opacity: 0; }
  27%  { opacity: .12; }   /* 90ms でかぶせて */
  100% { opacity: 0; }     /* 240ms で抜く */
}

.ht-scan {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: 3px;
  z-index: 41;
  pointer-events: none;
  background: var(--ht-crimson);
  opacity: 0;
}
.ht-scan.is-on { animation: ht-scan 180ms linear both; }
@keyframes ht-scan {
  0%   { opacity: .9; transform: translateY(0); }
  100% { opacity: .9; transform: translateY(100vh); }
}

/* バースト：かごを全部失う。暗転と緋の縁取りだけ */
.ht-stage.is-burst::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--ht-crimson), inset 0 0 90px rgba(0, 0, 0, .7);
  animation: ht-burst 620ms var(--ht-ease) both;
}
@keyframes ht-burst { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }

/* =====================================================================================
   18. ページ下部（rinblog-apps の共通の作り）
   ===================================================================================== */
.ad-slot {
  width: min(1020px, 100%);
  margin: 150px auto 0;    /* 誤タップ防止。AdSense はゲームから150px以上離すことを推奨している */
  padding: 0 var(--ht-pad);
}
.ad-label {
  margin: 0 0 4px;
  font-family: var(--ht-font-serif);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ht-ink-faint);
}

.doc { padding: 0 var(--ht-pad); line-height: 1.95; }
.doc-inner { max-width: 760px; margin: 0 auto; padding: 64px 0 8px; }
.about .doc-inner { padding-top: 40px; }

.doc h2 {
  margin: 52px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ht-line);
  font-family: var(--ht-font-serif);
  font-size: clamp(18px, 3.2vw, 22px);
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.6;
  color: var(--ht-ink);
}
.doc h2:first-of-type { margin-top: 0; }
.doc h3 { margin: 30px 0 10px; font-family: var(--ht-font-serif); font-size: 15px; font-weight: 700; letter-spacing: .04em; color: var(--ht-ink); }
.doc p  { margin: 0 0 15px; font-size: 15px; color: var(--ht-ink); }
.doc ul, .doc ol { margin: 0 0 18px; padding-left: 1.35em; }
.doc li { margin-bottom: 8px; font-size: 15px; color: var(--ht-ink); }
.doc li::marker { color: var(--ht-brass-line); }
.doc strong { color: var(--ht-ink); font-weight: 700; }
.doc a:not(.related-card):not(.rin-guide__close):not(.guideLink):not(.ht-cross) {
  color: var(--ht-brass);
  text-underline-offset: 3px;
  text-decoration-color: var(--ht-brass-soft);
}

.crumbs { margin: 0 0 20px; font-size: 12.5px; color: var(--ht-ink-dim); }
.crumbs a { color: var(--ht-ink-dim); text-decoration: none; }
.crumbs a:hover { color: var(--ht-brass); text-decoration: underline; }

.doc-table-wrap { overflow-x: auto; margin: 0 0 20px; -webkit-overflow-scrolling: touch; }
.doc-table { width: 100%; min-width: 440px; border-collapse: collapse; font-size: 14.5px; }
.doc-table th, .doc-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--ht-line-soft);
  color: var(--ht-ink);
}
.doc-table thead th {
  border-bottom: 1px solid var(--ht-line);
  font-family: var(--ht-font-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ht-ink-dim);
  white-space: nowrap;
}
.doc-table td:first-child { white-space: nowrap; font-weight: 700; }
.doc-table .ht-num { color: var(--ht-brass); }

.faq-item { border-bottom: 1px solid var(--ht-line-soft); }
.faq-item:first-of-type { border-top: 1px solid var(--ht-line-soft); }
.faq-item > summary {
  position: relative;
  padding: 17px 44px 17px 2px;
  list-style: none;
  cursor: pointer;
  font-family: var(--ht-font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ht-ink);
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover { color: var(--ht-brass); }
.faq-item > summary::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 1.5px solid var(--ht-ink-dim);
  border-bottom: 1.5px solid var(--ht-ink-dim);
  transform: rotate(45deg);
  transition: transform .22s ease;
}
.faq-item[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-item .faq-body { padding: 0 8px 18px 2px; }
.faq-item .faq-body p { margin: 0; font-size: 14px; color: var(--ht-ink-dim); }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin: 0 0 10px;
}
.related-card {
  display: block;
  padding: 16px 17px;
  border: 1px solid var(--ht-line-soft);
  border-radius: var(--ht-radius);
  background: var(--ht-panel);
  color: var(--ht-ink);
  text-decoration: none;
  transition: border-color .16s ease, transform .16s ease;
}
.related-card:hover { border-color: var(--ht-brass-line); transform: translateY(-2px); }
.related-card b { display: block; margin-bottom: 4px; font-size: 15px; font-weight: 700; }
.related-card span { font-size: 12.5px; line-height: 1.7; color: var(--ht-ink-dim); }
.about-related { margin-top: 30px; }

.guideLink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--ht-line);
  border-radius: var(--ht-radius);
  background: transparent;
  color: var(--ht-ink-dim);
  font-family: var(--ht-font-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .16s ease, color .16s ease;
}
.guideLink:hover { border-color: var(--ht-brass-line); color: var(--ht-brass); }
.guideLink--lg { min-height: var(--ht-tap); padding: 14px 20px; font-size: 14.5px; }

.doc-foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--ht-line-soft);
  font-size: 12.5px;
  color: var(--ht-ink-dim);
}

/* 遊び方パネルの中では、余白はパネル側が持つ */
.rin-guide .doc { padding: 0; }
.rin-guide .doc-inner { padding-top: 0; }
.rin-guide .rin-guide__head + h2 { margin-top: 0; }

/* =====================================================================================
   19. 狭い画面・低い画面
   ===================================================================================== */
@media (max-width: 380px) {
  :root { --ht-gap: 7px; }
  .ht-btn { font-size: 14.5px; letter-spacing: .10em; padding: 10px 10px; }
  .ht-mark__name { letter-spacing: .02em; }
  .ht-tideband__time { display: none; }        /* 日付・潮名・巡目を優先して残す */
}
/* iPhone SE（375×620 前後）でも、潜りの画面を1画面に収める */
@media (max-height: 680px) {
  :root {
    --ht-gap:      clamp(6px, 1.6vw, 10px);
    --ht-deck-h:   clamp(86px, 16svh, 128px);
    --ht-mark-h:   clamp(72px, 13svh, 108px);
    --ht-reveal-h: clamp(60px, 10.5svh, 92px);
  }
  .ht-sea { height: 56px; }
  .ht-tideband { min-height: 34px; padding-top: 4px; padding-bottom: 6px; }
  .ht-deck__count { font-size: 12px; line-height: 1.5; }
  .ht-basket { min-height: 44px; }
}

/* 横向き・広い画面では、山札としるべの余白だけ広げる（構図は変えない） */
@media (min-width: 560px) and (min-height: 700px) {
  :root { --ht-gap: 16px; }
}

/* =====================================================================================
   20. 動きを減らす設定
   -------------------------------------------------------------------------------------
   波札の白は「危険の合図」なので、明滅は止めるが、明るさの段差そのものは必ず残す。
   （波札の地 #F4F7F5 と緋の帯は、アニメーションと無関係に常に見えている）
   ===================================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .ht-sea__wave--a,
  .ht-sea__wave--b { animation: none !important; transform: none !important; }
  .ht-scan { display: none; }
  /* 点滅ではなく、静かに1回だけ白を敷いて消す */
  .ht-flash.is-on { animation: ht-flash-calm 300ms linear both !important; }
  @keyframes ht-flash-calm { 0% { opacity: .06; } 100% { opacity: 0; } }
  .ht-reveal__card.is-wave { transform: none !important; }
  .ht-card.is-new { opacity: 1 !important; transform: none !important; }
  .ht-pile__unit { opacity: 1 !important; transform: none !important; }
}

/* =====================================================================================
   21. app.js が作る部品（案内の2行・相手のえらび・はじめての案内・短い知らせ）
   -------------------------------------------------------------------------------------
   ここから下は、盤面を動かす app.js が実行時に組み立てる要素のためのもの。
   共通ファイル（rin-nav.css / rin-guide.css / rin-ads.css）は書き換えていない。
   ===================================================================================== */

/* 案内の1行は2段になる。上＝いま何ができるか、下＝同じ局面で世界がどうしたか。
   どちらも高さを常に確保して、めくるたびに画面が跳ねないようにする */
.ht-hint {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ht-hint__main { min-height: 1.6em; }
.ht-hint__world {
  min-height: 1.4em;
  font-family: var(--ht-font-num);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: .04em;
  color: var(--ht-ink-faint);
}
.ht-hint.is-danger .ht-hint__world { color: var(--ht-ink-faint); }

/* 相手のえらび（ひと／やさしい／ふつう／つよい）。人数の増減の下に置く。
   見出しを上の行に置いて、4つのボタンが 375px でも1行に並ぶようにしている */
.ht-opp { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 100%; }
.ht-seats--opp { flex-wrap: nowrap; justify-content: center; gap: 5px; }
.ht-iconbtn--wide {
  width: auto;
  min-width: 46px;
  height: 48px;
  padding: 0 9px;
  font-family: var(--ht-font-serif);
  font-size: 12.5px;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* タップの反応を速くする（拡大の二度押しを待たない）。
   ページそのものは普通にスクロールできるので、touch-action: none はどこにも置かない */
.ht-btn,
.ht-iconbtn,
.ht-mark,
.ht-player,
.ht-cross { touch-action: manipulation; }

/* 席の行はボタンにもなる（浜の画面で、押すとその人の浜に切り替わる） */
button.ht-player {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

/* はじめての案内（実際の盤の上に置く小さな紙） */
.ht-coach {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: min(430px, calc(100% - 26px));
  transform: translateX(-50%);
  padding: 13px 15px 12px;
  border-radius: var(--ht-radius);
  background: var(--ht-ground-2);
  box-shadow: inset 0 0 0 1px var(--ht-brass-soft), var(--ht-shadow);
  color: var(--ht-ink);
}
.ht-coach__text {
  margin: 0;
  font-family: var(--ht-font-serif);
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: .03em;
}
.ht-coach__row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }
/* 指し示す先が下半分にあるときは、箱を上に逃がして覆わないようにする。
   右上には共通ナビのボタンが載っているので、その幅ぶん余白を空けて文字が隠れないようにする */
.ht-coach.is-top {
  top: calc(14px + env(safe-area-inset-top, 0px));
  bottom: auto;
  padding-right: 62px;
}

/* いま見てほしい所を真鍮で囲う（色だけに頼らず、位置でも分かるようにしている） */
.is-coach {
  position: relative;
  z-index: 10;
  box-shadow: 0 0 0 2px var(--ht-brass-line);
  border-radius: var(--ht-radius);
}

/* 短い知らせ（コピーしました 等） */
.ht-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  margin: 0;
  padding: 10px 18px;
  transform: translateX(-50%) translateY(8px);
  border-radius: var(--ht-radius);
  background: var(--ht-ground-3);
  box-shadow: inset 0 0 0 1px var(--ht-brass-soft), var(--ht-shadow);
  font-family: var(--ht-font-serif);
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--ht-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ht-dur) var(--ht-ease), transform var(--ht-dur) var(--ht-ease);
}
.ht-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 低い画面では、案内の2行目を少し詰める（潜りの画面を1画面に保つため） */
@media (max-height: 680px) {
  .ht-hint { font-size: 12px; }
  .ht-hint__main { min-height: 1.5em; }
  .ht-hint__world { min-height: 1.3em; font-size: 10.5px; }
}

/* 潜りの画面の席の行は、必ず1行に収める。
   折り返すと（4〜5人のとき）盤面が縦に伸びて、低い端末で かご が画面の外に出る。
   はみ出したぶんはこの行の中だけで横に送る（ページ自体は横に広がらない） */
.ht-view--dive .ht-players {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ht-view--dive .ht-players::-webkit-scrollbar { display: none; }
.ht-view--dive .ht-player { flex: 0 0 auto; }

/* とても低い画面（iPhone SE を横に寝かせない縦持ち・ブラウザのバーが太い端末）。
   5人戦でも「かご」まで1画面に収める */
@media (max-height: 620px) {
  :root {
    --ht-gap:      4px;
    --ht-deck-h:   clamp(76px, 15svh, 110px);
    --ht-mark-h:   clamp(66px, 12.5svh, 98px);
    --ht-reveal-h: clamp(56px, 10svh, 86px);
  }
  .ht-view--dive .ht-players { gap: 4px; }
  .ht-view--dive .ht-player { padding: 3px 7px; font-size: 11px; gap: 5px; }
  .ht-row__head .ht-label { display: none; }     /* 「めくった列」の見出しは枠の形で分かる */
  .ht-row__head { justify-content: flex-end; }
  .ht-basket { min-height: 40px; }
  .ht-marks > .ht-label { display: none; }
}

/* 題字の画面は「相手のえらび」が増えたぶん、行の間を少し詰めて1画面に収める */
.ht-view--title { gap: clamp(12px, 2.8vh, 22px); }

/* =====================================================================================
   22. 横向き（低くて広い画面）
   -------------------------------------------------------------------------------------
   縦1列のままだと「めくる」ボタンと かご が画面の外に出て、遊ぶたびに上下に動かすことになる。
   左に卓と列、右にしるべと操作を置いて、1画面で完結させる。構図の考え方（山札→列→しるべ→かご）
   は変えていない。
   ===================================================================================== */
@media (orientation: landscape) and (max-height: 540px) and (min-width: 700px) {
  .ht-stage { max-width: 880px; }
  .ht-view--dive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "band    band"
      "players players"
      "table   marks"
      "row     hint"
      "row     actions"
      "basket  basket";
    align-content: start;
    column-gap: clamp(14px, 3vw, 26px);
  }
  .ht-view--dive > .ht-tideband { grid-area: band; }
  .ht-view--dive > .ht-players  { grid-area: players; }
  .ht-view--dive > .ht-table    { grid-area: table; }
  .ht-view--dive > .ht-row      { grid-area: row; }
  .ht-view--dive > .ht-hint     { grid-area: hint; }
  /* 盤が広がるぶん、右上の共通メニュー（rin-nav）がしるべ札に重なる。その高さぶん下げる */
  .ht-view--dive > .ht-marks    { grid-area: marks; padding-top: 46px; }
  .ht-view--dive > .ht-basket   { grid-area: basket; }
  .ht-view--dive > .ht-actions  { grid-area: actions; align-self: start; }
  .ht-view--dive > .ht-hint     { align-self: end; }
}
