/* リバーシ：深い緑・金・象牙。ガラス調のパネルと立体の石 */
:root {
  --bg0: #04150f;
  --bg1: #08241b;
  --bg2: #0e3a2c;
  --ink: #f5efe0;
  --ink-dim: #b9c9bf;
  --ink-faint: #7f9a8d;
  --gold: #e0bd78;
  --gold-hi: #f7e3b0;
  --gold-lo: #a67f36;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-hi: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.13);
  --line-gold: rgba(224, 189, 120, 0.45);
  --felt-hi: #1f7a58;
  --felt-lo: #0d4a35;
  --radius: 18px;
  --f-serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --f-sans: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --f-latin: "Cormorant Garamond", "Times New Roman", serif;
  /* 数字は「1」「0」がはっきり読める書体（Cormorant は古い字形で 1 が I、0 が o に見える） */
  --f-num: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.7;
  background: var(--bg0);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  font-variant-numeric: lining-nums tabular-nums;
}
button, select, input { font: inherit; color: inherit; }
a { color: var(--gold); }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------------------------------------------------------------- 背景 */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, var(--bg2) 0%, var(--bg1) 45%, var(--bg0) 100%); }
.bg-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.bg-glow.g1 { width: 56vmax; height: 56vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle, rgba(224, 189, 120, 0.32), transparent 65%); }
.bg-glow.g2 { width: 60vmax; height: 60vmax; right: -24vmax; bottom: -26vmax; background: radial-gradient(circle, rgba(35, 140, 100, 0.5), transparent 65%); }
.bg-grain {
  position: absolute; inset: 0; opacity: 0.16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------------------------------------------------------------- 上の帯 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1120px; width: 100%; margin: 0 auto; padding: 14px 16px 6px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { position: relative; width: 44px; height: 44px; flex: none; border-radius: 12px; background: linear-gradient(145deg, var(--felt-hi), var(--felt-lo)); box-shadow: 0 0 0 1px var(--line-gold), 0 6px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.bm-b, .bm-w { position: absolute; width: 20px; height: 20px; border-radius: 50%; top: 12px; }
.bm-b { left: 6px; background: radial-gradient(circle at 35% 30%, #5a5a5a, #101010 60%, #000); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5); }
.bm-w { right: 6px; background: radial-gradient(circle at 35% 30%, #fff, #e6e1d4 60%, #b9b3a2); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.45); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-family: var(--f-serif); font-size: 22px; letter-spacing: 0.12em; font-weight: 700; }
.brand-text small { font-family: var(--f-latin); font-size: 13px; letter-spacing: 0.28em; color: var(--gold); text-transform: uppercase; }

.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; min-width: 0; }
.snd { display: flex; gap: 8px; }
.snd-btn {
  appearance: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-gold); background: rgba(224, 189, 120, 0.16); color: var(--gold-hi); font-size: 13px; font-weight: 700; line-height: 1;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.snd-btn:hover { background: rgba(224, 189, 120, 0.26); }
.snd-btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.snd-btn svg { flex: none; }
.snd-btn .slash { opacity: 0; }
.snd-state { font-family: var(--f-sans); font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--gold); color: #2a1c05; }
.snd-btn[aria-pressed="false"] { border-color: var(--line); background: var(--glass); color: var(--ink-faint); }
.snd-btn[aria-pressed="false"] .slash { opacity: 1; }
.snd-btn[aria-pressed="false"] .ic { opacity: 0.6; }
.snd-btn[aria-pressed="false"] .snd-state { background: rgba(255, 255, 255, 0.12); color: var(--ink-faint); }
.btn-logout { white-space: normal; line-height: 1.3; min-width: 0; flex: 0 1 auto; }

.me {
  display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%;
  padding: 6px 8px 6px 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line-gold);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.me-label { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.me-name { font-family: var(--f-serif); font-weight: 700; font-size: 17px; color: var(--gold-hi); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 全体の枠 */
.stage { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 10px 16px 28px; }
.foot { display: flex; justify-content: center; gap: 18px; padding: 14px 16px 22px; font-size: 13px; color: var(--ink-faint); flex-wrap: wrap; }
.foot a { color: var(--ink-dim); }

/* ---------------------------------------------------------------- ボタン */
.btn {
  appearance: none; border: 1px solid var(--line); cursor: pointer; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; min-height: 44px; border-radius: 999px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--glass-hi); color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, select:focus-visible, .cell:focus-visible, .seg input:focus-visible + span { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-lg { min-height: 52px; padding: 12px 28px; font-size: 17px; }
.btn-block { display: flex; width: 100%; }
.btn-gold {
  color: #2a1c05; border-color: rgba(255, 244, 205, 0.7);
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 52%, var(--gold-lo) 100%);
  box-shadow: 0 8px 22px rgba(166, 127, 54, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn-gold:hover:not(:disabled) { box-shadow: 0 10px 28px rgba(224, 189, 120, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.btn-primary { border-color: var(--line-gold); background: linear-gradient(180deg, rgba(224, 189, 120, 0.22), rgba(224, 189, 120, 0.1)); color: var(--gold-hi); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, rgba(224, 189, 120, 0.34), rgba(224, 189, 120, 0.16)); }
.btn-quiet { background: var(--glass); color: var(--ink-dim); }
.btn-quiet:hover:not(:disabled) { background: var(--glass-hi); color: var(--ink); }

/* ---------------------------------------------------------------- パネル・入力 */
.panel {
  position: relative; padding: 20px 20px 22px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035));
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel h2 { font-family: var(--f-serif); font-size: 21px; letter-spacing: 0.1em; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel h2::before { content: ""; width: 5px; height: 20px; border-radius: 3px; background: linear-gradient(var(--gold-hi), var(--gold-lo)); }
.count { font-family: var(--f-num); font-weight: 700; font-size: 17px; color: var(--gold-hi); }
.hint-line { font-size: 14px; color: var(--ink-dim); margin-bottom: 12px; }
.empty { padding: 18px 8px; text-align: center; color: var(--ink-faint); font-size: 14px; }
.fine { margin-top: 10px; font-size: 14px; color: #ffb4a0; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.field > span { font-size: 12px; letter-spacing: 0.1em; color: var(--ink-faint); }
select {
  appearance: none; -webkit-appearance: none; width: 100%; min-height: 48px; padding: 10px 40px 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); font-size: 16px; font-weight: 500; cursor: pointer; color: var(--ink);
  background-color: rgba(4, 21, 15, 0.7);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1.5l6 6 6-6' fill='none' stroke='%23e0bd78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
}
select option { background: #08241b; color: var(--ink); }
select:hover { border-color: var(--line-gold); }

/* ---------------------------------------------------------------- ログイン */
.hero { text-align: center; padding: 26px 0 22px; }
.hero-title {
  font-family: var(--f-serif); font-weight: 700; letter-spacing: 0.22em; font-size: clamp(44px, 12vw, 76px); line-height: 1.15;
  background: linear-gradient(180deg, #fff6d9 0%, var(--gold) 55%, var(--gold-lo) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  display: flex; flex-direction: column; align-items: center;
}
.hero-title span { font-size: clamp(14px, 3.6vw, 20px); letter-spacing: 0.5em; margin-top: 6px; font-weight: 500; padding-left: 0.5em; }
.hero-lead { margin-top: 14px; color: var(--ink-dim); font-size: 15px; }
.login-panel { max-width: 540px; margin: 0 auto; padding: 24px 22px 26px; }
.step { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 4px 0 12px; font-size: 15px; }
.step b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(var(--gold-hi), var(--gold-lo)); color: #2a1c05; font-family: var(--f-num); font-size: 15px; }
.select-row { display: flex; gap: 12px; }
.name-preview {
  margin: 16px 0 22px; padding: 14px 12px; text-align: center; border-radius: 14px;
  background: rgba(0, 0, 0, 0.28); border: 1px dashed var(--line-gold);
}
.name-preview > span { display: block; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.12em; }
.name-preview b { display: block; font-family: var(--f-serif); font-size: clamp(26px, 7vw, 34px); letter-spacing: 0.1em; color: var(--gold-hi); line-height: 1.3; overflow-wrap: anywhere; }
.feature-list { margin-top: 22px; display: grid; gap: 8px; }
.feature-list li { font-size: 14px; color: var(--ink-dim); padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); display: flex; gap: 10px; align-items: baseline; }
.feature-list b { color: var(--gold); min-width: 4.4em; font-family: var(--f-serif); }

/* ---------------------------------------------------------------- 待合 */
.lobby { display: grid; gap: 18px; padding-top: 10px; }
.lb-players, .lb-center { display: grid; gap: 18px; align-content: start; min-width: 0; }
.lb-board { min-width: 0; }
.lobby-hero { display: none; }
@media (min-width: 900px) {
  .lobby { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-areas: "pl bd" "ce bd"; align-items: start; }
  .lb-players { grid-area: pl; }
  .lb-center { grid-area: ce; }
  .lb-board { grid-area: bd; }
}
.player-list { display: grid; align-content: start; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.player {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.player:hover:not(.is-busy) { border-color: var(--line-gold); background: rgba(224, 189, 120, 0.08); transform: translateY(-1px); }
.player.is-busy { cursor: default; opacity: 0.75; }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-serif); font-weight: 700; font-size: 19px; color: #2a1c05; background: linear-gradient(145deg, var(--gold-hi), var(--gold-lo)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 8px rgba(0, 0, 0, 0.4); }
.p-info { flex: 1 1 9em; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.p-nm { font-family: var(--f-serif); font-size: 17px; letter-spacing: 0.06em; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.chip { white-space: nowrap; font-size: 12px; padding: 1px 10px; border-radius: 999px; border: 1px solid; line-height: 1.6; }
.chip-idle { color: #9fe5bd; border-color: rgba(120, 220, 160, 0.45); background: rgba(60, 170, 110, 0.14); }
.chip-game { color: #ffd59a; border-color: rgba(255, 190, 100, 0.45); background: rgba(230, 150, 40, 0.14); }
.chip-cpu { color: #b9cbff; border-color: rgba(150, 175, 255, 0.45); background: rgba(100, 130, 240, 0.14); }
.p-btn { flex: none; }

.cpu-grid { display: grid; gap: 14px; margin-bottom: 16px; }
.seg { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg legend { padding: 0; width: 100%; font-size: 12px; letter-spacing: 0.1em; color: var(--ink-faint); margin-bottom: 6px; float: left; }
.seg label { position: relative; flex: 1 1 0; min-width: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 10px; text-align: center; white-space: nowrap; border-radius: 12px; font-weight: 700; font-size: 15px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); color: var(--ink-dim); transition: all 0.2s;
}
.seg input:checked + span { color: #2a1c05; background: linear-gradient(180deg, var(--gold-hi), var(--gold)); border-color: rgba(255, 244, 205, 0.7); box-shadow: 0 6px 16px rgba(166, 127, 54, 0.3); }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45); }
.dot-b { background: radial-gradient(circle at 35% 30%, #666, #111 60%, #000); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.35); }
.dot-w { background: radial-gradient(circle at 35% 30%, #fff, #e6e1d4 60%, #b9b3a2); }

.post-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.post-form .field:first-child { flex: 2 1 200px; }
.post-form .field { flex: 1 1 130px; }
.post-form .btn { flex: 0 0 auto; min-height: 48px; }
.post-list { display: grid; align-content: start; gap: 6px; margin-top: 12px; max-height: 380px; overflow-y: auto; padding-right: 2px; }
.post { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: baseline; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.045); border-left: 3px solid var(--gold-lo); }
.post-name { font-family: var(--f-serif); font-weight: 700; color: var(--gold-hi); font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.post-text { font-size: 15px; min-width: 0; overflow-wrap: break-word; word-break: normal; }
@supports (word-break: auto-phrase) { .post-text { word-break: auto-phrase; } }
.post-time { font-family: var(--f-num); font-size: 13px; color: var(--ink-faint); white-space: nowrap; }
@media (max-width: 420px) {
  .post { grid-template-columns: 1fr auto; }
  .post-text { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------------------------------------------------------------- 対戦 */
.game { display: grid; gap: 14px; justify-items: center; padding-top: 8px; }
.game-top { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pcard {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; min-width: 0; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--line); transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.pcard .dot { width: 22px; height: 22px; }
.pcard > div { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pname { font-family: var(--f-serif); font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.prole { font-size: 11px; line-height: 1.3; color: var(--ink-faint); overflow-wrap: anywhere; }
.pcount { font-family: var(--f-num); font-weight: 700; font-size: 28px; line-height: 1; color: var(--ink); }
.pcard.turn { border-color: var(--gold); background: rgba(224, 189, 120, 0.14); box-shadow: 0 0 0 1px rgba(224, 189, 120, 0.4), 0 0 24px rgba(224, 189, 120, 0.25); }
.pcard.turn .pcount { color: var(--gold-hi); }
.pcard.mine .prole { color: var(--gold); }

.board-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.board-area { width: 100%; }
.board-frame {
  width: 100%; aspect-ratio: 1; padding: 2.6%; border-radius: 20px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.12) 0%, transparent 35%, rgba(0, 0, 0, 0.18) 100%),
    repeating-linear-gradient(92deg, #6a4526 0 7px, #5b3a1f 7px 13px, #70492a 13px 21px, #5f3d21 21px 28px);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 224, 160, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 6px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.4s;
}
.my-turn .board-frame { box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 224, 160, 0.4), 0 0 38px rgba(224, 189, 120, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 6px rgba(0, 0, 0, 0.4); }
.board {
  width: 100%; height: 100%; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 8px; overflow: hidden; position: relative;
  background:
    radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.2), transparent 55%),
    radial-gradient(90% 90% at 80% 95%, rgba(0, 0, 0, 0.3), transparent 60%),
    linear-gradient(145deg, var(--felt-hi), var(--felt-lo));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.55), inset 0 6px 14px rgba(0, 0, 0, 0.45);
  perspective: 900px;
}
.cell {
  position: relative; appearance: none; border: 0; padding: 0; margin: 0; background: transparent; cursor: default;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.5), inset 1px 1px 0 rgba(255, 255, 255, 0.05);
  -webkit-tap-highlight-color: transparent; min-width: 0; min-height: 0;
}
.cell.legal { cursor: pointer; }
.cell.legal:hover { background: rgba(247, 227, 176, 0.14); }

.stone { position: absolute; inset: 9%; transform-style: preserve-3d; transition: transform 0.62s cubic-bezier(0.3, 0.75, 0.25, 1), opacity 0.3s; pointer-events: none; }
.stone[data-c="0"] { transform: perspective(420px) rotateY(0deg) scale(0.2); opacity: 0; }
.stone[data-c="1"] { transform: perspective(420px) rotateY(0deg) scale(1); opacity: 1; }
.stone[data-c="2"] { transform: perspective(420px) rotateY(180deg) scale(1); opacity: 1; }
.board.instant .stone { transition: none !important; animation: none !important; }
.stone.drop { animation: drop 0.5s cubic-bezier(0.25, 0.8, 0.3, 1.2); }
@keyframes drop { 0% { translate: 0 -34%; scale: 1.35; } 60% { translate: 0 2%; scale: 0.96; } 100% { translate: 0 0; scale: 1; } }
.face { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fb {
  background: radial-gradient(circle at 34% 28%, #6b6b6b 0%, #2a2a2a 28%, #0c0c0c 62%, #000 100%);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.55), 0 1px 1px rgba(0, 0, 0, 0.7), inset 0 -2px 3px rgba(255, 255, 255, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.35);
}
.fw {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 34% 28%, #ffffff 0%, #f1ede2 32%, #d6d0c0 68%, #aaa392 100%);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(0, 0, 0, 0.55), inset 0 -2px 3px rgba(0, 0, 0, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.9);
}
.mark-hint { position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; margin: -11% 0 0 -11%; border-radius: 50%; pointer-events: none; opacity: 0; transform: scale(0.5); transition: opacity 0.25s, transform 0.25s; background: radial-gradient(circle, rgba(255, 244, 200, 0.95), rgba(224, 189, 120, 0.55) 70%); box-shadow: 0 0 10px rgba(247, 227, 176, 0.7); }
.cell.legal .mark-hint { opacity: 0.85; transform: scale(1); animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.88); opacity: 0.7; } 50% { transform: scale(1.08); opacity: 1; } }
.mark-last { position: absolute; left: 50%; top: 50%; width: 16%; height: 16%; margin: -8% 0 0 -8%; border-radius: 50%; pointer-events: none; opacity: 0; border: 2px solid #ff7a59; background: rgba(255, 122, 89, 0.35); box-shadow: 0 0 6px rgba(255, 122, 89, 0.8); transform: translateZ(0); }
.cell.last .mark-last { opacity: 1; }

.turn-line { min-height: 1.7em; font-family: var(--f-serif); font-size: 18px; letter-spacing: 0.06em; text-align: center; color: var(--ink-dim); margin-top: 6px; }
.turn-line.mine { color: var(--gold-hi); }
.sub-line { min-height: 1.5em; font-size: 14px; color: #ffcf9a; text-align: center; }
.game-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.game-side { display: contents; }
.game-record { display: none; }
.record-list {
  display: grid; gap: 4px; margin: 0; padding: 0 4px 0 0; list-style: none; overflow-y: auto;
  align-content: start; grid-auto-rows: max-content;
  scrollbar-width: thin; scrollbar-color: rgba(224, 189, 120, 0.45) rgba(255, 255, 255, 0.05);
}
.record-list::-webkit-scrollbar, .player-list::-webkit-scrollbar, .post-list::-webkit-scrollbar { width: 10px; }
.record-list::-webkit-scrollbar-track, .player-list::-webkit-scrollbar-track, .post-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 999px; }
.record-list::-webkit-scrollbar-thumb, .player-list::-webkit-scrollbar-thumb, .post-list::-webkit-scrollbar-thumb { background: rgba(224, 189, 120, 0.45); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.record-list::-webkit-scrollbar-thumb:hover, .player-list::-webkit-scrollbar-thumb:hover, .post-list::-webkit-scrollbar-thumb:hover { background: rgba(247, 227, 176, 0.7); background-clip: padding-box; }
.player-list, .post-list { scrollbar-width: thin; scrollbar-color: rgba(224, 189, 120, 0.45) rgba(255, 255, 255, 0.05); }
.rec { display: grid; grid-template-columns: 4.6em auto auto 1fr; gap: 10px; align-items: center; padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.045); font-size: 15px; }
.rec-no { font-family: var(--f-num); font-size: 13px; color: var(--ink-faint); }
.rec-pos { font-family: var(--f-num); font-weight: 700; color: var(--gold-hi); }
.rec-who { font-size: 13px; color: var(--ink-dim); }
.rec-pass { background: rgba(255, 190, 100, 0.08); }
.rec-pass .rec-pos { color: #ffd59a; font-weight: 500; }
.rec .dot { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- 小窓・通知 */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(2, 10, 7, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade 0.25s ease; }
.modal-card {
  position: relative; width: min(100%, 420px); padding: 34px 24px 24px; text-align: center; border-radius: 24px;
  background: linear-gradient(165deg, rgba(20, 70, 54, 0.96), rgba(6, 28, 21, 0.97));
  border: 1px solid var(--line-gold);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), 0 0 60px rgba(224, 189, 120, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.25, 1.1);
}
.modal-stones { position: absolute; left: 50%; top: -26px; width: 84px; height: 52px; margin-left: -42px; }
.ms-b, .ms-w { position: absolute; top: 0; width: 52px; height: 52px; border-radius: 50%; }
.ms-b { left: 0; background: radial-gradient(circle at 34% 28%, #6b6b6b, #0c0c0c 62%, #000); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2); }
.ms-w { right: 0; background: radial-gradient(circle at 34% 28%, #fff, #d6d0c0 68%, #aaa392); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55); }
.modal-kicker { font-family: var(--f-latin); font-size: 14px; letter-spacing: 0.3em; color: var(--gold); margin-top: 18px; }
.modal-card h2 { font-family: var(--f-serif); font-size: clamp(22px, 6vw, 27px); letter-spacing: 0.06em; line-height: 1.5; margin: 8px 0 14px; overflow-wrap: anywhere; }
.modal-card h2 b { color: var(--gold-hi); }
.timer { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 6px 6px 0; }
.timer i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transition: width 0.25s linear; }
.modal-sub { font-size: 14px; color: var(--ink-dim); margin: 8px 0 18px; min-height: 1.2em; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; padding-left: 12px; padding-right: 12px; }
.result-card .result-score { font-family: var(--f-num); font-size: 34px; font-weight: 700; color: var(--ink); letter-spacing: 0.04em; margin-bottom: 4px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }

.sending {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; width: min(calc(100% - 24px), 560px);
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 999px; font-size: 14px;
  background: rgba(8, 36, 27, 0.92); border: 1px solid var(--line-gold); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.sending > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.sending b { color: var(--gold-hi); }
.spin { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(224, 189, 120, 0.3); border-top-color: var(--gold-hi); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(calc(100% - 24px), 480px); pointer-events: none; }
.toast {
  padding: 11px 16px; border-radius: 14px; font-size: 14px; text-align: center; line-height: 1.5; overflow-wrap: anywhere;
  background: rgba(8, 36, 27, 0.95); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(-10px); transition: opacity 0.35s, transform 0.35s;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(120, 220, 160, 0.55); }
.toast-warn { border-color: rgba(255, 190, 100, 0.6); }

/* ---------------------------------------------------------------- 狭い画面 */
@media (max-width: 480px) {
  .topbar { padding: 10px 12px 4px; }
  .stage { padding: 6px 12px 22px; }
  .brand-text b { font-size: 19px; }
  .brand-mark { width: 38px; height: 38px; }
  .bm-b, .bm-w { width: 17px; height: 17px; top: 10px; }
  .me-label { display: none; }
  .me { padding-left: 12px; }
  .me-name { max-width: 9em; font-size: 15px; }
  .panel { padding: 16px 14px 18px; }
  .select-row { flex-direction: column; }
  .player { flex-wrap: wrap; }
  .p-btn { width: 100%; }
  .pcard { padding: 8px 10px; gap: 8px; }
  .pname { font-size: 14px; }
  .prole { font-size: 10.5px; }
  .pcount { font-size: 24px; }
  .seg span { padding: 8px 6px; gap: 6px; font-size: 14px; }
  .modal-card { padding: 34px 16px 20px; }
  .modal-actions .btn-lg { font-size: 16px; padding-left: 8px; padding-right: 8px; }
  .snd-label { display: none; }
  .snd-btn { padding: 6px 10px; }
  .toasts { top: 62px; }
}
/* 1099px 以下の対局：窓の高さ(100svh)の縦の割り付け。上の帯・名前の札・案内の文・ボタンは中身の高さ、盤の場所は残りの全部。
   盤はその場所の幅と高さの小さい方の正方形（高さの見積もりの定数は使わない）。盤の幅は上限 620px */
@media (max-width: 1099px) {
  body[data-view="game"] { height: 100svh; }
  body[data-view="game"] .stage { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding-top: 4px; padding-bottom: 4px; }
  body[data-view="game"] .foot { padding: 2px 16px 6px; gap: 14px; font-size: 12px; line-height: 1.4; }
  #view-game { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .game {
    flex: 1 1 0; min-height: 0; width: 100%; max-width: 620px; margin: 0 auto; padding-top: 2px; gap: 8px;
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; justify-items: stretch;
  }
  .game-top, .game-actions { width: 100%; }
  .board-wrap { width: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 0; justify-items: stretch; }
  .board-area { align-self: stretch; width: 100%; container-type: size; min-width: 0; min-height: 0; display: grid; place-items: center; }
  .board-frame { width: min(100cqw, 100cqh, 620px); margin: auto; }
  .turn-line { min-height: 0; margin-top: 4px; font-size: clamp(15px, 4.4vw, 18px); line-height: 1.5; letter-spacing: 0.03em; }
  .sub-line { min-height: 1.4em; font-size: 13px; line-height: 1.4; }
  .game-actions { flex-wrap: nowrap; gap: 8px; }
  .game-actions .btn { flex: 1 1 0; min-width: 0; max-width: 300px; white-space: nowrap; min-height: 40px; padding: 8px 10px; font-size: clamp(13px, 3.6vw, 15px); letter-spacing: 0; }
}

/* ---------------------------------------------------------------- 広い画面（横幅いっぱいを使う） */
@media (min-width: 1100px) {
  .topbar { max-width: none; padding: 16px clamp(24px, 3vw, 64px) 8px; }
  .stage { max-width: none; padding: 12px clamp(24px, 3vw, 64px) 24px; }

  /* 待合：1100〜1499px は2段組み（左に見出し・CPU 戦・掲示板、右に「いま遊べる人」を縦いっぱい）。1500px 以上で3段組み */
  .lobby {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "ce pl" "bd pl"; gap: clamp(18px, 2vw, 40px); max-width: 2200px; margin: 0 auto; padding-top: 14px;
  }
  .lb-center { container-type: inline-size; }
  .lobby-hero { display: block; text-align: center; padding: clamp(10px, 4svh, 56px) 0 clamp(4px, 2svh, 24px); }
  .lobby-kicker { font-family: var(--f-latin); font-size: 15px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold); }
  .lobby-title {
    margin-top: 8px; font-family: var(--f-serif); font-weight: 700; letter-spacing: 0.14em; line-height: 1.3; font-size: clamp(30px, 3.4vw, 68px); white-space: nowrap;
    background: linear-gradient(180deg, #fff6d9 0%, var(--gold) 55%, var(--gold-lo) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  }
  @supports (font-size: 1cqi) { .lobby-title { font-size: clamp(28px, 7.4cqi, 68px); letter-spacing: 0.1em; } }
  .lobby-lead { margin-top: 12px; color: var(--ink-dim); font-size: clamp(15px, 1.1vw, 18px); }
  .lb-players { align-self: stretch; }
  .lb-players > .panel { height: 100%; }
  .player-list { max-height: calc(100svh - 250px); min-height: 240px; }
  .post-list { max-height: calc(100svh - 620px); min-height: 160px; }

  /* 掲示板：「投稿する」は選ぶ欄と同じ行に置く */
  .post-form { flex-wrap: nowrap; }
  .post-form .field:first-child { flex: 1 1 0; min-width: 0; }
  .post-form .field { flex: 0 0 8.2em; }
  .post-form .btn { padding-left: 18px; padding-right: 18px; white-space: nowrap; }
  .post-form select { padding-left: 12px; padding-right: 34px; background-position: right 12px center; }

  /* 対局：左に二人の名前と石の数・中央に大きな盤・右にボタンと記録 */
  .game {
    --side: clamp(220px, 20vw, 440px);
    --bs: clamp(360px, min(100svh - 250px, 100vw - 2 * var(--side) - 170px), 960px);
    grid-template-columns: var(--side) var(--bs) var(--side); justify-content: center; justify-items: stretch; align-items: start;
    gap: clamp(20px, 2.4vw, 48px); padding-top: 4px;
  }
  .game-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .game .game-top, .game .game-actions { width: 100%; }
  .game .board-wrap { width: var(--bs); }
  .game .game-top { grid-template-columns: 1fr; gap: 14px; }
  .game .pcard { padding: 16px 18px; gap: 14px; border-radius: 16px; }
  .game .pcard .dot { width: 30px; height: 30px; }
  .game .pname { font-size: clamp(17px, 1.3vw, 22px); }
  .game .prole { font-size: 13px; }
  .game .pcount { font-size: clamp(40px, 3.4vw, 64px); }
  .game .game-actions { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .game .game-actions .btn { width: 100%; }
  .game-record { display: block; }
  .record-list { max-height: calc(var(--bs) - 190px); min-height: 80px; }
}
@media (min-width: 1500px) {
  .lobby {
    grid-template-columns: minmax(320px, 1fr) minmax(400px, 1.1fr) minmax(420px, 1.3fr);
    grid-template-areas: "pl ce bd";
  }
  .player-list { max-height: calc(100svh - 330px); }
  .post-list { max-height: calc(100svh - 440px); }
}

/* 名前は言葉の切れ目（「気まぐれな｜角の番人」）で折る。前半・後半をそれぞれ折り返さない塊にして、語の途中では折れない */
.nm-f, .nm-b, .ph { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------------------------------------------------------------- 文書ページ（プライバシーポリシー） */
.doc { max-width: 760px; margin: 12px auto 0; padding: 26px 24px 30px; }
.doc h1 { font-family: var(--f-serif); font-size: clamp(24px, 6vw, 30px); letter-spacing: 0.1em; color: var(--gold-hi); margin: 10px 0 2px; }
.doc h2 { font-family: var(--f-serif); font-size: 17px; margin: 26px 0 6px; padding-left: 10px; border-left: 4px solid var(--gold); letter-spacing: 0.06em; display: block; }
.doc h2::before { display: none; }
.doc p, .doc li { font-size: 15px; color: var(--ink-dim); overflow-wrap: anywhere; }
.doc ul { list-style: disc; padding-left: 1.3em; display: grid; gap: 6px; }
.doc b, .doc strong { color: var(--ink); }
.doc-date { font-size: 13px !important; color: var(--ink-faint) !important; margin-bottom: 12px; }
.doc-back { display: inline-block; font-size: 14px; text-decoration: none; }
