/* =====================================================================
   Werewolf Board Duel — pop & pastel theme
   Themes: [data-theme="pastel" | "candy" | "midnight" | "horror"] on <html>
   CO colours are fixed across themes (seer = yellow, medium = pink, hunter = green).
   ===================================================================== */
:root {
  /* fixed CO colours */
  --seer-bg: #FFF3B0;   --seer-bd: #F4D06F;   --seer-ink: #7A5B00;
  --medium-bg: #FFD1DC; --medium-bd: #FF9AA2; --medium-ink: #8A2340;
  --hunter-bg: #D8F3DC; --hunter-bd: #74C69D; --hunter-ink: #1F6B45;
  --cat-bg: #E7D9FF;    --cat-bd: #B79CFF;    --cat-ink: #4B2E83;
  --gidora-bg: #D0F4DE; --gidora-bd: #80CED7; --gidora-ink: #155E66;

  --wolf: #FF6B6B; --wolf-soft: #FFE3E3;
  --village: #5AA9E6; --village-soft: #DDEFFF;
  --ok: #3BB273; --danger: #FF6B6B;

  --radius: 16px; --radius-sm: 12px;
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --font-logo: "Fredoka", "M PLUS Rounded 1c", system-ui, sans-serif;
}

/* ---- theme: classic pastel (default) ---- */
:root, [data-theme="pastel"] {
  --bg: linear-gradient(160deg, #FFF8F0 0%, #FFE8EF 45%, #E8F1FF 100%);
  --surface: #FFFFFF; --surface-2: #FFF7FA; --line: #F1DDE6;
  --ink: #4A3F55; --muted: #8C7F99;
  --accent: #FF8FAB; --accent-2: #7FC8F8; --accent-ink: #FFFFFF;
  --shadow: 0 6px 0 #EBD3DE, 0 12px 24px rgba(180, 120, 150, .18);
  --card-back: repeating-linear-gradient(45deg, #C3CCF7 0 10px, #D6DCFB 10px 20px);
  --card-back-ring: #FFFFFF;
  --card-face: linear-gradient(180deg, #FFFFFF, #FFF6F9);
  --dead: #CFC6D6;
}
[data-theme="candy"] {
  --bg: linear-gradient(135deg, #FFE5F1 0%, #E6E1FF 40%, #D9F7FF 75%, #FFF6CC 100%);
  --surface: #FFFFFF; --surface-2: #FBF6FF; --line: #E7DBFF;
  --ink: #3E2F5B; --muted: #8A7BA8;
  --accent: #A06CFF; --accent-2: #FF7AC6; --accent-ink: #FFFFFF;
  --shadow: 0 6px 0 #D9C8FF, 0 12px 24px rgba(120, 80, 200, .18);
  --card-back: radial-gradient(circle at 25% 25%, #FFD6F0 0 18%, transparent 19%),
               radial-gradient(circle at 75% 70%, #C9F2FF 0 18%, transparent 19%),
               linear-gradient(135deg, #B79CFF, #FF9AD5);
  --card-back-ring: #FFF3FB;
  --card-face: linear-gradient(180deg, #FFFFFF, #F8F2FF);
  --dead: #D3CCE3;
}
[data-theme="midnight"] {
  --bg: radial-gradient(1200px 600px at 20% -10%, #3B3A72 0%, transparent 60%),
        linear-gradient(180deg, #1D1B38 0%, #15142B 100%);
  --surface: #26244A; --surface-2: #2E2C57; --line: #3E3B6E;
  --ink: #F1EEFF; --muted: #A9A4D6;
  --accent: #FFC86B; --accent-2: #8EC5FF; --accent-ink: #2A2200;
  --shadow: 0 6px 0 #121027, 0 12px 26px rgba(0, 0, 0, .45);
  --card-back: radial-gradient(circle at 70% 25%, #FFE9A8 0 7%, transparent 8%),
               radial-gradient(circle at 30% 70%, #ffffff55 0 2%, transparent 3%),
               radial-gradient(circle at 60% 80%, #ffffff44 0 1.5%, transparent 2.5%),
               linear-gradient(160deg, #4A47A3, #2B2966);
  --card-back-ring: #6E6BC4;
  --card-face: linear-gradient(180deg, #34316A, #2A2857);
  --dead: #4B4870;
  --wolf-soft: #4A2633; --village-soft: #1F3656;
}

/* ---- theme: 深海 (ocean) — Lv.10 reward ---- */
[data-theme="ocean"] {
  --bg: radial-gradient(1000px 520px at 50% -10%, #1F6F8B 0%, transparent 62%),
        linear-gradient(180deg, #0B2A3F 0%, #061826 100%);
  --surface: #0F3550; --surface-2: #134060; --line: #1F587A;
  --ink: #E6F7FF; --muted: #92C3D8;
  --accent: #4FD1C5; --accent-2: #7FB7FF; --accent-ink: #032A2A;
  --shadow: 0 6px 0 #04121C, 0 12px 26px rgba(0, 0, 0, .45);
  --card-back: radial-gradient(circle at 25% 30%, #ffffff33 0 3%, transparent 4%),
               radial-gradient(circle at 70% 60%, #ffffff26 0 2%, transparent 3%),
               radial-gradient(circle at 45% 85%, #ffffff22 0 4%, transparent 5%),
               repeating-linear-gradient(170deg, #12507A 0 14px, #0F4468 14px 28px);
  --card-back-ring: #3BA7C4;
  --card-face: linear-gradient(180deg, #164A6B, #103B57);
  --dead: #2D4F63;
  --wolf-soft: #4A2633; --village-soft: #123F5C;
}
/* ---- theme: 黄金 (gold) — Lv.20 reward ---- */
[data-theme="gold"] {
  --bg: radial-gradient(1100px 560px at 50% -10%, #6B4E12 0%, transparent 60%),
        linear-gradient(180deg, #1E1708 0%, #120D04 100%);
  --surface: #2A2110; --surface-2: #332813; --line: #5A4518;
  --ink: #FFF5D9; --muted: #D8C08A;
  --accent: #F2C14E; --accent-2: #FFE39A; --accent-ink: #2A1E00;
  --shadow: 0 6px 0 #0B0802, 0 12px 26px rgba(0, 0, 0, .5);
  --card-back: radial-gradient(circle at 50% 50%, #FFE7A0 0 10%, transparent 11%),
               repeating-conic-gradient(from 0deg at 50% 50%, #C99A2E 0 15deg, #A87C1F 15deg 30deg);
  --card-back-ring: #F2C14E;
  --card-face: linear-gradient(180deg, #3A2E15, #2C2310);
  --dead: #4E4430;
  --wolf-soft: #4A2633; --village-soft: #2E2A18;
}

[data-theme="horror"] {
  --bg: radial-gradient(900px 500px at 50% -8%, #3a1013 0%, transparent 65%),
        radial-gradient(800px 600px at 50% 120%, #2a2624 0%, transparent 60%),
        linear-gradient(180deg, #121010 0%, #070606 100%);
  --surface: #181515; --surface-2: #211d1c; --line: #3d3534;
  --ink: #F3EEE6; --muted: #B3A9A2;
  --accent: #C3001F; --accent-2: #7A0B17; --accent-ink: #FFF1EE;
  --shadow: 0 6px 0 #070102, 0 12px 28px rgba(0, 0, 0, .6), inset 0 0 0 1px #3a0e12;
  --card-back: url("../img/horror-back.svg") center / cover no-repeat, #1d1b1a;
  --card-back-ring: #2b2625;
  --card-face: radial-gradient(circle at 70% 85%, #8a001033 0 18%, transparent 40%),
               linear-gradient(180deg, #EFE8DC, #D9CFC0);
  --dead: #2a1214;
  --wolf: #E0102F; --wolf-soft: #3d0a10; --village-soft: #1d1a24;
  --danger: #B0001A;
  --font-logo: "Creepster", "Fredoka", "M PLUS Rounded 1c", system-ui, sans-serif;
}

[data-theme="sakura"] {
  --bg: radial-gradient(900px 520px at 80% -10%, #3b3d78 0%, transparent 60%),
        linear-gradient(180deg, #171936 0%, #0f1026 100%);
  --surface: #1f2147; --surface-2: #262856; --line: #3a3c74;
  --ink: #FBEFF4; --muted: #C9B6CF;
  --accent: #F497B6; --accent-2: #8E86D9; --accent-ink: #2A0E1B;
  --shadow: 0 6px 0 #0b0c1f, 0 12px 26px rgba(0, 0, 0, .45);
  --card-back: url("../img/sakura-back.svg") center / cover no-repeat, #1a1b3d;
  --card-back-ring: #E8C27A;
  --card-face: radial-gradient(circle at 80% 15%, #ffd6e5 0 10%, transparent 30%), linear-gradient(180deg, #FBF4E6, #F1E4CC);
  --dead: #3b3a5a;
  --wolf-soft: #4a2340; --village-soft: #22325a;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font); font-weight: 500;
  background: var(--bg); background-attachment: fixed; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.input-lg { font-size: 1.1rem; padding: 12px 16px; width: 100%; }

/* ---- buttons: chunky with press shadow ---- */
.btn {
  border: 0; border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 800;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 4px 0 var(--line); transform: translateY(0); transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 5px 0 var(--line); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 0 #C94A4A; }
.btn-ghost { background: transparent; box-shadow: none; border: 2px solid var(--line); }
.btn-ghost:hover:not(:disabled) { box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn-block { display: block; width: 100%; margin-top: 12px; }
.btn.toggle { border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.toggle.on { background: var(--accent-2); color: #fff; border-color: transparent; box-shadow: 0 3px 0 color-mix(in srgb, var(--accent-2) 60%, #000); }
.btn.toggle.on.t-seer { background: var(--seer-bg); color: var(--seer-ink); border-color: var(--seer-bd); box-shadow: 0 3px 0 var(--seer-bd); }
.btn.toggle.on.t-medium { background: var(--medium-bg); color: var(--medium-ink); border-color: var(--medium-bd); box-shadow: 0 3px 0 var(--medium-bd); }
.btn.toggle.on.t-hunter { background: var(--hunter-bg); color: var(--hunter-ink); border-color: var(--hunter-bd); box-shadow: 0 3px 0 var(--hunter-bd); }
.btn.toggle.on.t-cat { background: var(--cat-bg); color: var(--cat-ink); border-color: var(--cat-bd); box-shadow: 0 3px 0 var(--cat-bd); }
.btn.toggle.on.t-gidora { background: var(--gidora-bg); color: var(--gidora-ink); border-color: var(--gidora-bd); box-shadow: 0 3px 0 var(--gidora-bd); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--surface);
  box-shadow: 0 3px 0 var(--line); font-size: 1.15rem;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

.conn { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.conn.on { background: #DDF6E8; color: #1F7A4B; }
.conn.off { background: #FFE1E1; color: #B23B3B; }

/* ===================================================================== title screen */
.screen { max-width: 1180px; margin: 0 auto; padding: 16px; }
.game-screen { max-width: 1280px; padding-top: 10px; }
.title-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 18px; padding-bottom: 40px; }
.title-top { align-self: stretch; display: flex; justify-content: space-between; align-items: center; }
.hero { text-align: center; margin-top: 8px; }
.fan { position: relative; height: 160px; width: 360px; max-width: 100%; margin: 0 auto 6px; }
.fan-card {
  position: absolute; left: 50%; bottom: 0; width: 84px; height: 118px; margin-left: -42px;
  border-radius: 14px; background: var(--card-face); border: 4px solid var(--surface);
  box-shadow: var(--shadow); display: grid; place-items: center; font-size: 2.3rem;
  transform-origin: 50% 100%; animation: float 4s ease-in-out infinite;
}
.fan-card.back { background: var(--card-back); color: #fff; font-family: var(--font-logo); font-weight: 700; }
.fan-card.c1 { transform: translateX(-118px) rotate(-22deg); background: var(--seer-bg); border-color: var(--seer-bd); }
.fan-card.c2, .fan-card.c4 { z-index: 1; }
.fan-card.c2 { transform: translateX(-60px) rotate(-11deg) translateY(-8px); background: var(--medium-bg); border-color: var(--medium-bd); animation-delay: .3s; }
.fan-card.c3 { transform: translateY(-14px); animation-delay: .6s; z-index: 2; }
.fan-card.c4 { transform: translateX(60px) rotate(11deg) translateY(-8px); background: var(--hunter-bg); border-color: var(--hunter-bd); animation-delay: .9s; }
.fan-card.c5 { transform: translateX(118px) rotate(22deg); background: var(--wolf-soft); border-color: var(--wolf); animation-delay: 1.2s; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.logo { margin: 6px 0 4px; line-height: 1.1; }
.logo-jp {
  display: block; font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 800; letter-spacing: .04em;
  color: var(--ink); text-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 45%, transparent);
}
.logo-jp em { font-style: normal; color: var(--accent); }
.logo-en { display: block; font-family: var(--font-logo); font-weight: 700; letter-spacing: .18em; color: var(--muted); font-size: .95rem; text-transform: uppercase; margin-top: 6px; }
.tagline { color: var(--muted); margin: 6px 0 0; }
.name-chip {
  display: flex; align-items: center; gap: 10px; background: var(--surface); padding: 8px 8px 8px 16px;
  border-radius: 99px; box-shadow: var(--shadow);
}
.name-chip label { font-weight: 800; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.name-chip input { border-radius: 99px; width: 200px; }
.menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: min(560px, 100%); }
.menu-btn {
  border: 0; border-radius: 20px; padding: 18px 14px; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 2px; font-weight: 800; font-size: 1.1rem; color: #4A3F55;
  transition: transform .1s, box-shadow .1s;
}
.menu-btn .mi { font-size: 2rem; }
.menu-btn small { font-weight: 600; font-size: .78rem; opacity: .75; }
.menu-btn:hover { transform: translateY(-3px) rotate(-.5deg); }
.menu-btn:active { transform: translateY(3px); }
.m-create { background: var(--seer-bg); box-shadow: 0 6px 0 var(--seer-bd); }
.m-join { background: var(--hunter-bg); box-shadow: 0 6px 0 var(--hunter-bd); }
.m-cpu { background: #DCEBFF; box-shadow: 0 6px 0 #9CC6F2; }
.m-rules { background: var(--medium-bg); box-shadow: 0 6px 0 var(--medium-bd); }
.menu-btn:active { box-shadow: 0 2px 0 rgba(0,0,0,.12); }

/* ===================================================================== game screen */
.game-bar {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: 18px; padding: 6px 10px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.bar-left, .bar-mid, .bar-right { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { background: var(--surface-2); border: 2px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: .82rem; white-space: nowrap; }
.room-chip b { font-size: .92rem; }
.day-pill { background: var(--accent-2); color: #fff; border-radius: 99px; padding: 3px 12px; font-family: var(--font-logo); font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.phase-pill { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 3px 12px; font-weight: 800; white-space: nowrap; }
.game-bar .icon-btn { width: 34px; height: 34px; font-size: 1rem; }
.game-bar .btn-sm { padding: 4px 10px; }
.conn-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.conn-dot.on { background: #3BB273; box-shadow: 0 0 0 3px #DDF6E8; }
.conn-dot.off { background: #E05555; box-shadow: 0 0 0 3px #FFE1E1; animation: blink 1s infinite; }
.legend-panel .legend-row { margin-top: 0; }
.legend-panel .legend { margin-bottom: 0; }
.invite-box { display: flex; gap: 6px; }
.invite-box.highlight .btn-primary { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 65%, #000), 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
                    50% { box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 65%, #000), 0 0 0 10px transparent; } }

/* --board-w is computed by fitBoard() (app.js) so the whole board fits the screen height */
.game-body { display: grid; grid-template-columns: var(--board-w, 640px) minmax(0, 1fr); gap: 18px; align-items: start; }
.board-wrap { width: 100%; min-width: 0; }
@media (max-width: 880px) {
  .game-body { grid-template-columns: minmax(0, 1fr); }
  .board-wrap { width: min(100%, var(--board-w, 640px)); margin: 0 auto; }
}

.panel { background: var(--surface); border-radius: 20px; padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel-title { margin: 0 0 8px; font-size: 1rem; font-weight: 800; }
.panel.secret { background: color-mix(in srgb, var(--wolf-soft) 70%, var(--surface)); }

/* ---- board & cards ---- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card {
  position: relative; aspect-ratio: 5 / 7; border-radius: 18px; padding: 8px;
  background: var(--card-face); border: 4px solid var(--surface);
  box-shadow: 0 5px 0 var(--line), 0 10px 18px rgba(0,0,0,.08);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  transition: transform .14s, box-shadow .14s; user-select: none; overflow: hidden;
}
.card .num {
  align-self: flex-start; font-family: var(--font-logo); font-weight: 700; font-size: .85rem;
  background: var(--surface); color: var(--ink); border-radius: 99px; padding: 0 9px; box-shadow: 0 2px 0 var(--line);
}
.card .art { position: relative; z-index: 0; font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.08)); }
/* history marks always win over the big "?" : the art fades back when a card has marks */
.card.has-marks .art { opacity: .28; }
.card.has-marks.facedown .art { opacity: .22; }
.card .ident { font-weight: 800; font-size: .95rem; text-align: center; }
/* face-down card (identity unknown to the viewer) */
.card.facedown { background: var(--card-back); border-color: var(--card-back-ring); }
.card.facedown .art { color: #fff; font-family: var(--font-logo); font-weight: 700; text-shadow: 0 3px 0 rgba(0,0,0,.15); }
.card.facedown .ident { color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.18); font-size: .8rem; }
.card.wolfcard { background: linear-gradient(180deg, var(--wolf-soft), var(--surface)); border-color: var(--wolf); }
.card.wolfcard .ident { color: var(--wolf); }
/* CO colouring — overrides the frame so the claim is visible at a glance */
.card.co-seer { border-color: var(--seer-bd); box-shadow: 0 5px 0 var(--seer-bd), 0 0 0 4px var(--seer-bg), 0 10px 18px rgba(0,0,0,.08); }
.card.co-medium { border-color: var(--medium-bd); box-shadow: 0 5px 0 var(--medium-bd), 0 0 0 4px var(--medium-bg), 0 10px 18px rgba(0,0,0,.08); }
.card.co-hunter { border-color: var(--hunter-bd); box-shadow: 0 5px 0 var(--hunter-bd), 0 0 0 4px var(--hunter-bg), 0 10px 18px rgba(0,0,0,.08); }
.card.co-cat { border-color: var(--cat-bd); box-shadow: 0 5px 0 var(--cat-bd), 0 0 0 4px var(--cat-bg), 0 10px 18px rgba(0,0,0,.08); }
.card.co-gidora { border-color: var(--gidora-bd); box-shadow: 0 5px 0 var(--gidora-bd), 0 0 0 4px var(--gidora-bg), 0 10px 18px rgba(0,0,0,.08); }
.card.facedown.co-seer { background: repeating-linear-gradient(45deg, var(--seer-bg) 0 10px, #FFF9D6 10px 20px); }
.card.facedown.co-medium { background: repeating-linear-gradient(45deg, var(--medium-bg) 0 10px, #FFE6EC 10px 20px); }
.card.facedown.co-hunter { background: repeating-linear-gradient(45deg, var(--hunter-bg) 0 10px, #EAF8EC 10px 20px); }
.card.facedown.co-seer .art, .card.facedown.co-seer .ident { color: var(--seer-ink); text-shadow: none; }
.card.facedown.co-medium .art, .card.facedown.co-medium .ident { color: var(--medium-ink); text-shadow: none; }
.card.facedown.co-hunter .art, .card.facedown.co-hunter .ident { color: var(--hunter-ink); text-shadow: none; }
.card.facedown.co-cat { background: repeating-linear-gradient(45deg, var(--cat-bg) 0 10px, #F2EBFF 10px 20px); }
.card.facedown.co-gidora { background: repeating-linear-gradient(45deg, var(--gidora-bg) 0 10px, #E6FAF0 10px 20px); }
.card.facedown.co-cat .art, .card.facedown.co-cat .ident { color: var(--cat-ink); text-shadow: none; }
.card.facedown.co-gidora .art, .card.facedown.co-gidora .ident { color: var(--gidora-ink); text-shadow: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .78rem;
  padding: 3px 10px; border-radius: 99px; border: 2px solid transparent; white-space: nowrap;
}
.badge.claim-seer { background: var(--seer-bg); border-color: var(--seer-bd); color: var(--seer-ink); }
.badge.claim-medium { background: var(--medium-bg); border-color: var(--medium-bd); color: var(--medium-ink); }
.badge.claim-hunter { background: var(--hunter-bg); border-color: var(--hunter-bd); color: var(--hunter-ink); }
.badge.claim-cat { background: var(--cat-bg); border-color: var(--cat-bd); color: var(--cat-ink); }
.badge.claim-gidora { background: var(--gidora-bg); border-color: var(--gidora-bd); color: var(--gidora-ink); }
.card .badge { position: relative; z-index: 2; box-shadow: 0 2px 0 rgba(0,0,0,.1); }
.card .num { z-index: 2; }
.card .marks {
  position: absolute; z-index: 3; top: 6px; right: 6px; left: 34%;
  display: flex; flex-direction: column; flex-wrap: wrap; align-items: flex-end; align-content: flex-end; gap: 3px;
  max-height: calc(100% - 44px); overflow: hidden; pointer-events: none;
}
.mark {
  font-size: .66rem; font-weight: 800; padding: 1px 6px; border-radius: 99px; line-height: 1.45;
  background: var(--surface); color: var(--ink); box-shadow: 0 2px 0 rgba(0,0,0,.12); white-space: nowrap;
}
.mark.m-guard { background: var(--hunter-bg); color: var(--hunter-ink); }
.mark.m-divine { background: var(--seer-bg); color: var(--seer-ink); }
.mark.m-attack { background: var(--wolf); color: #fff; }
.mark.m-exec { background: #6C5B7B; color: #fff; }
.mark.m-black { background: #2E2A3A; color: #FF9AA2; }
.mark.m-white { background: #FFFFFF; color: #4A3F55; border: 1px solid #E5DDEA; }
.mark.m-fake { background: var(--wolf); color: #fff; }
.mark.m-white { background: #FFFFFF; color: #4A3F55; border: 1px solid #E5DDEA; }
.card.dead { filter: grayscale(.85) brightness(.92); opacity: .62; }
.card.dead::after {
  content: "✕"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 4rem; font-weight: 800; color: rgba(90, 70, 100, .55); pointer-events: none;
}
.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-5px) rotate(-1deg); }
.card.selected { outline: 4px solid var(--accent); outline-offset: 3px; transform: translateY(-5px); }
.card.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.legend-row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.legend { margin: 8px 0 0; text-align: center; font-size: .82rem; color: var(--muted); }

/* ---- action panel ---- */
.action-panel h2 { margin: 0 0 4px; font-size: 1.15rem; font-weight: 800; }
.action-panel .hint { color: var(--muted); font-size: .88rem; margin: 4px 0 10px; }
.action-panel .field { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.action-panel .field > span:first-child { min-width: 8.5em; font-weight: 700; font-size: .9rem; }
.action-panel .field.active select { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.action-panel .buttons { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.waiting { color: var(--muted); }
.waiting::after { content: " ●●●"; letter-spacing: 2px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.public-plan { background: var(--wolf-soft); border: 2px dashed var(--wolf); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .88rem; }
.invite-url { background: var(--surface-2); border: 2px dashed var(--accent); border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all; font-size: .85rem; }
.result-banner { font-size: 1.4rem; font-weight: 800; text-align: center; padding: 14px; border-radius: var(--radius); }
.result-banner.win { background: #DDF6E8; color: #1F7A4B; }
.result-banner.lose { background: #FFE1E1; color: #B23B3B; }
.result-banner.neutral { background: var(--surface-2); }

/* ---- log ---- */
.log { margin: 0; padding-left: 2.6em;   /* room for 2-3 digit numbers (10., 124.) */ max-height: 300px; overflow-y: auto; font-size: .88rem; }
.log li { padding: 4px 0; border-bottom: 2px dotted var(--line); }
.log .day { font-family: var(--font-logo); font-weight: 700; color: var(--muted); font-size: .75rem; margin-right: 6px; }
.v-black { background: #2E2A3A; color: #FF9AA2; border-radius: 6px; padding: 0 6px; font-weight: 800; }
.v-white { background: #FFFFFF; color: #4A3F55; border: 1px solid #E5DDEA; border-radius: 6px; padding: 0 6px; font-weight: 800; }

/* ===================================================================== modals */
.modal { position: fixed; inset: 0; background: rgba(60, 40, 70, .35); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.sheet {
  position: relative; background: var(--surface); width: min(460px, 100%); max-height: 90vh; overflow-y: auto;
  border-radius: 24px; padding: 22px 20px 20px; box-shadow: var(--shadow); animation: rise .2s ease-out;
}
.sheet-wide { width: min(640px, 100%); }
.sheet h2 { margin: 0 0 8px; font-size: 1.3rem; font-weight: 800; }
.sheet .sub { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; font-size: 1rem; }
.close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); font-weight: 800; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.form-row { display: flex; gap: 8px; }
.form-row input { flex: 1; }
.seat-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 12px 0 4px; }
.seat { border: 3px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 4px 0 var(--line); }
.seat span { font-size: 1.8rem; }
.seat small { color: var(--muted); font-weight: 600; }
.seat.selected.village { border-color: var(--village); background: var(--village-soft); box-shadow: 0 4px 0 var(--village); }
.seat.selected.wolf { border-color: var(--wolf); background: var(--wolf-soft); box-shadow: 0 4px 0 var(--wolf); }
.seat.selected.any { border-color: var(--accent); box-shadow: 0 4px 0 var(--accent); }
.room-list { list-style: none; padding: 0; margin: 0; }
.room-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 4px; border-bottom: 2px dotted var(--line); font-size: .9rem; }
.rules section { margin-bottom: 12px; }
.rules h3 { margin: 0 0 4px; font-size: 1rem; }
.rules ul, .rules ol { margin: 0; padding-left: 1.3em; }
.rules li { margin: 3px 0; }
.rc { border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.rc.seer { background: var(--seer-bg); color: var(--seer-ink); }
.rc.medium { background: var(--medium-bg); color: var(--medium-ink); }
.rc.hunter { background: var(--hunter-bg); color: var(--hunter-ink); }
.rc.cat { background: var(--cat-bg); color: var(--cat-ink); }
.rc.gidora { background: var(--gidora-bg); color: var(--gidora-ink); }
.theme-pick { display: grid; gap: 10px; }
.theme-opt { display: flex; align-items: center; gap: 12px; border: 3px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 4px 0 var(--line); text-align: left; }
.theme-opt.selected { border-color: var(--accent); box-shadow: 0 4px 0 var(--accent); }
.sw { display: flex; gap: 4px; }
.sw i { display: block; width: 30px; height: 42px; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.sw-pastel i:first-child { background: repeating-linear-gradient(45deg, #C3CCF7 0 6px, #D6DCFB 6px 12px); }
.sw-pastel i:last-child { background: linear-gradient(180deg, #FFFFFF, #FFF6F9); }
.sw-candy i:first-child { background: linear-gradient(135deg, #B79CFF, #FF9AD5); }
.sw-candy i:last-child { background: linear-gradient(180deg, #FFFFFF, #F8F2FF); }
.sw-midnight i:first-child { background: linear-gradient(160deg, #4A47A3, #2B2966); border-color: #6E6BC4; }
.sw-midnight i:last-child { background: linear-gradient(180deg, #34316A, #2A2857); border-color: #6E6BC4; }
.sw-sakura i:first-child { background: url("../img/sakura-back.svg") center / cover, #1a1b3d; border-color: #E8C27A; }
.sw-sakura i:last-child { background: linear-gradient(180deg, #FBF4E6, #F1E4CC); border-color: #E8C27A; }
.sw-horror i:first-child { background: url("../img/horror-back.svg") center / cover, #1d1b1a; border-color: #D9CFC0; }
.sw-horror i:last-child { background: url("../img/horror-splat.svg") center / 90% no-repeat, linear-gradient(180deg, #EFE8DC, #D9CFC0); border-color: #D9CFC0; }

/* ---- sound settings ---- */
.top-icons { display: flex; gap: 8px; }
.icon-btn.muted { opacity: .55; }
.sound-rows { display: grid; gap: 10px; }
.fx-switch { display: grid; gap: 6px; margin: 10px 0 14px; }
.fx-switch .switch-row span { font-weight: 800; }
.fx-switch small { font-size: .78rem; line-height: 1.5; padding: 0 4px; }
.switch-row, .volume-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); border: 3px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-weight: 800;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .15s; }
.switch-row input:checked + i { background: var(--accent); }
.switch-row input:checked + i::after { transform: translateX(20px); }
.switch-row input:focus-visible + i { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.volume-row input { flex: 1; accent-color: var(--accent); padding: 0; border: 0; background: transparent; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60;
  width: max-content; max-width: min(92vw, 460px); text-align: center; line-height: 1.5;
  background: #FF8C8C; color: #fff; font-weight: 800; padding: 10px 18px; border-radius: 18px; box-shadow: 0 5px 0 #D96666;
}
.toast.info { background: #5CC48C; box-shadow: 0 5px 0 #3E9E6C; }

@media (max-width: 520px) {
  .fan { transform: scale(.82); transform-origin: 50% 100%; }
  .screen { padding: 12px; }
  .menu { grid-template-columns: 1fr 1fr; gap: 10px; }
  .menu-btn { padding: 14px 8px; font-size: 1rem; }
  .board { gap: 8px; }
  .card { border-width: 3px; border-radius: 14px; }
  .card .ident { font-size: .78rem; }
  .name-chip input { width: 150px; }
  /* phone: the player names wrap instead of running off the screen (sideways scrolling) */
  .game-bar .chip.players { white-space: normal; max-width: 100%; }
  .game-bar { padding: 6px 8px; gap: 5px 8px; }
  .game-bar .chip { font-size: .76rem; padding: 2px 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 4x3 board (12A猫): slightly tighter cards */
.board[data-ruleset="cat12"] { gap: 10px; }
.board[data-ruleset="cat12"] .card .art { font-size: clamp(1.4rem, 4.5vw, 2.1rem); }
.board[data-ruleset="cat12"] .card .badge { font-size: .68rem; padding: 2px 7px; }
.board[data-ruleset="cat12"] .card .ident { font-size: .78rem; }
@media (max-width: 520px) { .board[data-ruleset="cat12"] { gap: 6px; } .board[data-ruleset="cat12"] .card .badge { font-size: .6rem; padding: 1px 5px; } }

/* small cards (big boards / small screens): compact history chips */
.board[data-ruleset="a17"] .mark, .board[data-ruleset="cat12"] .mark, .board[data-ruleset="b12"] .mark { font-size: .6rem; padding: 0 5px; }
.board[data-ruleset="a17"] .card .num { font-size: .72rem; padding: 0 6px; }
.board[data-ruleset="a17"] .card .badge { font-size: .62rem; padding: 1px 5px; }

/* ruleset picker: 5 compact options */
.ruleset-pick { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.ruleset-pick .seat { padding: 10px 6px; }
.ruleset-pick .seat span { font-size: 1.5rem; }
.ruleset-pick .seat small { font-size: .7rem; text-align: center; line-height: 1.3; }
.result-banner.fox { background: #FFF1DC; color: #B5651D; }

/* mid-day CO prompt inside the execution step */
.midday-prompt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 4px 0 10px;
  padding: 8px 10px; border: 2px dashed var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.midday-prompt .midday-title { font-weight: 800; font-size: .85rem; }
.midday-prompt .buttons { margin-top: 0; }
/* 黒引き占い師のみCO要請 (A, day 1) */
.black-seer-request { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin: 4px 0 10px;
  padding: 8px 10px; border: 2px dashed var(--seer-bd); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--seer-bg) 45%, var(--surface)); }
.black-seer-request .midday-title { font-weight: 800; font-size: .85rem; }
/* ギドラ解除要請 (A) */
.gidora-reveal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin: 4px 0 10px;
  padding: 8px 10px; border: 2px dashed var(--gidora-bd); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gidora-bg) 45%, var(--surface)); }
.gidora-reveal .midday-title { font-weight: 800; font-size: .85rem; }
.log .gidora-list { margin: 4px 0 0; padding-left: 1.4em; display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; }
.log .gidora-list li { border: 0; padding: 0; }
.card.ident-freemason { border-color: #9AD0F5; background: linear-gradient(180deg, #EAF6FF, var(--surface)); }
.card.ident-freemason .ident { color: #2B6CB0; }

/* custom (advanced) instructions */
.custom-toggle { margin: 4px 0 8px; }
.field.multi .chips { display: inline-flex; flex-wrap: wrap; gap: 4px; min-width: 8em; }
.chip-sel { background: var(--seer-bg); color: var(--seer-ink); border: 2px solid var(--seer-bd); border-radius: 99px; padding: 0 8px; font-size: .85rem; }

/* ===================================================================== theme: horror (血みどろ)
   Blood drips on every card, a splattered back with claw marks, a bloody "?",
   blood splash instead of the ✕ on dead cards, a red vignette over the page. */
[data-theme="horror"] body { background-color: #070606; }
[data-theme="horror"] body::before {          /* blood running down from the top of the screen */
  content: ""; position: fixed; left: 0; right: 0; top: 0; height: 26px; z-index: 50; pointer-events: none;
  background: url("../img/horror-drip.svg") top left / 360px 26px repeat-x; opacity: .92;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.6));
}
[data-theme="horror"] body::after {           /* dark red vignette */
  content: ""; position: fixed; inset: 0; z-index: 49; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .6) 100%);
}
[data-theme="horror"] .card { border-color: #D9CFC0; box-shadow: 0 5px 0 #070102, 0 10px 22px rgba(0,0,0,.6); }
[data-theme="horror"] .card::before {         /* every card bleeds from its top edge */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22%; z-index: 1; pointer-events: none;
  background: url("../img/horror-drip.svg") top / 100% 100% no-repeat; opacity: .9;
}
[data-theme="horror"] .card.facedown::before { display: none; }   /* the back art already drips */
[data-theme="horror"] .card .num { background: #F3EEE6; color: #1a1414; box-shadow: 0 2px 0 #000; }
[data-theme="horror"] .card.facedown .art {
  color: #F3EEE6; font-family: "Creepster", var(--font-logo); font-weight: 400; font-size: clamp(2.4rem, 8vw, 3.6rem);
  text-shadow: 0 4px 0 #8a0010, 0 7px 2px rgba(138, 0, 16, .7), 0 0 14px rgba(255,255,255,.25), 0 0 18px rgba(0,0,0,.9);
  animation: horror-flicker 5.5s infinite steps(1);
}
[data-theme="horror"] .card.facedown .ident { color: #F3EEE6; text-shadow: 0 2px 0 #000; }
[data-theme="horror"] .card.facedown { border-color: #2b2625; }
[data-theme="horror"] .card:not(.facedown) .ident { color: #1a1414; }
[data-theme="horror"] .card.wolfcard { background: url("../img/horror-splat.svg") center 42% / 78% no-repeat,
  linear-gradient(180deg, #EFE8DC, #D9CFC0); border-color: #8a0010; }
[data-theme="horror"] .card.wolfcard .ident { color: #8a0010; text-shadow: none; position: relative; z-index: 2;
  background: #F3EEE6; border-radius: 99px; padding: 0 10px; box-shadow: 0 1px 0 #8a0010; }
/* CO cards keep their fixed colours but get dirty and stained */
[data-theme="horror"] .card.facedown[class*="co-"] { background-blend-mode: multiply; }
[data-theme="horror"] .card.facedown.co-seer { background: url("../img/horror-splat.svg") 85% 90% / 55% no-repeat, repeating-linear-gradient(45deg, #C9A73C 0 10px, #B08F2A 10px 20px); }
[data-theme="horror"] .card.facedown.co-medium { background: url("../img/horror-splat.svg") 85% 90% / 55% no-repeat, repeating-linear-gradient(45deg, #C66A7C 0 10px, #A9505F 10px 20px); }
[data-theme="horror"] .card.facedown.co-hunter { background: url("../img/horror-splat.svg") 85% 90% / 55% no-repeat, repeating-linear-gradient(45deg, #5E9B73 0 10px, #4A825D 10px 20px); }
[data-theme="horror"] .card.facedown.co-cat { background: url("../img/horror-splat.svg") 85% 90% / 55% no-repeat, repeating-linear-gradient(45deg, #8A72C4 0 10px, #7259AB 10px 20px); }
[data-theme="horror"] .card.facedown.co-gidora { background: url("../img/horror-splat.svg") 85% 90% / 55% no-repeat, repeating-linear-gradient(45deg, #4F9FA8 0 10px, #3B858D 10px 20px); }
[data-theme="horror"] .card.facedown[class*="co-"]::before { display: block; }
[data-theme="horror"] .card.facedown[class*="co-"] .art { color: #3a0007; text-shadow: 0 0 4px rgba(255,255,255,.25); animation: none; }
[data-theme="horror"] .card.dead { filter: grayscale(.55) brightness(.6) sepia(.3); opacity: .8; }
[data-theme="horror"] .card.dead::after {
  content: ""; background: url("../img/horror-splat.svg") center / 92% no-repeat; filter: drop-shadow(0 0 6px rgba(160,0,20,.5));
}
[data-theme="horror"] .card.selectable:hover { animation: horror-shake .28s linear; transform: translateY(-4px); box-shadow: 0 5px 0 #070102, 0 0 18px rgba(200, 0, 30, .55); }
[data-theme="horror"] .card.selected { outline-color: #E0102F; box-shadow: 0 0 22px rgba(224, 16, 47, .7); }
[data-theme="horror"] .logo-jp { color: #F3EEE6; text-shadow: 0 4px 0 #8a0010, 0 8px 3px rgba(138,0,16,.6); }
[data-theme="horror"] .logo-jp em { color: #C3001F; text-shadow: 0 0 10px rgba(195,0,31,.5), 0 3px 0 #1a0003; }
[data-theme="horror"] .logo-en { font-family: "Creepster", var(--font-logo); color: #D9CFC0; letter-spacing: .12em; font-size: 1.3rem; }
[data-theme="horror"] .fan-card.back { color: #F3EEE6; text-shadow: 0 3px 0 #8a0010; }
[data-theme="horror"] .mark.m-white { background: #EADBD3; color: #2a0b0e; border-color: #8f6f68; }
[data-theme="horror"] .mark.m-black { background: #000; color: #FF3048; }
[data-theme="horror"] .conn.on { background: #1d2a1f; color: #9fd8ae; }
[data-theme="horror"] .conn.off { background: #3d0a10; color: #FF6B7A; }
[data-theme="horror"] .day-pill { background: #F3EEE6; color: #8a0010; box-shadow: 0 0 10px rgba(195,0,31,.5); }
@keyframes horror-flicker {
  0%, 100% { opacity: 1; } 41% { opacity: 1; } 42% { opacity: .35; } 43% { opacity: 1; }
  44% { opacity: .2; } 46% { opacity: 1; } 78% { opacity: 1; } 79% { opacity: .5; } 80% { opacity: 1; }
}
@keyframes horror-shake {
  0% { transform: translate(0, -4px) rotate(0); } 25% { transform: translate(-2px, -5px) rotate(-1.2deg); }
  50% { transform: translate(2px, -3px) rotate(1deg); } 75% { transform: translate(-1px, -5px) rotate(-.6deg); }
  100% { transform: translate(0, -4px) rotate(0); }
}
[data-theme="horror"] .card.has-marks.facedown .art { animation: none; }   /* history marks stay readable */
[data-theme="horror"] .fan-card { border-color: #D9CFC0; }
[data-theme="horror"] .fan-card.c1, [data-theme="horror"] .fan-card.c2, [data-theme="horror"] .fan-card.c4 {
  background: url("../img/horror-splat.svg") 70% 80% / 70% no-repeat, linear-gradient(180deg, #EFE8DC, #D9CFC0); border-color: #D9CFC0;
}
[data-theme="horror"] .fan-card.c5 { background: url("../img/horror-splat.svg") center / 95% no-repeat, #EFE8DC; border-color: #8a0010; }
[data-theme="horror"] .modal { background: rgba(20, 0, 3, .6); }
[data-theme="horror"] body { padding-top: 14px; }      /* room for the blood running from the top */
[data-theme="horror"] .menu-btn { color: #1a1414; border: 2px solid #D9CFC0;
  background: url("../img/horror-splat.svg") 97% 14% / 22% no-repeat, linear-gradient(180deg, #F3EEE6, #DDD3C4); }
[data-theme="horror"] .m-create { box-shadow: 0 6px 0 #6b5000; }
[data-theme="horror"] .m-join { box-shadow: 0 6px 0 #1f5a36; }
[data-theme="horror"] .m-cpu { box-shadow: 0 6px 0 #2d4f7a; }
[data-theme="horror"] .m-rules { box-shadow: 0 6px 0 #7a1a30; }
[data-theme="horror"] .menu-btn:hover { box-shadow: 0 6px 0 #8a0010, 0 0 18px rgba(195,0,31,.45); }

/* narrow 4-column boards (12A猫 / 12B / 17A on phones): marks go BELOW the slot number
   instead of sharing its row, so "→#6○" never covers "#2" */
@media (max-width: 520px) {
  .board[data-ruleset="a17"] .card .marks, .board[data-ruleset="cat12"] .card .marks,
  .board[data-ruleset="b12"] .card .marks { top: 31px; left: 3px; right: 3px; align-items: center; align-content: center; max-height: calc(100% - 60px); }
}

/* ===================================================================== appeal: 2人で遊べる */
.duo-badge { display: inline-block; margin: 2px 0 0; padding: 5px 16px; border-radius: 99px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000);
  font-size: clamp(.95rem, 3.4vw, 1.15rem); letter-spacing: .04em; }
.duo-badge b { font-size: 1.15em; }
.selling-points { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; padding: 0; margin: 10px 0 0; }
.selling-points li { background: var(--surface); border: 2px solid var(--line); border-radius: 99px; padding: 3px 12px; font-size: .85rem; color: var(--ink); }

/* ===================================================================== lobby (公開中の村) */
.lobby { width: min(760px, 100%); background: var(--surface); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lobby-head h2 { margin: 0; font-size: 1.15rem; }
.lobby-filter { font-size: .85rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.lobby-note { margin: 4px 0 10px; font-size: .85rem; }
.lobby-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lobby-empty { padding: 16px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.lobby-card { border: 3px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); display: grid; gap: 6px; }
.lobby-card.open { border-color: var(--ok); }
.lobby-card.finished { opacity: .7; }
.lobby-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.lobby-rule { font-size: 1.05rem; }
.room-code { margin-left: auto; font-size: .8rem; }
.status-badge { font-size: .75rem; font-weight: 800; border-radius: 99px; padding: 2px 10px; color: #fff; }
.status-badge.open { background: var(--ok); }
.status-badge.playing { background: var(--accent-2); }
.status-badge.finished { background: var(--muted); }
.time-tag { font-size: .8rem; font-weight: 700; }
.lobby-lineup { font-size: .85rem; color: var(--muted); font-weight: 700; }
.lobby-comment { font-size: .9rem; }
.lobby-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lobby-seat { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius-sm); padding: 6px 8px; border: 2px solid var(--line); min-width: 0; }
.lobby-seat .side-tag { font-size: .75rem; font-weight: 800; color: var(--muted); width: 100%; }
.lobby-seat.seat-A { border-color: color-mix(in srgb, var(--village) 45%, var(--line)); }
.lobby-seat.seat-B { border-color: color-mix(in srgb, var(--wolf) 45%, var(--line)); }
.seat-free { color: var(--ok); font-weight: 800; }
.lobby-seat .btn { margin-left: auto; }
.btn-village { background: var(--village); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--village) 60%, #000); }
.btn-wolf { background: var(--wolf); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--wolf) 60%, #000); }
.lobby-actions { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; }
@media (max-width: 520px) { .lobby-seats { grid-template-columns: 1fr; } .room-code { margin-left: 0; } }

/* ===================================================================== room creation options */
.lineup-editor { margin: 8px 0 4px; padding: 10px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); }
.lineup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 12px; }
.lineup-row { display: grid; grid-template-columns: 1fr auto 2ch auto; align-items: center; gap: 6px; }
.lineup-row .btn { padding: 2px 10px; }
.lineup-name { font-weight: 800; font-size: .9rem; }
.lineup-row.side-wolf .lineup-name { color: var(--wolf); }
.lineup-count { text-align: center; font-size: 1.05rem; }
.lineup-summary { margin: 8px 0 0; font-weight: 800; font-size: .88rem; }
.lineup-summary.bad, .lineup-error { color: var(--danger); }
.check-row { display: flex; gap: 6px; align-items: flex-start; font-size: .85rem; margin: 8px 0; }
.time-row { display: flex; gap: 14px; flex-wrap: wrap; }
.time-row label { font-weight: 800; font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.small-note { font-size: .8rem; margin: 4px 0; }

/* ===================================================================== chat */
.chat-log { list-style: none; margin: 0 0 8px; padding: 0; max-height: 180px; overflow-y: auto; font-size: .88rem; }
.chat-log li { padding: 3px 0; word-break: break-word; }
.chat-log li.mine .chat-text { font-weight: 700; }
.chat-tag { display: inline-block; font-size: .68rem; font-weight: 800; border-radius: 6px; padding: 0 5px; margin-right: 4px; color: #fff; }
.chat-tag.village { background: var(--village); }
.chat-tag.wolf { background: var(--wolf); }
.chat-tag.watch { background: var(--muted); }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; min-width: 0; padding: 7px 12px; }

/* ===================================================================== clocks */
.clocks { display: inline-flex; gap: 6px; }
.clock { font-family: var(--font-logo); font-weight: 700; font-size: .85rem; border-radius: 99px; padding: 3px 10px;
  background: var(--surface-2); border: 2px solid var(--line); color: var(--muted); white-space: nowrap;
  /* fixed width: the digits change every second, and a width that changes made the bar wrap on and off */
  display: inline-block; min-width: 5.6em; text-align: center; font-variant-numeric: tabular-nums; }
.clocks.byo .clock { min-width: 8em; }
.clock.running { color: var(--ink); border-color: var(--accent); background: var(--surface); }
.clock.low { color: #fff; background: var(--danger); border-color: var(--danger); animation: blink 1s infinite; }

/* ===================================================================== 合言葉 / village list in the join sheet */
.pass-row { display: flex; gap: 8px; }
.pass-row input { flex: 1; min-width: 0; }
#modal-join .lobby { width: 100%; box-shadow: none; padding: 0; background: transparent; margin-top: 8px; }
#modal-join .lobby-list { max-height: min(52vh, 520px); overflow-y: auto; padding-right: 2px; }
.lock-tag { font-size: .75rem; font-weight: 800; border-radius: 99px; padding: 2px 8px; background: var(--surface); border: 2px solid var(--line); }
.here-tag { font-size: .75rem; font-weight: 800; border-radius: 99px; padding: 2px 8px; background: var(--accent); color: var(--accent-ink); }
.by-id { margin-top: 12px; }
.by-id summary { cursor: pointer; font-weight: 800; color: var(--muted); font-size: .9rem; }
.by-id .form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.by-id input { flex: 1; min-width: 140px; }
.pass-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; padding: 10px 14px;
  border-radius: var(--radius); background: var(--surface-2); border: 3px dashed var(--accent); }
.pass-word { font-size: 1.6rem; letter-spacing: .06em; }

/* ===================================================================== theme: 夜桜 (sakura) */
[data-theme="sakura"] body::before {           /* petals drifting over the night */
  content: ""; position: fixed; inset: -300px 0 0 0; z-index: 0; pointer-events: none; opacity: .55;
  background: url("../img/petals.svg") 0 0 / 300px 300px repeat; animation: sakura-fall 28s linear infinite;
}
[data-theme="sakura"] .screen { position: relative; z-index: 1; }
@keyframes sakura-fall { from { transform: translate(0, 0); } to { transform: translate(-60px, 300px); } }
[data-theme="sakura"] .card { border-color: #E8C27A; }
[data-theme="sakura"] .card:not(.facedown) .ident, [data-theme="sakura"] .card:not(.facedown) .art { color: #3b2a3a; }
[data-theme="sakura"] .card.facedown .art { color: #FBEFF4; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
[data-theme="sakura"] .card .num { background: #FBF4E6; color: #3b2a3a; }
[data-theme="sakura"] .logo-jp { color: #FBEFF4; }
[data-theme="sakura"] .menu-btn { color: #2a1a2a; }

/* ===================================================================== account & shop */
.account-btn { width: auto; border-radius: 99px; padding: 0 14px; font-size: .9rem; font-weight: 800; }
.price-tag { margin-left: auto; font-size: .8rem; font-weight: 800; border-radius: 99px; padding: 2px 10px;
  background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.price-tag.owned { background: var(--ok); color: #fff; }
.theme-opt.locked { opacity: .85; }
.tabs { display: flex; gap: 6px; margin: 6px 0 12px; }
.tabs .btn.on { background: var(--accent); color: var(--accent-ink); }
.account-form { display: grid; gap: 10px; }
.account-form input { width: 100%; }
.test-banner { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border: 2px dashed var(--accent);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: .85rem; font-weight: 700; }
.owned-list { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.owned-list li { border: 2px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: .85rem; }
.shop-preview { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.shop-preview .sw i { width: 46px; height: 64px; }

/* ===================================================================== PWA (installed app) */
.install-box { display: grid; gap: 6px; }
html.standalone body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
html.standalone .screen { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.price-tag.soon { background: var(--muted); color: #fff; }

/* ===================================================================== village list page */
.lobby-screen { max-width: 820px; padding-top: 12px; }
.lobby-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.lobby-h1 { margin: 0; font-size: 1.3rem; }
.lobby-screen .lobby { width: 100%; }
.pass-inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px; border-radius: var(--radius-sm);
  border: 2px dashed var(--accent); background: var(--surface); }
.pass-inline input { flex: 1; min-width: 120px; padding: 6px 10px; }
.by-id .form-row { align-items: center; }
/* chat header with the report button, report reasons */
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.reason-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: .9rem; }
.reason-pick label { display: flex; gap: 6px; align-items: center; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
#modal-feedback textarea, #modal-report textarea { font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; resize: vertical; }
.chat-form input:disabled { opacity: .6; }

/* ===================================================================== 今日の盤面 */
.daily-banner { width: min(560px, 100%); display: flex; align-items: center; gap: 10px; justify-content: space-between;
  border: 3px dashed var(--accent); background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 10px 16px;
  font-weight: 800; box-shadow: 0 4px 0 var(--line); }
.daily-banner b { font-size: .85rem; color: var(--muted); }
.daily-banner .daily-go { color: var(--accent); font-size: 1.2rem; }
.daily-banner:hover { transform: translateY(-2px); }
.puzzle-screen { max-width: 1180px; padding-top: 12px; }
.pz-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 880px) { .pz-layout { grid-template-columns: minmax(0, 1fr); } }
.pz-layout > * { min-width: 0; }
.pz-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pz-diff { font-weight: 800; font-size: .8rem; border-radius: 99px; padding: 3px 12px; color: #fff; }
.pz-diff.d-easy { background: var(--ok); } .pz-diff.d-normal { background: var(--accent-2); } .pz-diff.d-hard { background: var(--danger); }
.pz-question { font-weight: 800; font-size: 1.05rem; margin: 6px 0 12px; }
.streak-chip { font-weight: 800; background: var(--surface); border: 2px solid var(--line); border-radius: 99px; padding: 3px 12px; }
.pz-tries { font-size: 1.2rem; }
.pz-hints { margin: 8px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: .9rem; }
.pz-hints li { background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 10px; }
.pz-result { margin-top: 10px; }
.pz-facts { padding-left: 1.4em; display: grid; gap: 4px; }
.card.pz-answer { outline: 4px solid var(--ok); outline-offset: 2px; }
#pz-log { max-height: none; }   /* the whole log is the puzzle statement */

/* ---- detailed rules for custom lineups (詳細ルール) ---- */
.rules-adv { margin-top: 10px; border-top: 2px dashed var(--line); padding-top: 8px; }
.rules-adv > summary { cursor: pointer; font-weight: 800; font-size: .9rem; color: var(--muted); }
.rules-adv[open] > summary { color: var(--ink); margin-bottom: 6px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rule-name { font-weight: 800; font-size: .9rem; }
.rule-opts { display: flex; gap: 4px; }
.rule-opts .btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rule-help { margin: 2px 0 0; font-size: .78rem; }

/* ---- 戦績・実績 (records) ---- */
.records-banner { margin-top: 8px; border-style: solid; border-color: var(--line); }
.rec-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.rec-games-panel { grid-column: 1 / -1; }
@media (max-width: 880px) { .rec-layout { grid-template-columns: 1fr; } }
.rec-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.rec-tile { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 2px solid var(--line);
  border-radius: 12px; padding: 8px 10px; }
.rec-tile small { color: var(--muted); font-weight: 700; font-size: .75rem; }
.rec-tile b { font-size: 1.35rem; }
.rec-tile span { font-size: .75rem; }
.rec-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.rec-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.rec-table caption { text-align: left; font-weight: 800; padding: 4px 0; }
.rec-table th, .rec-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.rec-table th:first-child, .rec-table td:first-child { text-align: left; }
.title-row { align-items: center; gap: 8px; }
.title-row select { flex: 1; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.ach-grid { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; }
.ach { display: flex; flex-direction: column; gap: 2px; border: 2px dashed var(--line); border-radius: 12px; padding: 6px 10px; opacity: .6; }
.ach.got { border-style: solid; border-color: var(--accent); opacity: 1; background: var(--surface-2); }
.ach small { font-size: .74rem; }
.rec-games { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow: auto; }
.rec-game { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 8px;
  border: 2px solid var(--line); border-radius: 12px; }
.rec-res { width: 2em; height: 2em; display: grid; place-items: center; border-radius: 50%; font-weight: 900; color: #fff; background: var(--muted); }
.rec-game.win .rec-res { background: var(--accent); }
.chat-title { color: var(--accent); font-weight: 800; margin-right: 2px; }

/* ---- 感想戦 (review) ---- */
.rv-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 6px 0; }
.rv-steps { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; }
.rv-chip { white-space: nowrap; }
.rv-chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rv-toggle { justify-content: center; margin-bottom: 8px; }
.mark.rv-p { background: var(--surface-2); color: var(--ink); }
.mark.rv-p.sure { background: var(--wolf); color: #fff; }
.mark.rv-p.zero { opacity: .55; }
.rv-hidden { color: var(--muted); font-style: italic; }
.rv-facts { margin: 6px 0; padding-left: 1.2em; }
.btn-review { border-color: var(--accent); }
.panel-head .btn, .lobby-bar .btn { white-space: nowrap; }
.chip.rv-result { font-weight: 800; }
.chip.rv-result.win { background: var(--accent); color: #fff; }

/* ---- 🔰 チュートリアル ---- */
.tutorial-banner { border-style: solid; border-color: var(--village); }
.tutorial-banner.first-visit { animation: tut-pulse 1.6s ease-in-out infinite; }
@keyframes tut-pulse { 0%, 100% { box-shadow: 0 4px 0 var(--line); } 50% { box-shadow: 0 0 0 6px var(--village-soft), 0 4px 0 var(--line); } }
.tutorial-coach { border: 3px solid var(--village); background: var(--village-soft); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.tutorial-coach p { margin: 6px 0; font-size: .9rem; line-height: 1.6; }
.tc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tc-badge { background: var(--village); color: #fff; font-weight: 800; font-size: .75rem; border-radius: 99px; padding: 2px 8px; }
.tc-ops { background: var(--surface); border-radius: 10px; padding: 6px 10px; margin-top: 6px; font-size: .9rem; }
.tc-ops ol { margin: 4px 0 0; padding-left: 1.4em; }
.tc-tip { font-weight: 700; }
.tut-glow { animation: tut-glow 1.2s ease-in-out infinite; position: relative; z-index: 1; }
@keyframes tut-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(90, 169, 230, .0); } 50% { box-shadow: 0 0 0 5px rgba(90, 169, 230, .65); } }
@media (prefers-reduced-motion: reduce) { .tut-glow, .tutorial-banner.first-visit { animation: none; outline: 3px solid var(--village); } }

/* ---- rules: basics first, details behind 続きを見る ---- */
.rules-tutorial { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--village-soft); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; font-weight: 700; font-size: .9rem; }
.rules-more { margin-top: 12px; border-top: 2px dashed var(--line); padding-top: 8px; }
.rules-more > summary { cursor: pointer; font-weight: 800; color: var(--accent); padding: 8px 0; list-style-position: inside; }
.rules-more[open] > summary { margin-bottom: 4px; }

/* ---- マイページ ---- */
.mp-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.mp-layout .mp-profile, .mp-layout .mp-wide { grid-column: 1 / -1; }
@media (max-width: 880px) { .mp-layout { grid-template-columns: 1fr; } }
.mp-profile { padding: 0; overflow: hidden; }
.mp-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 18px;
  background: var(--card-back); background-size: cover; isolation: isolate; }
.mp-card::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 92%, transparent) 0%, color-mix(in srgb, var(--surface) 70%, transparent) 100%); }
@media (max-width: 600px) { .mp-card { grid-template-columns: auto 1fr; } .mp-pins { grid-column: 1 / -1; } }
.mp-avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 900;
  background: var(--accent); color: #fff; border: 3px solid var(--card-back-ring); box-shadow: 0 4px 0 var(--line); }
.mp-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mp-name { font-size: 1.35rem; overflow: hidden; text-overflow: ellipsis; }
.mp-title { color: var(--accent); font-weight: 800; font-size: .9rem; }
.mp-pins { display: flex; gap: 8px; }
.mp-pin { width: 84px; min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 14px; background: var(--surface); border: 2px solid var(--accent); text-align: center; padding: 4px; }
.mp-pin span { font-size: 1.5rem; }
.mp-pin small { font-size: .72rem; font-weight: 800; line-height: 1.2; }
.mp-pin.empty { border-style: dashed; border-color: var(--line); opacity: .7; }
.mp-rank-row { display: flex; align-items: center; gap: 10px; }
.mp-rank-lv { background: var(--village); color: #fff; font-weight: 900; border-radius: 99px; padding: 2px 10px; font-size: .8rem; }
.mp-rank-title { font-size: 1.3rem; }
.mp-total { margin: 6px 0; } .mp-total b { font-size: 2rem; }
.mp-bar { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 4px 0; }
.mp-bar i { display: block; height: 100%; background: var(--village); border-radius: 99px; }
.mp-comp-tag { margin-left: 6px; font-size: .7rem; font-weight: 800; color: #fff; background: var(--accent); border-radius: 99px; padding: 0 6px; }
.ach.got { cursor: pointer; }
.ach.pinned { box-shadow: 0 0 0 3px var(--accent) inset; }
/* 🔰 the card the tutorial recommends: a pulsing blue ring + a "tap here" tag */
#board .card.tut-glow-card { z-index: 3; outline: 5px solid #3D8FD6; outline-offset: 3px; border-color: #FFFFFF;
  animation: tut-card 1s ease-in-out infinite; }
#board .card.tut-glow-card::after { content: "👆 ここ"; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: #3D8FD6; color: #fff; font-weight: 900; font-size: .85rem; padding: 3px 10px; border-radius: 99px;
  box-shadow: 0 2px 0 rgba(0,0,0,.2); white-space: nowrap; pointer-events: none; }
@keyframes tut-card {
  0%, 100% { outline-color: #3D8FD6; box-shadow: 0 0 0 0 rgba(61, 143, 214, .0), 0 5px 0 var(--line); transform: translateY(0); }
  50% { outline-color: #8CC4F2; box-shadow: 0 0 26px 10px rgba(61, 143, 214, .75), 0 5px 0 var(--line); transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { #board .card.tut-glow-card { animation: none; } }

/* ---- 🗓️ puzzle calendar ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-w { text-align: center; font-size: .72rem; font-weight: 800; color: var(--muted); }
.cal-cell { aspect-ratio: 1 / 1; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; font: inherit; cursor: pointer; min-width: 0; }
.cal-cell.blank { border: 0; background: transparent; cursor: default; }
.cal-cell.off { opacity: .35; cursor: default; }
.cal-cell.ok { background: #DDF6E6; border-color: #3BB273; }
.cal-cell.ng { background: var(--wolf-soft); border-color: var(--wolf); }
.cal-cell.today { box-shadow: 0 0 0 2px var(--accent) inset; }
.cal-cell.current { outline: 3px solid var(--village); outline-offset: 1px; }
.cal-day { font-size: .8rem; font-weight: 800; line-height: 1; }
.cal-mark { font-size: .85rem; line-height: 1.1; min-height: 1em; }
[data-theme="midnight"] .cal-cell.ok, [data-theme="sakura"] .cal-cell.ok, [data-theme="horror"] .cal-cell.ok { background: #1f4a33; }
.pz-archive-more { margin-top: 8px; } .pz-archive-more summary { cursor: pointer; color: var(--muted); font-size: .85rem; }

/* ---- 🎯 指名CO ---- */
.nominate-box { margin: 8px 0; padding: 8px 10px; border: 2px dashed var(--line); border-radius: 12px; }
.nominate-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.nominate-row select { padding: 4px 8px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.nominate-row .buttons { margin: 0; }
.nominate-box .hint { margin: 6px 0 0; font-size: .78rem; }

/* ---- top-left name chip (opens マイページ) & avatars ---- */
.title-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.me-chip { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 22px; padding: 6px 12px 6px 6px; cursor: pointer; box-shadow: 0 3px 0 var(--line); font: inherit; max-width: 560px; min-width: 0; }
.me-chip:hover { transform: translateY(-1px); }
.me-avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent);
  color: #fff; font-weight: 900; font-size: 1.05rem; }
.me-avatar.emoji, .mp-avatar.emoji { background: var(--surface-2); font-size: 1.3rem; }
.mp-avatar.emoji { font-size: 2rem; }
.me-text { display: flex; flex-direction: column; gap: 3px; line-height: 1.2; text-align: left; min-width: 0; flex: 1; }
.me-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.me-text b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.me-title { min-width: 0; overflow: hidden; }
.me-title .bdg-chip { font-size: .7rem; }
.me-text small { font-size: .74rem; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-lvrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.me-lvrow.hidden { display: none; }
.me-lvrow small { flex: none; font-size: .68rem; }
.me-lv { display: block; flex: 1; min-width: 40px; height: 5px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; max-width: 220px; }
.me-lv i { display: block; height: 100%; background: var(--village); border-radius: 99px; }
.me-pins { display: flex; gap: 4px; flex: none; }
.me-pin { width: 32px; height: 32px; display: grid; place-items: center; }
.me-pin.empty { border: 1.5px dashed var(--line); border-radius: 50%; width: 26px; height: 26px; margin: 3px; }
.title-top { flex-wrap: wrap; gap: 8px; }
.title-left { flex: 1 1 auto; }
@media (max-width: 640px) {      /* phones: the card gets its own full-width row under the icons */
  .title-left { order: 2; flex-basis: 100%; }
  .me-chip { width: 100%; max-width: none; }
  .top-icons { margin-left: auto; }
  .title-left .conn { display: none; }
}
button.mp-avatar { cursor: pointer; padding: 0; font-family: inherit; }
.mp-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mp-avatar-picker { padding: 10px 18px 16px; }
.mp-avatar-picker p { margin: 0 0 8px; font-weight: 700; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.avatar-opt { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-size: 1.4rem; cursor: pointer; }
.avatar-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
.avatar-opt.initial { font-size: 1rem; font-weight: 900; background: var(--accent); color: #fff; }
.mp-comp-block + .mp-comp-block { margin-top: 10px; }
.mp-comp-block h3 { margin: 4px 0 6px; }

/* ---- 実績: normal (🏅 medal) / rare (🏆 gold trophy) / secret (💎 violet gem) ---- */
.ach-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.ach-count { font-size: .78rem; font-weight: 800; border-radius: 99px; padding: 2px 10px; border: 2px solid var(--line); }
.ach-count.rare { border-color: #E3B341; background: #FFF6D6; color: #7A5600; }
.ach-count.secret { border-color: #9B6BE0; background: #F1E8FF; color: #4B2A80; }
.ach { position: relative; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; }
.ach > .ach-icon { grid-row: 1 / span 3; width: 34px; height: 34px; display: grid; place-items: center; font-size: 1.15rem;
  border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); }
.ach > b, .ach > small { grid-column: 2; }
.ach.got > .ach-icon { border-color: var(--accent); background: var(--surface); }
/* rare: a gold card with a trophy in a shield-shaped plate and a slow shine */
.ach.tier-rare { border-color: #E9CF7A; }
.ach.tier-rare > .ach-icon { border-radius: 8px 8px 50% 50%; }
.ach.tier-rare.got { border: 2px solid #D4A72C; background: linear-gradient(135deg, #FFF8DC 0%, #FFE7A3 45%, #FFF8DC 60%, #FFE08A 100%);
  background-size: 250% 250%; animation: ach-shine 6s ease-in-out infinite; color: #4A3500; box-shadow: 0 3px 0 #D4A72C; }
.ach.tier-rare.got > .ach-icon { background: linear-gradient(180deg, #FFE38A, #E3B341); border-color: #B58A12; }
.ach.tier-rare.got small { color: #6B5100; }
@keyframes ach-shine { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
/* secret: a violet card with a gem in a diamond */
.ach.tier-secret { border-color: #CDB7F2; }
.ach.tier-secret > .ach-icon { border-radius: 6px; transform: rotate(45deg); }
.ach.tier-secret > .ach-icon { font-size: 1rem; }
.ach.tier-secret.got { border: 2px solid #8A5CD6; background: linear-gradient(135deg, #2E1D52, #5B3A9A); color: #F4ECFF; box-shadow: 0 3px 0 #4B2A80; }
.ach.tier-secret.got small { color: #D9C9FF; }
.ach.tier-secret.got > .ach-icon { background: linear-gradient(135deg, #C9A8FF, #7E4FD0); border-color: #E6D6FF; }
.ach.tier-secret:not(.got) b { letter-spacing: .2em; }
.mp-pin.tier-rare { border-color: #D4A72C; background: linear-gradient(180deg, #FFF6D6, #FFE08A); color: #4A3500; border-radius: 14px 14px 40% 40%; }
.mp-pin.tier-secret { border-color: #8A5CD6; background: linear-gradient(135deg, #2E1D52, #5B3A9A); color: #F4ECFF; }
@media (prefers-reduced-motion: reduce) { .ach.tier-rare.got { animation: none; } }

.sw-ocean i:first-child { background: repeating-linear-gradient(170deg, #12507A 0 6px, #0F4468 6px 12px); border-color: #3BA7C4; }
.sw-ocean i:last-child { background: linear-gradient(180deg, #164A6B, #103B57); border-color: #3BA7C4; }
.sw-gold i:first-child { background: repeating-conic-gradient(#C99A2E 0 15deg, #A87C1F 15deg 30deg); border-color: #F2C14E; }
.sw-gold i:last-child { background: linear-gradient(180deg, #3A2E15, #2C2310); border-color: #F2C14E; }
.level-tag { font-size: .7rem; font-weight: 800; border-radius: 99px; padding: 1px 8px; background: var(--village-soft); color: var(--ink); }
.theme-opt.locked .level-tag::before { content: "🔒 "; }
/* ---- level rewards ---- */
.mp-reward-h { margin: 12px 0 4px; }
.mp-rewards { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mp-rewards li { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 10px;
  border: 2px dashed var(--line); font-size: .85rem; opacity: .7; }
.mp-rewards li.got { border-style: solid; border-color: var(--village); opacity: 1; }
.mp-reward-lv { font-weight: 900; color: var(--village); }
.mp-reward-state { font-size: .8rem; font-weight: 800; }
.avatar-opt { position: relative; }
.avatar-opt.locked { opacity: .45; filter: grayscale(.6); }
.avatar-lock { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); font-size: .6rem; font-weight: 900;
  background: var(--ink); color: var(--surface); border-radius: 99px; padding: 0 4px; filter: none; }
.mp-locked { border: 2px dashed var(--line); border-radius: 12px; padding: 12px; text-align: center; background: var(--surface-2); }
.mp-locked p { margin: 4px 0 8px; font-weight: 800; }
.mp-locked .small-note { font-weight: 500; }
.badge.nominate-badge { background: var(--surface-2); border: 2px solid var(--line); }

/* ---- 🎴 配役 panel in the game screen ---- */
.lineup-pop { position: relative; display: inline-flex; }
.lineup-btn { white-space: nowrap; }
.lineup-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: min(360px, calc(100vw - 32px));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); margin: 0; }
.lineup-panel.hidden, .lineup-panel:empty { display: none; }
.lineup-roles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lineup-role { display: inline-flex; align-items: center; gap: 2px; font-size: .85rem; font-weight: 700; padding: 3px 9px;
  border-radius: 99px; background: var(--village-soft); border: 2px solid transparent; }
.lineup-role b { margin-left: 3px; }
.lineup-role.side-wolf { background: var(--wolf-soft); }
.lineup-role.side-fox { background: #FFE9C7; color: #6B4300; }
.lineup-sides { margin: 6px 0 0; font-size: .8rem; }
.lineup-notes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lineup-notes .chip { font-size: .75rem; cursor: help; }
.nominate-help { margin-top: 4px; }
.nominate-help summary { cursor: pointer; font-size: .78rem; color: var(--muted); font-weight: 700; }
.nominate-help .hint { margin: 4px 0 0; }

/* ---- 🔰 big tutorial button for first-time visitors ---- */
.tutorial-hero { width: min(560px, 100%); display: flex; align-items: center; gap: 12px; margin: 4px 0 10px;
  padding: 14px 16px; border-radius: var(--radius); border: 3px solid var(--village); background: var(--village-soft); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; box-shadow: 0 5px 0 var(--village); animation: tut-pulse 1.8s ease-in-out infinite; }
.tutorial-hero:hover { transform: translateY(-2px); }
.th-icon { font-size: 2rem; }
.th-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.th-text b { font-size: 1.15rem; }
.th-text small { color: var(--muted); font-weight: 700; }
.th-go { background: var(--village); color: #fff; font-weight: 900; border-radius: 99px; padding: 6px 12px; white-space: nowrap; }
.cpu-tutorial-tip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between;
  background: var(--village-soft); border-radius: 12px; padding: 8px 12px; margin: 6px 0; font-weight: 700; font-size: .88rem; }
@media (prefers-reduced-motion: reduce) { .tutorial-hero { animation: none; } }

/* ---- 🏆 ランク戦 ---- */
.ranked-banner { border-style: solid; border-color: #D4A72C; }
.rk-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 880px) { .rk-layout { grid-template-columns: 1fr; } }
.rk-season { font-size: .95rem; }
.rk-season-name { background: #D4A72C; color: #fff; font-weight: 900; border-radius: 99px; padding: 2px 10px; }
.rk-me { text-align: center; margin: 14px 0 8px; }
.rk-tier-big { font-size: 1.6rem; font-weight: 900; }
.rk-tier-big small { font-size: .9rem; color: var(--muted); }
.rk-rating-big { font-size: 2.4rem; font-weight: 900; color: var(--accent); line-height: 1.1; }
.rk-action { margin: 10px 0; text-align: center; }
.rk-go { font-size: 1.1rem; padding: 14px; }
.rk-reason { font-weight: 800; }
.rk-waiting { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rk-spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: rk-spin 1s linear infinite; }
@keyframes rk-spin { to { transform: rotate(360deg); } }
.rk-rules summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.rk-rules ul { font-size: .85rem; padding-left: 1.2em; }
.rk-board { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; max-height: 560px; overflow: auto; }
.rk-rank { font-weight: 900; text-align: center; }
.rk-tier { font-size: .78rem; font-weight: 800; color: var(--village); }
.rk-rating { font-weight: 900; }
.rk-result { margin: 6px 0; font-size: 1.05rem; }


/* ---- 🏆 ranked card on the home screen (above the menu) ---- */
.ranked-hero { width: min(560px, 100%); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 0 0 12px;
  padding: 12px 16px; border-radius: var(--radius); border: 3px solid #D4A72C; color: #4A3500; font: inherit; text-align: left; cursor: pointer;
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE7A3 45%, #FFF8DC 60%, #FFE08A 100%); background-size: 250% 250%;
  animation: ach-shine 7s ease-in-out infinite; box-shadow: 0 5px 0 #B58A12; }
.ranked-hero:hover { transform: translateY(-2px); }
.rh-icon { font-size: 2rem; }
.rh-text { display: flex; flex-direction: column; min-width: 0; }
.rh-text b { font-size: 1.15rem; }
.rh-text small { font-weight: 700; color: #6B5100; font-size: .78rem; }
.rh-me { display: flex; flex-direction: column; align-items: flex-end; background: #fff8; border-radius: 12px; padding: 4px 10px; }
.rh-me b { font-size: .95rem; } .rh-me small { font-size: .72rem; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .ranked-hero { animation: none; } }
.rk-past { margin-top: 10px; text-align: left; font-size: .85rem; }
.rk-past ul { margin: 4px 0 0; padding-left: 1.2em; }
.rk-title-chip { display: inline-block; margin: 2px 4px 0 0; font-size: .75rem; font-weight: 800; border-radius: 99px; padding: 1px 8px;
  background: linear-gradient(180deg, #FFF6D6, #FFE08A); color: #4A3500; border: 1px solid #D4A72C; }
.weights { margin: -2px 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--village-soft); font-size: .9rem; }
.weights-toggle { cursor: pointer; font-weight: 600; }
.weights-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 6px; }
.weight input { width: 4.2em; padding: 3px 4px; }
.weights-sum { font-weight: 700; }
.weights-sum.bad { color: #c0392b; }
@media (max-width: 720px) {
  .lineup-pop { position: static; }
  .lineup-panel { position: fixed; top: 72px; left: 16px; right: 16px; width: auto; max-height: calc(100vh - 96px); overflow: auto; }
}
/* 📢 お知らせ */
.news-btn { position: relative; }
.news-dot { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: #FF4D6D; box-shadow: 0 0 0 2px var(--surface); }
.news-dot.hidden, .news-banner.hidden { display: none; }
.news-banner { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 0; padding: 10px 14px; border: 2px solid #FFB3C1;
  border-radius: var(--radius); background: #FFF0F3; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.news-banner b { flex: 1; font-size: .9rem; }
.nb-tag { font-size: .7rem; font-weight: 800; color: #fff; background: #FF4D6D; border-radius: 999px; padding: 2px 8px; }
.news-list { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow: auto; }
.news-item { border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--surface-2); }
.news-item.latest { border-color: var(--accent); }
.news-item h3, .news-item summary { margin: 0; font-size: 1rem; cursor: default; }
.news-item summary { cursor: pointer; font-weight: 800; }
.news-date { color: var(--muted); font-weight: 700; margin-right: 4px; }
.news-item h4 { margin: 10px 0 4px; font-size: .92rem; }
.news-item ul { margin: 0; padding-left: 1.2em; font-size: .88rem; line-height: 1.6; }
.news-title { padding-right: 44px; }
.rk-live { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rk-live li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rk-live li.muted { border: none; background: none; padding: 0; }
.rk-live-who { font-weight: 700; }
.lobby-ranked { margin-top: 16px; }
.lobby-ranked .sub { margin: 0 0 4px; font-size: 1rem; }
.rk-live .btn { margin-left: auto; }
.field.pair .pair-sels { display: inline-flex; gap: 6px; flex-wrap: wrap; } .field.pair select { min-width: 0; }
.field.pair { margin-left: 18px; }

/* かんたん表示 / 詳細表示 */
.view-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.view-pick .btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; white-space: normal; height: auto; padding: 10px 12px; }
.view-pick .btn small { font-weight: 500; font-size: .75rem; opacity: .8; }
.view-pick .btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.view-switch { margin-top: 6px; font-size: .78rem; }
.hint-short .hint-more { display: inline; }
.hint-short .hint-more summary { display: inline; cursor: pointer; color: var(--accent); margin-left: 4px; list-style: none; }
.hint-short .hint-more summary::-webkit-details-marker { display: none; }
.hint-short .hint-more[open] summary { display: none; }
@media (max-width: 520px) { .view-pick { grid-template-columns: 1fr; } }

.mark.m-gj { background: var(--hunter-bg); color: var(--hunter-ink); border: 1px solid var(--hunter-ink); font-weight: 800; }
.mark.m-nogj { background: #F1EEF4; color: #7A6F86; border: 1px dashed #C9BFD3; }

/* 🏆 trophy rating (クラロワ風) */
.trophy { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.18em; filter: drop-shadow(0 2px 0 rgba(0,0,0,.18)); }
.trophy svg { width: 100%; height: 100%; display: block; }
.trophy-score { display: inline-flex; align-items: center; gap: .18em; }
.trophy-num {
  font-family: "Fredoka", var(--font-logo), var(--font); font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(180deg, #FFF3B0 0%, #FFD23F 45%, #F5A400 100%); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-stroke: 1.6px #6B3F00; paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(107,63,0,.25);
}
.trophy-score.big { font-size: 2.6rem; }
.trophy-score.big .trophy-num { -webkit-text-stroke-width: 2.2px; }
.trophy-score.small { font-size: 1rem; }
.trophy-score.small .trophy-num { -webkit-text-stroke-width: 1px; text-shadow: none; }
.rk-rating-big { color: inherit; }
.tier-meter { margin: 8px 0 6px; max-width: 420px; }
.tier-meter.max b { font-family: "Fredoka", var(--font); font-size: 1.1rem; color: #B8860B; }
.tm-labels { display: flex; justify-content: space-between; font-weight: 800; font-size: .8rem; color: var(--muted); margin-bottom: 3px; }
.tm-next { color: #B8860B; }
.tm-bar { position: relative; height: 18px; border-radius: 99px; background: #EFE7F4; border: 2px solid #6B3F00; overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(0,0,0,.08); }
.tm-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #FFE58A, #FFC93C 60%, #F0A000); border-right: 2px solid #6B3F00;
  transition: width .5s ease; }
.tm-bar em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-family: "Fredoka", var(--font);
  font-weight: 700; font-size: .78rem; color: #4A2A00; text-shadow: 0 1px 0 #fff8; }
.tm-floor { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; }
.rk-sides { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rk-sides li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px; border-radius: 12px; background: rgba(0,0,0,.04); }
.rk-side-rate { display: inline-flex; align-items: center; gap: 6px; }
#rk-pill { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 14px; border-radius: 99px; background: #3A2E4D; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  font-size: .85rem; font-weight: 700; max-width: calc(100vw - 32px); white-space: nowrap; }
#rk-pill.hidden { display: none; }
#rk-pill .btn { padding: 2px 10px; font-size: .78rem; }
#rk-pill #rk-pill-stop { color: #fff; border-color: rgba(255,255,255,.55); background: transparent; }
body.has-rk-pill { padding-bottom: 64px; }
#rk-pill-time { font-family: "Fredoka", var(--font); }
.rk-res-line { display: inline-flex; align-items: center; gap: 10px; font-size: 1.6rem; }
.rk-delta { font-family: "Fredoka", var(--font); font-weight: 700; font-size: 1.1rem; padding: 0 8px; border-radius: 99px; }
.rk-delta.up { color: #1E8E3E; background: #E3F7E8; } .rk-delta.down { color: #C0392B; background: #FDE7E4; }
.rk-tierup { font-family: "Fredoka", var(--font); font-weight: 700; color: #B8860B; font-size: 1.05rem; margin-top: 4px; }
.rk-note { display: block; color: var(--muted); font-size: .75rem; }

.rk-me .tier-meter, #rk-me .tier-meter { margin-left: auto; margin-right: auto; }

/* ---- 📊 順位表 ---- */
.rk-board-panel { grid-column: 1 / -1; }
.rk-board { max-height: none; overflow: visible; display: block; max-width: 880px; margin: 0 auto; }
.emblem { display: inline-block; width: 36px; height: 36px; flex: none; filter: drop-shadow(0 2px 0 rgba(0,0,0,.15)); }
.emblem svg { width: 100%; height: 100%; display: block; }
.lb-podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin: 22px 0 14px; }
.lb-pod { position: relative; text-align: center; border-radius: 16px 16px 6px 6px; padding: 12px 6px 10px; color: #3E3550; min-width: 0; }
.lb-pod.p1 { background: linear-gradient(180deg, #FFF5CF, #FFE38A); padding-top: 18px; }
.lb-pod.p2 { background: linear-gradient(180deg, #F4F5F8, #DADDE6); }
.lb-pod.p3 { background: linear-gradient(180deg, #FCEBDD, #F2C9A6); }
.lb-pod.me { box-shadow: inset 0 0 0 2px #F2C94C; }
.lb-pod .laurel { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); width: 64px; }
.lb-pod .laurel svg { width: 100%; display: block; }
.lb-place { font-family: "Fredoka", var(--font); font-weight: 700; font-size: 1.5rem; line-height: 1; }
.lb-pod .pod-em { width: 54px; height: 54px; margin: 4px auto; display: block; }
.lb-pod-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; justify-content: center; align-items: center; gap: 4px; }
.lb-pod .trophy-score { font-size: 1.25rem; }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: grid; grid-template-columns: 30px 38px minmax(0, 1fr) 76px minmax(150px, 190px) 74px; grid-template-areas: "rank em name form sides rate";
  align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; }
.lb-rank { grid-area: rank; font-family: "Fredoka", var(--font); font-weight: 700; color: var(--muted); text-align: right; }
.lb-row .lb-em { grid-area: em; }
.lb-name { grid-area: name; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lb-av { width: 24px; height: 24px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.75); font-size: .8rem; font-weight: 800; line-height: 1; }
.lb-av.emoji { background: transparent; font-size: 1.15rem; }
.lb-name .plate, .lb-pod-name { padding-left: 4px; }
.lb-pod-name { white-space: normal; flex-direction: column; gap: 2px; line-height: 1.25; }
.lb-pod-name > span:last-child { min-width: 0; max-width: 100%; word-break: break-all; min-height: 2.5em; display: flex; align-items: center; justify-content: center;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: center; }
.lb-pod .trophy-score { display: flex; justify-content: center; }
.lb-form { grid-area: form; display: flex; gap: 3px; }
.lb-sides { grid-area: sides; display: flex; flex-direction: column; gap: 3px; }
.lb-rate { grid-area: rate; text-align: right; }
.lb-row.me { background: #FFF4D6; box-shadow: inset 0 0 0 2px #F2C94C; color: #3E3550; }
.lb-sep { padding: 6px 8px 0; }
.lb-sep span { display: block; font-size: .72rem; font-weight: 800; color: var(--muted); border-top: 1.5px dashed var(--line); padding-top: 4px; }
.lb-mine { margin-top: 10px; padding-top: 8px; border-top: 1.5px dashed var(--line); }
.lb-mine-note { display: block; text-align: right; margin-top: 2px; }
.plate { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 8px; border-radius: 99px; max-width: 100%; min-width: 0; }
.plate b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate small { font-weight: 700; font-size: .68rem; opacity: .8; white-space: nowrap; }
.plate.t0 { background: #F3ECE4; color: #6A4B2E; }
.plate.t1 { background: #F8E2D2; color: #7A3E16; box-shadow: inset 0 0 0 1.5px #D9925F; }
.plate.t2 { background: #ECEFF5; color: #3E4A60; box-shadow: inset 0 0 0 1.5px #A9B3C6; }
.plate.t3 { background: linear-gradient(90deg, #FFF1C2, #FFE08A); color: #6B4A00; box-shadow: inset 0 0 0 2px #E2B53B; }
.plate.t4 { background: linear-gradient(90deg, #F2F7FF, #DDE8FA); color: #2C3F66; box-shadow: inset 0 0 0 2px #9DB6E0, 0 0 0 2px #fff, 0 0 0 3.5px #C6D6F2; }
.plate.t5 { background: linear-gradient(90deg, #7A1D2E, #B0283F); color: #FFE9A8; box-shadow: inset 0 0 0 2px #E8C25A, 0 0 10px rgba(232,194,90,.6); }
.lb-form i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #6B5F80; box-sizing: border-box; }
.lb-form i.w { background: #6B5F80; }
.lb-form i.d { background: linear-gradient(90deg, #6B5F80 50%, transparent 50%); }
.lb-side { display: grid; grid-template-columns: 16px minmax(30px, 1fr) auto; align-items: center; gap: 6px; font-size: .7rem; font-weight: 800; }
.lb-side .lab { color: #3BA58A; } .lb-side.werewolf .lab { color: #D9534F; }
.lb-side .track { height: 9px; border-radius: 99px; background: rgba(120,100,140,.15); overflow: hidden; }
.lb-side .track b { display: block; height: 100%; border-radius: 99px; background: #3BA58A; }
.lb-side.werewolf .track b { background: #D9534F; }
.lb-side .pct { font-family: "Fredoka", var(--font); font-weight: 700; white-space: nowrap; min-width: 74px; }
.lb-side .pct small { color: var(--muted); font-family: var(--font); font-weight: 700; font-size: .66rem; }
.lb-legend { margin-top: 12px; font-size: .78rem; color: var(--muted); }
.lb-legend summary { cursor: pointer; font-weight: 800; }
.lb-legend p { margin: 6px 0; }
.lb-emblems { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.lb-emblems > span { display: flex; flex-direction: column; align-items: center; width: 64px; font-size: .72rem; }
.lb-emblems .emblem { width: 44px; height: 44px; }
@media (max-width: 640px) {
  .lb-row { grid-template-columns: 26px 34px minmax(0, 1fr) auto; grid-template-areas: "rank em name rate" ". . form form" ". . sides sides"; row-gap: 4px; }
  .lb-pod .trophy-score { font-size: 1rem; }
  .lb-pod .pod-em { width: 44px; height: 44px; }
}
.rk-tier-big { display: flex; align-items: center; gap: 8px; }
.rk-tier-big .me-em { width: 44px; height: 44px; }
.lb-title { display: inline-flex; min-width: 0; max-width: 100%; }
.lb-pod .lb-title { justify-content: center; }
.lb-pod .lb-title .bdg-name { font-size: .78rem; }
.lb-pod .lb-title { margin: 2px 0 4px; }
.lb-row.me .lb-title { color: #B5476B; }
/* 範囲指定 CO要請 / 同時指名 */
.mark.m-gjco { background: #E3F6EA; color: #1F6B45; border: 1px solid #74C69D; }
.mark.m-scope { background: #FFF1C2; color: #6B4A00; border: 1px solid #E2B53B; }
.scope-toggle { margin: 6px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nominate-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.dc-banner { margin: 6px 0; padding: 8px 12px; border-radius: 12px; background: #FFF1C2; color: #6B4A00; font-weight: 800; font-size: .88rem; box-shadow: inset 0 0 0 2px #E2B53B; }
.dc-banner.hidden { display: none; }
.share-box { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.share-row { display: flex; gap: 6px; }
.share-row input { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line); font-size: .8rem; }
.x-link { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px auto 0; width: fit-content; max-width: 100%;
  padding: 7px 16px; border-radius: 999px; background: rgba(255,255,255,.85); border: 2px solid var(--line); color: var(--ink);
  text-decoration: none; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.x-link .x-mark { font-size: 1.05rem; font-weight: 900; }
.x-link small { color: var(--muted); font-size: .72rem; }
@media (max-width: 420px) { .x-link small { display: none; } }
.btn.btn-x { background: #1F1A2B; color: #fff; border-color: #1F1A2B; box-shadow: 0 4px 0 #0E0B16; }

/* ===================================================================== 🎖️ バッジ (achievements as badges) */
.bdg { display: inline-grid; place-items: center; flex: none; line-height: 0; vertical-align: middle; }
.bdg svg { display: block; overflow: visible; }
.bdg-normal .bdg-glyph { filter: saturate(.75); }
.bdg-locked .bdg-glyph { filter: grayscale(1); opacity: .45; }
.bdg-rare svg, .bdg-season svg { filter: drop-shadow(0 1px 1.5px rgba(122, 86, 0, .45)); }
.bdg-sheen { animation: badge-sheen 3.2s ease-in-out infinite; }
@keyframes badge-sheen { 0%, 55% { transform: skewX(-20deg) translateX(0); } 100% { transform: skewX(-20deg) translateX(120px); } }
.bdg-secret svg { filter: drop-shadow(0 0 3px rgba(198, 166, 255, .9)) drop-shadow(0 0 7px rgba(255, 154, 213, .45)); }
.bdg-spark { transform-box: fill-box; transform-origin: center; animation: badge-spark 2.1s ease-in-out infinite; }
@keyframes badge-spark { 0%, 100% { opacity: 0; scale: .3; } 45% { opacity: 1; scale: 1; } }
.bdg-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; vertical-align: middle; }
.bdg-chip .bdg-name { font-size: .72rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdg-chip.tier-normal .bdg-name { color: var(--muted); }
.bdg-chip.tier-rare .bdg-name, .bdg-chip.tier-season .bdg-name {
  background: linear-gradient(90deg, #9C6B00, #E3B341, #9C6B00); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bdg-chip.tier-secret .bdg-name {
  background: linear-gradient(90deg, #C04FA0, #3C8FD8, #8A5CD6, #C04FA0); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: badge-holo 4s linear infinite; }
@keyframes badge-holo { to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .bdg-sheen, .bdg-spark, .bdg-chip .bdg-name { animation: none !important; } }
.bdg-grid { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.bdg-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 14px;
  border: 2px solid transparent; cursor: pointer; text-align: center; }
.bdg-cell small { font-size: .7rem; font-weight: 800; line-height: 1.2; color: var(--muted); }
.bdg-cell.got small { color: var(--ink); }
.bdg-cell:not(.got) { opacity: .75; }
.bdg-cell:hover { background: var(--surface-2); }
.bdg-cell.sel { border-color: var(--accent); background: var(--surface-2); }
.bdg-cell.got.tier-rare, .bdg-cell.got.tier-season { background: linear-gradient(180deg, rgba(255, 236, 160, .45), transparent 70%); }
.bdg-cell.got.tier-secret { background: linear-gradient(180deg, rgba(198, 166, 255, .35), rgba(255, 154, 213, .12) 60%, transparent); }
.bdg-worn { position: absolute; top: 2px; left: 2px; font-style: normal; font-size: .6rem; font-weight: 800; color: #fff; background: var(--accent);
  border-radius: 99px; padding: 1px 6px; }
.bdg-pin { position: absolute; top: 2px; right: 2px; display: inline-flex; align-items: center; gap: 2px; font-style: normal; font-size: .6rem;
  font-weight: 800; color: #fff; background: #4A78C8; border-radius: 99px; padding: 1px 6px 1px 4px; }
.bdg-cell:has(.bdg-pin) { box-shadow: inset 0 0 0 2px rgba(74, 120, 200, .35); }
.bdg-detail { display: flex; gap: 14px; align-items: center; margin-top: 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--line); }
.bdg-detail.hidden { display: none; }
.bdg-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bdg-title { font-size: 1.1rem; }
.bdg-tier { align-self: flex-start; font-size: .7rem; font-weight: 800; border-radius: 99px; padding: 1px 9px; border: 2px solid var(--line); color: var(--muted); }
.bdg-tier.tier-rare, .bdg-tier.tier-season { border-color: #D4A72C; background: #FFF6D6; color: #7A5600; }
.bdg-tier.tier-secret { border-color: #9B6BE0; background: linear-gradient(90deg, #FFE3F4, #E3F6FF, #F1E8FF); color: #4B2A80; }
.bdg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.mp-pin .bdg { margin-bottom: 2px; }
/* badge v2: epic (= the old secret look) and legend */
.bdg-epic svg { filter: drop-shadow(0 0 3px rgba(198, 166, 255, .9)) drop-shadow(0 0 7px rgba(255, 154, 213, .45)); }
.bdg-legend svg { filter: drop-shadow(0 0 4px rgba(255, 210, 90, .95)) drop-shadow(0 0 10px rgba(255, 170, 0, .55)); animation: bdg-pulse 2.4s ease-in-out infinite; }
@keyframes bdg-pulse { 50% { filter: drop-shadow(0 0 6px rgba(255, 230, 140, 1)) drop-shadow(0 0 16px rgba(255, 170, 0, .8)); } }
.bdg-rank4 svg { filter: drop-shadow(0 0 3px rgba(170, 200, 255, .9)); }
.bdg-rank5 svg { filter: drop-shadow(0 0 4px rgba(255, 210, 90, .95)) drop-shadow(0 0 10px rgba(200, 40, 70, .5)); }
.bdg-chip.tier-epic .bdg-name { background: linear-gradient(90deg, #C04FA0, #3C8FD8, #8A5CD6, #C04FA0); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: badge-holo 4s linear infinite; }
.bdg-chip.tier-legend .bdg-name { background: linear-gradient(90deg, #8A5A00, #FFD24A, #FFF6C8, #FFD24A, #8A5A00); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: badge-holo 3s linear infinite; text-shadow: 0 0 6px rgba(255, 200, 60, .35); }
.bdg-tier.tier-epic { border-color: #9B6BE0; background: linear-gradient(90deg, #FFE3F4, #E3F6FF, #F1E8FF); color: #4B2A80; }
.bdg-tier.tier-legend { border-color: #C99700; background: linear-gradient(90deg, #2A1A00, #6B4A00, #2A1A00); color: #FFE38A; }
.ach-count.legend { border-color: #C99700; background: #2A1A00; color: #FFE38A; }
.bdg-cell.got.tier-epic { background: linear-gradient(180deg, rgba(198, 166, 255, .35), rgba(255, 154, 213, .12) 60%, transparent); }
.bdg-cell.got.tier-legend { background: radial-gradient(circle at 50% 30%, rgba(255, 210, 90, .45), transparent 70%); }
@media (prefers-reduced-motion: reduce) { .bdg-legend svg { animation: none !important; } }
.bdg-season-teaser svg { filter: drop-shadow(0 0 4px rgba(160, 140, 220, .6)); }
/* R / SR / UR category labels */
.rar-label { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 900; }
.rar-label b { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.35rem; letter-spacing: .04em; padding: 0 12px; border-radius: 8px; line-height: 1.5; }
.rar-label small { font-size: .78rem; color: var(--muted); }
.rar-R b { color: #6B4A00; background: linear-gradient(180deg, #FFF6C2, #E3B341); box-shadow: 0 2px 0 #9C6B00; }
.rar-SR b { color: #fff; background: linear-gradient(90deg, #FF7AC6, #6EC8FF, #B08BFF, #FF7AC6); background-size: 200% 100%; animation: badge-holo 4s linear infinite;
  box-shadow: 0 2px 0 #6B3FB8; text-shadow: 0 1px 2px rgba(60, 20, 90, .5); }
.rar-UR b { color: #FFE38A; background: linear-gradient(135deg, #1A1000, #4A3300 50%, #1A1000); box-shadow: 0 2px 0 #000, 0 0 10px rgba(255, 200, 60, .6);
  text-shadow: 0 0 6px rgba(255, 210, 90, .9); border: 1.5px solid #C99700; }
.bdg-cat { margin-top: 14px; }
.bdg-cat-title { font-size: 1rem; margin: 0; }
.bdg-cat-title small { color: var(--muted); font-weight: 700; }
.bdg-cat .small-note { margin: 2px 0 0; }
.bdg-rank.bdg-locked svg { filter: none; }

/* ===================================================================== hand-drawn art + line icons (art.js) */
.ic, [data-icon] > svg { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.ic-wrap { display: inline-flex; vertical-align: middle; }
.ra { display: inline-grid; place-items: center; line-height: 0; vertical-align: middle; }
.ra svg { width: 100%; height: 100%; display: block; }
/* cards on the board: the illustration fills the face */
.card .art .ra { width: clamp(2.6rem, 9vw, 3.8rem); height: clamp(2.6rem, 9vw, 3.8rem); }
.board[data-ruleset="cat12"] .card .art .ra { width: clamp(2.2rem, 7vw, 3.2rem); height: clamp(2.2rem, 7vw, 3.2rem); }
.ra-xs { width: 1.25em; height: 1.25em; margin-right: 1px; }
.ra-sm { width: 1.5em; height: 1.5em; }
.badge .ra-xs { width: 1.35em; height: 1.35em; margin: -2px 0; }
/* title fan */
.fan-card [data-art] { display: block; width: 72%; height: 72%; }
.fan-card [data-art] svg { width: 100%; height: 100%; }
.menu-btn .mi { display: inline-grid; place-items: center; color: var(--ink); }
.menu-btn .mi svg { width: 2.1rem; height: 2.1rem; stroke-width: 1.8; }
.th-icon svg, .rh-icon svg { width: 2rem; height: 2rem; }
.icon-btn > [data-icon] { display: inline-grid; place-items: center; }
.conn.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3BB273; margin-right: 6px; vertical-align: 1px; }
/* avatars drawn as illustrations (art.js AVATAR_ART) */
.mp-avatar .ra, .avatar-opt .ra, #me-avatar .ra, .lb-av .ra { width: 82%; height: 82%; }
.avatar-opt .ra { width: 70%; height: 70%; }
.mp-rewards .ra-xs { width: 1.5em; height: 1.5em; margin: 0 1px; }
/* badge progress gauges (mypage collection + detail) */
.bdg-gauge { display: block; width: 78%; height: 5px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bdg-gauge i { display: block; height: 100%; background: var(--village); border-radius: 99px; }
.bdg-gauge.full i { background: var(--gold, #E8B634); }
.bdg-gauge.big { width: 100%; height: 9px; }
.bdg-prog { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 2px; width: 100%; }
.bdg-prog-row { display: flex; flex-direction: column; gap: 3px; }
.bdg-prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bdg-prog-head b { font-size: .85rem; white-space: nowrap; }
.bdg-notes { margin: 4px 0 2px; padding-left: 1.1em; font-size: .78rem; line-height: 1.5; color: var(--muted); }
.bdg-notes li { margin: 1px 0; }
/* 他の人のマイページ + 名前検索 */
.lb-click { cursor: pointer; }
.lb-row.lb-click:hover, .lb-pod.lb-click:hover { filter: brightness(1.04); }
.pf-search { display: flex; gap: 8px; }
.pf-search input { flex: 1; min-width: 0; }
.pf-results { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-hit { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pf-hit b { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-hit small { margin-left: auto; }
.pf-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; padding-right: 28px; }
.pf-avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2);
  border: 2px solid var(--line); font-size: 1.8rem; font-weight: 900; overflow: hidden; }
.pf-avatar .ra, .pf-avatar svg { width: 54px; height: 54px; }
.pf-who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-name { font-size: 1.2rem; overflow-wrap: anywhere; }
.pf-pins { margin-bottom: 6px; }
.pf-sides { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pf-badges .bdg-cell { cursor: pointer; }
.pf-cap { min-height: 1.4em; }

/* home menu: colour illustrations instead of line icons */
.menu-btn .mi .ra { width: 3.8rem; height: 3.8rem; }
.rh-icon .ra, .th-icon .ra { width: 3.2rem; height: 3.2rem; }
.menu-btn .mi .ra svg, .rh-icon .ra svg, .th-icon .ra svg { width: 100%; height: 100%; }

/* ⓘ: long rule explanations during a game open on demand */
.action-panel .info-more { display: none; }
.action-panel.info-open .info-more { display: revert; }
.action-panel.info-open span.info-more { display: inline; }
.info-btn { display: inline-flex; align-items: center; gap: 2px; margin: 2px 0 6px; padding: 3px 10px 3px 4px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; }
.info-btn.on { color: var(--ink); border-color: var(--village); }
.info-i { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--village); color: #fff;
  font: italic 900 .78rem/1 Georgia, "Times New Roman", serif; }

/* レート推移 */
.rate-chart { margin: 4px 0 8px; }
.rate-svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; user-select: none; }
.rate-svg text { font-family: inherit; font-weight: 700; fill: var(--muted); }
.rc-yl { font-size: 8.5px; text-anchor: end; dominant-baseline: middle; }
.rc-xl { font-size: 8.5px; } .rc-xl.end { text-anchor: end; }
.rc-tl { font-size: 8px; fill: #B88A1E !important; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.rc-grid { stroke: var(--line); stroke-width: .6; }
.rc-tier { stroke: #E2B53B; stroke-width: 1; stroke-dasharray: 4 3; }
.rc-area { fill: var(--village); opacity: .12; }
.rc-line { fill: none; stroke: var(--village); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.rc-dot { stroke: var(--surface); stroke-width: 1; }
.rc-dot.w, .rc-sel.w { fill: #3BAA78; } .rc-dot.l, .rc-sel.l { fill: #E0566B; } .rc-dot.d, .rc-sel.d { fill: #9A93AE; }
.rc-sel { stroke: var(--surface); stroke-width: 2; }
.rc-cursor { stroke: var(--ink); stroke-width: .8; opacity: .35; }
.rc-peak { fill: #FFC93C; stroke: #B87800; stroke-width: .8; }
.rc-cap { margin: 4px 0 0; min-height: 1.4em; }

/* チャット: floating button + a panel opened from it (closed by default, on every screen size) */
.chat-fab, .chat-close { display: none; }
.chat-fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60;
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--line); background: var(--accent); color: #fff;
  box-shadow: 0 4px 0 var(--line), 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
.chat-fab svg { width: 26px; height: 26px; }
.chat-unread { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px;
  background: #E0435A; color: #fff; font-size: .75rem; font-weight: 900; display: grid; place-items: center; border: 2px solid var(--surface); }
.chat-unread.hidden { display: none; }
.game-screen .chat-panel { display: none; }
.game-screen.chat-open .chat-panel { display: block; position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 59;
  width: min(400px, calc(100vw - 32px)); margin: 0; max-height: 60vh; overflow: auto; box-shadow: 0 8px 30px rgba(0,0,0,.22); }
.game-screen.chat-open .chat-close { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-left: 4px; }
.game-screen.chat-open .chat-fab { background: var(--surface); color: var(--ink); }
.game-screen .chat-log { max-height: 38vh; }
@media (max-width: 880px) {
  .game-screen.chat-open .chat-panel { left: 8px; right: 8px; width: auto; bottom: calc(82px + env(safe-area-inset-bottom)); }
}
.game-screen { padding-bottom: 84px; }        /* room for the button under the last panel */
/* narrow phones (320px): keep the hero inside the screen; the name card wraps its title */
.hero { max-width: 100%; }
@media (max-width: 380px) {
  .fan { width: 100%; transform: scale(.88); transform-origin: top center; margin-bottom: -14px; }
  .me-row { flex-wrap: wrap; row-gap: 2px; }
  .me-pin { width: 26px; height: 26px; } .me-pin svg { width: 26px; height: 26px; }
  .me-pin.empty { width: 22px; height: 22px; margin: 2px; }
  .me-avatar { width: 44px; height: 44px; }
}
.account-btn { white-space: nowrap; }
@media (max-width: 380px) { .top-icons { gap: 6px; } .account-btn { padding-left: 10px; padding-right: 10px; } }
@media (max-width: 380px) { .account-btn { max-width: 31vw; overflow: hidden; text-overflow: ellipsis; display: inline-block; } }

/* 意見箱への返信 (お知らせ) */
.news-item.replies { border: 2px solid var(--village); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.reply-card { padding: 8px 0; border-top: 1px dashed var(--line); }
.reply-card:first-of-type { border-top: 0; }
.reply-card blockquote { margin: 4px 0; padding: 4px 10px; border-left: 3px solid var(--line); color: var(--muted); font-size: .86rem; }
.reply-card .reply-text { margin: 6px 0 2px; white-space: pre-wrap; }
.reply-card.unseen .reply-text { font-weight: 700; }
/* 狂人CO (ギドラ解除で狂人として着地) */
.badge.claim-madman { background: #F6E3EC; border-color: #C9879F; color: #6E2A45; }

/* イベント限定バッジ */
.bdg-tier.tier-event { border-color: #7A5A2A; background: #F3E8CF; color: #4A3418; }
.bdg-chip.tier-event .bdg-name { color: #6B4E1E; font-weight: 900; font-family: Georgia, "Times New Roman", serif; }
.bdg-cell.got.tier-event { background: linear-gradient(180deg, rgba(168, 132, 62, .22), transparent 70%); }

/* リリース記念イベントのバナー: one compact row, the width of the ランク戦 button */
.event-banner { width: min(560px, 100%); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 0 0 12px; border: 2.5px solid #141A2B; border-radius: 16px; background: #1E2A48; color: #F5EBD7;
  box-shadow: 0 3px 0 #141A2B; text-align: left; }
.event-banner.hidden { display: none; }
.ev-coins { display: flex; }
.ev-coins .bdg + .bdg { margin-left: -14px; }
.ev-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ev-line1 { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ev-name { font-size: .95rem; color: #FFFFFF; }
.ev-when { font-size: .82rem; font-weight: 800; color: #FFD66B; }
.ev-line2 { font-size: .74rem; color: #CFE6F2; }
.ev-status { font-size: .74rem; font-weight: 800; color: #F5EBD7; }
.ev-status b { color: #FFD66B; }
.ev-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #FF5A6E; margin-right: 4px; vertical-align: 1px;
  animation: ev-blink 1.4s ease-in-out infinite; }
@keyframes ev-blink { 50% { opacity: .25; } }
.ev-cta { background: #E8B43A; color: #141A2B; border: 2px solid #141A2B; box-shadow: 0 2px 0 #141A2B; font: inherit; font-weight: 900;
  font-size: .82rem; padding: 6px 12px; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.ev-cta.ghost { background: transparent; color: #F5EBD7; border-color: #F5EBD7; box-shadow: none; }
.ev-mine { margin-left: 6px; color: #CFE6F2; }
/* phones: smaller type, no wrapping - the banner stays one compact block */
@media (max-width: 560px) {
  .event-banner { gap: 8px; padding: 8px 10px; }
  .ev-coins .bdg { width: 34px !important; height: 34px !important; } .ev-coins svg { width: 34px; height: 34px; }
  .ev-coins .bdg + .bdg { margin-left: -12px; }
  .ev-line1 { flex-direction: column; gap: 0; }
  .ev-name { font-size: .86rem; white-space: nowrap; }
  .ev-when { font-size: .74rem; white-space: nowrap; }
  .ev-line2, .ev-status { font-size: .66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ev-pc { display: none; }
  .ev-mine { display: block; margin-left: 0; }
  .ev-cta { font-size: .74rem; padding: 5px 10px; }
}
@media (prefers-reduced-motion: reduce) { .ev-dot { animation: none; } }
@media (max-width: 380px) {
  .ev-text { overflow: hidden; }
  .ev-when { font-size: .68rem; }
  .ev-cta { font-size: .7rem; padding: 5px 8px; }
  .event-banner { gap: 6px; }
}

/* シーズン2に向けた変更予定: a slim one-line banner (same family as the event banner) */
.s2-banner { width: min(560px, 100%); display: flex; align-items: center; gap: 8px; padding: 6px 12px; margin: -4px 0 12px;
  border: 2px solid #141A2B; border-radius: 12px; background: #2A3557; color: #F5EBD7; box-shadow: 0 2px 0 #141A2B;
  font: inherit; text-align: left; cursor: pointer; }
.s2-banner.hidden { display: none; }
/* 幻の◯◯: a ghostly violet take on the 段位 emblem */
.phantom-bdg { position: relative; display: inline-block; flex: none; }
.phantom-bdg > .bdg, .phantom-bdg > span:first-child { filter: sepia(1) hue-rotate(215deg) saturate(2.4) brightness(1.02) drop-shadow(0 0 6px rgba(170, 130, 255, .9)); opacity: .88;
  animation: ph-float 3.2s ease-in-out infinite; }
@keyframes ph-float { 50% { transform: translateY(-3px); opacity: .78; } }
.phantom-sample { margin: 6px 0 12px; padding: 12px; border-radius: 14px; background: linear-gradient(135deg, #F3EEFF, #E9E2FF); border: 1px dashed #B9A6F2; }
.ph-main { display: flex; align-items: center; gap: 14px; }
.ph-main > div { display: flex; flex-direction: column; gap: 2px; }
.ph-name { font-size: 1.15rem; color: #4B2A9E; }
.ph-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 2px; margin-top: 10px; }
.ph-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .62rem; font-weight: 800; color: #4B2A9E; text-align: center; line-height: 1.25; }
.rc-when { font-size: .95rem; font-weight: 900; }
/* 重要なお知らせ: a big red card near the top of the home screen */
.reset-card { width: min(560px, 100%); display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; padding: 14px 16px;
  border: 3px solid #8E1F12; border-radius: 18px; background: linear-gradient(135deg, #E0453A, #B4271A); color: #fff; text-align: left;
  font: inherit; cursor: pointer; box-shadow: 0 5px 0 #6E160C, 0 10px 24px rgba(180, 39, 26, .35); animation: rc-pulse 2.2s ease-in-out infinite; }
.reset-card.hidden { display: none; }
.reset-card.after { animation: none; }
.reset-card:active { transform: translateY(3px); box-shadow: 0 2px 0 #6E160C; }
.rc-tag { align-self: flex-start; background: #FFE38A; color: #6E160C; font-weight: 900; font-size: .78rem; padding: 3px 10px; border-radius: 99px; letter-spacing: .05em; }
.rc-title { font-size: 1.2rem; font-weight: 900; line-height: 1.35; }
.rc-points { font-size: .85rem; font-weight: 800; opacity: .95; }
.rc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.rc-count { font-size: .82rem; font-weight: 800; background: rgba(0,0,0,.22); padding: 3px 10px; border-radius: 99px; }
.rc-go { font-size: .85rem; font-weight: 900; background: #fff; color: #B4271A; padding: 5px 12px; border-radius: 99px; }
@keyframes rc-pulse { 50% { box-shadow: 0 5px 0 #6E160C, 0 0 0 6px rgba(224, 69, 58, .25), 0 10px 24px rgba(180, 39, 26, .35); } }
.notice-banner { background: #FFF3F0; color: #6B1E14; border-color: #C8361E; box-shadow: 0 2px 0 #C8361E; }
.notice-banner .notice-tag { background: #C8361E; color: #fff; }
.notice-banner .s2-more { color: #C8361E; }
.cup-banner { background: #5A2A14; border-color: #2B1206; box-shadow: 0 2px 0 #2B1206; }
.cup-banner.open { background: #B4361E; animation: cup-pulse 2.4s ease-in-out infinite; }
.cup-banner .cup-tag { background: #FFD66B; }
@keyframes cup-pulse { 50% { filter: brightness(1.12); } }
/* 🏁 大会 panel on the ranked page */
.rk-cup { margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; border: 2px solid #E8A33B; background: linear-gradient(180deg, #FFF4D6, #FFE9B8); color: #4A2A0C; }
.rk-cup.hidden { display: none; }
.rk-cup h3 { margin: 0 0 2px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rk-cup .cup-state { font-size: .72rem; font-weight: 900; padding: 2px 8px; border-radius: 99px; background: #4A2A0C; color: #FFE9B8; }
.rk-cup .cup-state.open { background: #C8361E; color: #fff; }
.rk-cup ul.cup-rules { margin: 6px 0; padding-left: 1.2em; font-size: .84rem; line-height: 1.6; }
.cup-me { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 8px 0; font-weight: 800; }
.cup-me .cup-pts { font-size: 1.6rem; font-weight: 900; color: #B4361E; }
.cup-board { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: 6px; }
.cup-board th, .cup-board td { padding: 4px 6px; border-bottom: 1px solid rgba(74,42,12,.15); text-align: left; }
.cup-board td.num, .cup-board th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cup-board tr.top1 td { font-weight: 900; }
.cup-res { font-weight: 900; font-size: 1.1rem; }
.cup-res .rk-delta { margin-left: 6px; }
.s2-tag { flex: none; background: #CFE6F2; color: #141A2B; font-weight: 900; font-size: .7rem; padding: 2px 8px; border-radius: 99px; }
.s2-text { flex: 1; min-width: 0; font-size: .8rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s2-more { flex: none; font-size: .74rem; font-weight: 800; color: #FFD66B; }
.s2-sheet h2 { font-size: 1.15rem; padding-right: 40px; }
.s2-list { padding-left: 1.2em; line-height: 1.7; }
.s2-list li { margin: 6px 0; }
.s2-note { font-weight: 800; color: var(--ink); background: #FFF6D6; border: 1px solid #E8C25A; border-radius: 10px; padding: 8px 10px; }

/* 猫又の道連れ / several victims at dawn: a short notice in the middle of the screen + flashing cards */
.night-alert {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 70; width: min(420px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 20px; cursor: pointer;
  background: var(--cat-bg); color: var(--cat-ink); border: 3px solid var(--cat-bd); box-shadow: 0 6px 0 var(--cat-bd), 0 16px 30px rgba(0,0,0,.25);
}
.night-alert.hidden { display: none; }
.night-alert.na-in { animation: na-in .45s cubic-bezier(.2, 1.4, .4, 1); }
.night-alert .na-art { flex: none; width: 54px; height: 54px; display: grid; place-items: center; }
.night-alert .na-art svg, .night-alert .na-art img { width: 54px; height: 54px; }
.night-alert .na-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.night-alert .na-text b { font-size: 1.25rem; font-weight: 900; }
.night-alert .na-text span { font-size: .9rem; font-weight: 700; line-height: 1.45; }
@keyframes na-in { from { opacity: 0; transform: translateX(-50%) translateY(30px) scale(.7); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.card.flash-death { animation: flash-death .65s ease-in-out 4; }
@keyframes flash-death { 50% { box-shadow: 0 0 0 6px #FF8C8C, 0 0 22px 6px rgba(255, 90, 90, .7); } }
.badge.claim-multi { background: #FFE1E1; color: #B04040; border-color: #FF9C9C; }
/* 順位表: レート順 / 対局数順 */
.lb-sort { display: flex; gap: 6px; margin: 0 0 10px; }
.lb-sort .btn { flex: 0 0 auto; }
.games-score { display: inline-flex; align-items: baseline; gap: .12em; font-weight: 800; color: var(--ink, #3E3550); }
.games-score b { font-family: "Fredoka", var(--font-logo), var(--font); font-size: 1.35em; font-weight: 700; }
.games-score.small { font-size: 1rem; }
.rk-demoted { font-weight: 800; color: #8E5A5A; font-size: 1rem; margin-top: 4px; }
.rk-rules h4 { margin: 12px 0 2px; font-size: .9rem; }
/* ランク戦: <emblem>段位 instead of the opponent's name */
.tier-tag { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.tier-tag .emblem.tag-em { width: 1.35em; height: 1.35em; display: inline-block; }
.tier-tag .emblem.tag-em svg { width: 100%; height: 100%; display: block; }
.tier-tag b { font-weight: 800; }

/* レートの仕組みが変わります: a bold banner on the ranked page + the before / after sheet */
.rate-banner { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 12px; padding: 10px 14px;
  border: 3px solid #B8860B; border-radius: 16px; cursor: pointer; font: inherit; text-align: left; color: #3E2A00;
  background: linear-gradient(135deg, #FFF3B0 0%, #FFD23F 55%, #F5A400 100%); box-shadow: 0 4px 0 #8A6200; }
.rate-banner:active { transform: translateY(2px); box-shadow: 0 2px 0 #8A6200; }
.rate-banner-tag { flex: none; background: #C0392B; color: #fff; font-weight: 900; font-size: .72rem; padding: 3px 8px; border-radius: 99px; letter-spacing: .05em; }
.rate-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rate-banner-text b { font-size: .98rem; font-weight: 900; }
.rate-banner-text small { font-size: .78rem; font-weight: 700; color: #5B4200; }
.rate-banner-more { flex: none; font-size: .8rem; font-weight: 900; background: #3E2A00; color: #FFE38A; padding: 5px 10px; border-radius: 99px; }
@media (max-width: 420px) { .rate-banner-more { display: none; } .rate-banner-text b { font-size: .9rem; } }
.ratesys-sheet { max-width: 720px; }
.ratesys-sheet h2 { font-size: 1.15rem; padding-right: 40px; }
.cmp-wrap { overflow-x: auto; margin: 8px 0 14px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 460px; }
.cmp-table th, .cmp-table td { border: 1px solid var(--line, #eadfe7); padding: 6px 8px; vertical-align: top; text-align: left; line-height: 1.5; }
.cmp-table thead th { background: #F4EFF7; font-weight: 900; }
.cmp-table tbody th { background: #FBF8FC; white-space: nowrap; font-weight: 800; }
.cmp-table .new { background: #FFF8DC; }
.cmp-table thead .new { background: #FFD23F; color: #3E2A00; }
.rate-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin: 6px 0 8px; }
.rate-table th, .rate-table td { border: 1px solid var(--line, #eadfe7); padding: 5px 8px; text-align: center; }
.rate-table td:first-child, .rate-table th:first-child { text-align: left; }
.rate-table thead th { background: #F4EFF7; font-weight: 900; }
.rate-table tr.top td { background: #FFF8DC; }
.cmp-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.cmp-item h4 { margin: 0 0 4px; font-size: .86rem; font-weight: 900; }
.cmp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cmp-old, .cmp-new { border-radius: 10px; padding: 6px 8px; font-size: .8rem; line-height: 1.5; }
.cmp-old { background: #F4EFF7; color: #6B6078; }
.cmp-new { background: #FFF3C4; border: 2px solid #F5C542; color: #3E2A00; font-weight: 700; }
.cmp-old small, .cmp-new small { display: block; font-size: .68rem; font-weight: 900; margin-bottom: 2px; }
.cmp-new small { color: #B8860B; }
/* 最高レート: a small note next to the rating (my page / profiles) */
.peak-mini { margin-left: 6px; font-size: .72rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.rate-with-peak { display: inline-flex; align-items: baseline; flex-wrap: wrap; }

/* links to the plain pages (/rules, /puzzle, /ranking) under the title menu */
.site-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 14px 0 4px; font-size: .8rem; }
.site-links a { color: var(--muted); }

/* B's fake choices as buttons (like A's CO request), one row per werewolf / the madman */
.action-panel .field.field-buttons { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--surface); }
.action-panel .field.field-buttons.faking { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.choice-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.choice-btns .btn { flex: 1 1 0; min-width: 5.2em; min-height: 44px; justify-content: center; padding-left: 8px; padding-right: 8px; }
.choice-btns.stacked { flex-direction: column; }
.choice-btns.stacked .btn { flex: none; justify-content: flex-start; text-align: left; }
.btn.toggle.on.t-none { background: var(--surface-2); color: var(--ink); border-color: var(--ink); box-shadow: 0 3px 0 var(--line); }
/* アップデート中の帯 (server restarting for a deploy) */
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px calc(10px + env(safe-area-inset-top, 0px)); padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--accent-2); color: #fff; font-size: .9rem; line-height: 1.45; box-shadow: 0 4px 14px rgba(0,0,0,.18); text-align: center; }
.update-bar b { font-size: 1rem; }
/* short choice lists (白／黒, a GJ claim, an answer...) as buttons too, without the box */
.action-panel .field.field-buttons.compact { border: none; background: none; padding: 0; }
.btn.toggle.on.t-white { background: #fff; color: #2b2533; border-color: #2b2533; box-shadow: 0 3px 0 #2b2533; }
/* 黒 is dark grey while not chosen, solid black when chosen */
.btn.toggle.t-black:not(.on) { background: #9a94a3; color: #fff; border-color: #9a94a3; box-shadow: 0 3px 0 #7a7484; }
.btn.toggle.on.t-black { background: #2b2533; color: #fff; border-color: #2b2533; box-shadow: 0 3px 0 #000; }
/* button rows: a little shorter everywhere; on a wide screen the label sits beside the buttons */
.choice-btns .btn { padding-top: 8px; padding-bottom: 8px; }
@media (min-width: 760px) {
  .action-panel .field.field-buttons { flex-direction: row; align-items: center; gap: 10px; padding: 6px 10px; margin: 6px 0; }
  .action-panel .field.field-buttons > span:first-child { flex: 0 0 10.5em; min-width: 0; }
  .action-panel .field.field-buttons .choice-btns { flex: 1 1 auto; }
  .choice-btns .btn { min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
}
.action-panel details.verdict-help { margin: -2px 0 6px; font-size: .8rem; color: var(--muted); }
.action-panel details.verdict-help summary { cursor: pointer; width: fit-content; }
.action-panel details.verdict-help p { margin: 2px 0 0; }

/* チャットOFF */
.chat-off-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-fab.chat-is-off { opacity: .55; }

/* 📺 配信者マーク */
.stream-mark { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 7px 1px 5px; border-radius: 99px;
  background: #E8435A; color: #fff; font-size: .68rem; font-weight: 800; line-height: 1.5; text-decoration: none; vertical-align: middle;
  box-shadow: 0 2px 0 rgba(0,0,0,.15); white-space: nowrap; }
.stream-mark svg { color: #fff; } .stream-mark svg rect { fill: rgba(255,255,255,.25); }
.stream-mark.sm { padding: 2px 4px; margin-left: 4px; }
.stream-edit { margin-top: 10px; }
.stream-edit summary { cursor: pointer; font-weight: 800; }
.stream-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stream-input { flex: 1 1 200px; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); font: inherit; }

/* 📺 配信者一覧 (top page) */
/* 👥 フレンド */
.fr-add { display: flex; gap: 8px; margin: 0 0 10px; }
.fr-btn { position: relative; }
.fr-badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 99px; background: #E0453A; color: #fff; font-size: .7rem; font-weight: 900; line-height: 18px; text-align: center; }
.fr-badge.hidden { display: none; }
.me-chip.has-alert { position: relative; border-color: #E0453A; animation: fr-glow 1.6s ease-in-out infinite; }
.me-chip.has-alert::after { content: ""; position: absolute; top: -4px; left: -4px; width: 14px; height: 14px; border-radius: 50%; background: #E0453A; border: 2px solid var(--surface); }
@keyframes fr-glow { 50% { box-shadow: 0 0 0 4px rgba(224, 69, 58, .28); } }
.fr-add input { flex: 1; min-width: 0; }
.fr-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.fr-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.fr-item .fr-av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); overflow: hidden; }
.fr-item .fr-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-item .fr-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.fr-item .fr-acts { display: flex; gap: 4px; flex: none; margin-left: auto; }
.fr-item { flex-wrap: wrap; }
.fr-item .fr-who { min-width: 7em; }
.fr-item .fr-who small { white-space: nowrap; }
.fr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: #B9B0C4; vertical-align: middle; }
.fr-dot.online { background: #2EB872; }
.fr-dot.playing { background: #F0A030; }
.fr-sub { margin: 8px 0 4px; font-size: .85rem; }
.fr-hide { margin-top: 6px; font-size: .85rem; }
.ch-pill { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 61; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 99px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.18); font-size: .85rem; font-weight: 700;
  max-width: calc(100vw - 24px); white-space: nowrap; }
.ch-pill > span:not(.rk-spinner) { overflow: hidden; text-overflow: ellipsis; }
.ch-pill .btn { flex: none; }
.streamers { margin: 14px 0; padding: 12px 14px; border-radius: 18px; background: var(--surface); box-shadow: 0 4px 0 var(--line); }
.streamers .sub { margin: 0 0 8px; font-size: 1rem; }
.streamer-empty { margin: 0; padding: 14px 10px; text-align: center; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-weight: 600; line-height: 1.6; }
.streamer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.streamer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 10px;
  border-radius: 12px; background: var(--surface-2); }
.streamer-who { display: flex; flex-direction: column; min-width: 0; }
.streamer-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streamer-links { display: flex; gap: 6px; }
.streamer-links a, .stream-mark { text-decoration: none; }
.showcase-apply { margin-top: 10px; }
.showcase-mine { margin: 6px 0 0; padding-left: 18px; }
.sc-approved { color: #2E8B57; font-weight: 800; } .sc-rejected { opacity: .7; } .sc-pending { color: #C47A00; font-weight: 800; }
.stream-mark.static { margin-left: 0; margin-right: 2px; }
.stream-edit summary { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ランク戦・レート差300以上 */
.rk-frozen-note { margin: 0 0 8px; padding: 6px 10px; border-radius: 10px; background: #FFF4D6; color: #7A5200; font-size: .82rem; font-weight: 700; }

/* ===================================================================== 見やすい盤面 (読みやすさ / 配信)
   The slot number, the verdict marks (#6○ / #9●) and the CO badge scale with the CARD's own width
   (container query units), so they are big on a PC / a stream and still fit on a phone. */
.board .card { container-type: inline-size; }
.board .card .num, .board[data-ruleset] .card .num {
  font-size: max(.85rem, min(19cqi, 1.7rem)); padding: 0 .4em; line-height: 1.35; font-weight: 800;
  box-shadow: 0 2px 0 var(--line), 0 0 0 1.5px var(--line);
}
.board .card .mark, .board[data-ruleset] .card .mark {
  font-size: max(.68rem, min(16cqi, 1.4rem)); padding: .05em .4em; line-height: 1.3; font-weight: 900; letter-spacing: .01em;
}
.board .card .mark.m-black { background: #1E1A28; color: #FF8A95; }
.board .card .mark.m-white { border-width: 1.5px; border-color: #B9AEC4; }
/* the marks sit under the slot number and wrap across the whole card (no clash with the number) */
.board .card .marks, .board[data-ruleset] .card .marks {
  top: calc(max(.85rem, min(19cqi, 1.7rem)) * 1.35 + 10px); left: 4px; right: 4px;
  flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; align-content: flex-start;
  gap: max(2px, 1.6cqi); max-height: calc(100% - max(.85rem, min(19cqi, 1.7rem)) * 1.35 - 36px);
}
.board .card .badge, .board[data-ruleset] .card .badge { font-size: max(.62rem, min(13.5cqi, 1.15rem)); padding: .15em .6em; }
.board .card .badge .ra-xs { width: 1.15em; height: 1.15em; }
.board .card .ident, .board[data-ruleset] .card .ident { font-size: max(.72rem, 11cqi); }

/* 📺 配信用モード */
.stream-chip { background: #E5484D; color: #fff; border: 0; font-weight: 700; cursor: pointer; }
.stream-blur { filter: blur(5px); cursor: pointer; user-select: none; transition: filter .2s; }
body.stream-mode .pass-inline input, body.stream-mode #room-pass, body.stream-mode #join-id-pass { -webkit-text-security: disc; }
.sc-img { display: block; width: 100%; aspect-ratio: 1200 / 630; border-radius: 12px; margin: 8px 0 12px; background: #F3EEF6; object-fit: cover; }
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.social-row .btn { text-decoration: none; justify-content: center; text-align: center; white-space: nowrap; font-size: .9rem; padding-left: 6px; padding-right: 6px; }
.social-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.social-links .x-link { margin: 0; }
.x-link.dc-link b { color: #5865F2; }
.sns-btn { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.sns-btn .sns-x { font-weight: 900; font-size: 1.05rem; line-height: 1; }
.sns-dc { color: #5865F2; }
@media (max-width: 359px) { .top-icons .sns-btn { display: none; } }   /* the smallest phones: the X / Discord row near the bottom instead */
/* the X / Discord icons on PC: say at once what they are for */
.sns-btn { position: relative; }
.sns-btn[data-tip]:hover::after, .sns-btn[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; white-space: nowrap;
  padding: 7px 12px; border-radius: 10px; background: #3B3046; color: #fff; font-size: .8rem; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); pointer-events: none; }
.dc-sheet { text-align: left; }
.dc-hero { width: 88px; height: 88px; margin: 4px auto 10px; border-radius: 24px; background: #5865F2; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(88,101,242,.35); }
.dc-sheet h2 { text-align: center; }
.dc-join { background: #5865F2 !important; border-color: #4752C4 !important; box-shadow: 0 4px 0 #3C45A5 !important; text-decoration: none; text-align: center; }
@media (min-width: 360px) { .social-links .dc-link { display: none; } }   /* the Discord icon is in the top bar */
@media (max-width: 640px) { .account-btn { max-width: 30vw; overflow: hidden; text-overflow: ellipsis; display: inline-block; } }

/* 📱 スマホ: the mini board pinned at the top, the decision button pinned at the bottom */
.mini-board { display: none; }
@media (max-width: 880px) {
  .mini-board:not(.hidden) { display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 30; padding: 6px 10px 8px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px);
    box-shadow: 0 6px 16px rgba(60, 40, 80, .16); border-radius: 0 0 16px 16px; }
  .mini-board .board.mini { width: 100%; max-width: 560px; margin: 0 auto; gap: 5px; }
  .mini-board .board.mini .card { aspect-ratio: 1 / 1.08; border-width: 2px; border-radius: 9px; padding: 3px; box-shadow: none; }
  body.mini-on #action-panel { scroll-margin-top: 40vh; }
  .action-panel .submit-bar { position: sticky; bottom: 0; z-index: 20; margin: 10px -16px -14px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 20px 20px; box-shadow: 0 -6px 14px rgba(60, 40, 80, .08); }
  .action-panel .submit-bar .btn { flex: 1; }
}
@media (max-width: 880px) { .mini-board .board.mini .card .badge { display: none; } }   /* the card colour already says the CO */
@media (max-width: 880px) {   /* the mini board: small type so the marks (占い結果・処刑先→) still fit */
  .mini-board .board.mini .card { overflow: hidden; }
  .mini-board .board.mini .card .ident { display: none; }
  .mini-board .board.mini .card .num { font-size: 10px; padding: 0 .35em; box-shadow: none; }
  .mini-board .board.mini .card .marks { top: 17px; left: 2px; right: 2px; gap: 2px; max-height: none; }
  .mini-board .board.mini .card .mark { font-size: 9px; padding: 0 .3em; line-height: 1.35; white-space: nowrap; }
}
@media (max-width: 880px) { .action-panel .submit-bar { padding-right: 84px; } }   /* room for the chat button (bottom right) */

/* 決着後: the revealed identity (art + name) comes in front of the history marks, which fade back */
.board.ended .card:not(.facedown) .art { opacity: 1; z-index: 4; }
.board.ended .card:not(.facedown) .ident { position: relative; z-index: 5; background: var(--surface); border-radius: 99px;
  padding: 1px 10px; box-shadow: 0 2px 0 var(--line), 0 0 0 1.5px var(--line); }
.board.ended .card:not(.facedown) .marks { opacity: .45; }

/* 🎉 初めての昇格: the strip on the ランク戦 page */
.rk-promo { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(135deg, #FFF6D6, #FFE3EC); border: 2px solid #F4C95D; box-shadow: 0 4px 0 #F0D78C; }
.rk-promo .rkp-badge { flex: none; }
.rk-promo .rkp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rk-promo .rkp-text b { font-size: 1.05rem; }
.rk-promo .rkp-text small { color: var(--muted); }
.rk-promo .rkp-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.rk-promo .rkp-close { width: 32px; height: 32px; font-size: .9rem; }
@media (max-width: 520px) { .rk-promo { flex-wrap: wrap; } .rk-promo .rkp-actions { width: 100%; } .rk-promo .rkp-actions .btn { flex: 1; } }

/* PP/RPPチャンス演出 */
.pp-fx { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(20, 16, 40, .62); padding: 16px; }
.pp-fx.hidden { display: none; }
.pp-badge { background: #2B2350; color: #FFD966; }
.ppfx-banner { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: #fff; animation: ppfx-pop .5s cubic-bezier(.2, 1.5, .4, 1); }
.ppfx-banner b { font-size: clamp(2.2rem, 9vw, 4rem); font-weight: 900; color: #FFD966; letter-spacing: .04em;
  text-shadow: 0 4px 0 #B8461F, 0 0 24px rgba(255, 200, 80, .7); animation: ppfx-pulse .7s ease-in-out infinite alternate; }
.ppfx-banner span { font-weight: 800; font-size: 1rem; }
.ppfx-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #fff; text-align: center; }
.ppfx-title { margin: 0; font-weight: 900; font-size: 1.2rem; }
.ppfx-sub { margin: 0; min-height: 1.6em; font-weight: 900; font-size: 1.15rem; color: #FFD966; }
.ppfx-card { width: 150px; height: 200px; perspective: 900px; }
.ppfx-inner { position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1); transform-style: preserve-3d; }
.ppfx-card.flipped .ppfx-inner { transform: rotateY(180deg); }
.ppfx-face { position: absolute; inset: 0; border-radius: 16px; border: 4px solid #fff; display: grid; place-items: center; backface-visibility: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.ppfx-back { background: repeating-linear-gradient(135deg, #8E95E8 0 14px, #A9AEF0 14px 28px); }
.ppfx-back b { font-size: 2.4rem; font-weight: 900; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.ppfx-front { background: #FFF6E0; color: #2B2350; transform: rotateY(180deg); }
.ppfx-hit, .ppfx-miss { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ppfx-hit svg, .ppfx-hit img { width: 96px; height: 96px; }
.ppfx-hit b { font-size: 1.5rem; font-weight: 900; color: #B8461F; }
.ppfx-miss .ppfx-x { font-size: 4.5rem; line-height: 1; font-weight: 900; color: #8A8AA0; }
.ppfx-miss b { font-weight: 900; color: #5A5670; }
.ppfx-roulette { display: flex; align-items: center; gap: 14px; }
.ppfx-slot { width: 130px; padding: 18px 8px; border-radius: 16px; background: #3A3363; border: 4px solid #5A5288; display: flex; flex-direction: column; gap: 4px; transition: transform .08s, background .08s; }
.ppfx-slot small { font-weight: 800; opacity: .85; }
.ppfx-slot b { font-size: 2.2rem; font-weight: 900; }
.ppfx-slot.lit { background: #FFD966; color: #2B2350; border-color: #fff; transform: scale(1.08); }
.ppfx-slot.chosen { background: #E0435A; color: #fff; border-color: #fff; transform: scale(1.16); animation: ppfx-pulse .45s ease-in-out infinite alternate; }
.ppfx-vs { font-weight: 900; font-size: 1.3rem; color: #FFD966; }
@keyframes ppfx-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ppfx-pulse { from { filter: brightness(1); } to { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .ppfx-inner { transition: none; } .ppfx-banner, .ppfx-banner b, .ppfx-slot.chosen { animation: none; } }

/* 決着の1枚 + 内訳発表 */
.pp-fx.final { background: rgba(20, 16, 40, .94); }
.ppfx-cards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.board.revealing .card { animation: reveal-card .5s cubic-bezier(.3, 1.4, .5, 1) both; }
.board.revealing .card:nth-child(1) { animation-delay: 0ms; }
.board.revealing .card:nth-child(2) { animation-delay: 90ms; }
.board.revealing .card:nth-child(3) { animation-delay: 180ms; }
.board.revealing .card:nth-child(4) { animation-delay: 270ms; }
.board.revealing .card:nth-child(5) { animation-delay: 360ms; }
.board.revealing .card:nth-child(6) { animation-delay: 450ms; }
.board.revealing .card:nth-child(7) { animation-delay: 540ms; }
.board.revealing .card:nth-child(8) { animation-delay: 630ms; }
.board.revealing .card:nth-child(9) { animation-delay: 720ms; }
.board.revealing .card:nth-child(10) { animation-delay: 810ms; }
.board.revealing .card:nth-child(11) { animation-delay: 900ms; }
.board.revealing .card:nth-child(12) { animation-delay: 990ms; }
.board.revealing .card:nth-child(13) { animation-delay: 1080ms; }
.board.revealing .card:nth-child(14) { animation-delay: 1170ms; }
.board.revealing .card:nth-child(15) { animation-delay: 1260ms; }
.board.revealing .card:nth-child(16) { animation-delay: 1350ms; }
.board.revealing .card:nth-child(17) { animation-delay: 1440ms; }
@keyframes reveal-card { from { transform: rotateY(90deg) scale(.9); opacity: .2; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .board.revealing .card { animation: none; } }

/* カードをその場でめくる */
.board .card.flip-out { animation: card-flip-out .45s cubic-bezier(.5, 0, .9, .6) forwards; z-index: 6; }
.board .card.flip-in { animation: card-flip-in .65s cubic-bezier(.2, 1.25, .4, 1); z-index: 6; box-shadow: 0 0 0 4px #FFD966, 0 10px 26px rgba(0,0,0,.25); }
.board .card.flip-miss { animation: card-shake .45s; box-shadow: 0 0 0 4px #8A8AA0; }
.board .card.flip-miss::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; font-weight: 900; color: rgba(90, 86, 112, .85); z-index: 7; }
@keyframes card-flip-out { from { transform: perspective(700px) rotateY(0); } to { transform: perspective(700px) rotateY(90deg) scale(1.06); } }
@keyframes card-flip-in { from { transform: perspective(700px) rotateY(-90deg) scale(1.06); } to { transform: perspective(700px) rotateY(0); } }
@keyframes card-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px) rotate(-2deg); } 40% { transform: translateX(6px) rotate(2deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .board .card.flip-out, .board .card.flip-in, .board .card.flip-miss { animation: none; } }

.board .card.fx-target { box-shadow: 0 0 0 4px #E0435A, 0 0 22px rgba(224, 67, 90, .6); animation: ppfx-pulse .6s ease-in-out infinite alternate; }
.board .card.fx-lit { box-shadow: 0 0 0 5px #FFD966, 0 0 26px rgba(255, 217, 102, .9); transform: scale(1.06); z-index: 6; }
.board .card.fx-chosen { box-shadow: 0 0 0 6px #E0435A, 0 0 30px rgba(224, 67, 90, .9); transform: scale(1.1); z-index: 6; animation: ppfx-pulse .45s ease-in-out infinite alternate; }

/* ドーパミン演出 */
.fx-flash { position: fixed; inset: 0; z-index: 205; pointer-events: none; animation: fx-flash .8s ease-out forwards; }
.fx-flash.red { background: radial-gradient(circle, rgba(255, 60, 90, .15) 30%, rgba(224, 30, 60, .55)); }
.fx-flash.gold { background: radial-gradient(circle, rgba(255, 255, 255, .85), rgba(255, 210, 80, .5) 45%, rgba(255, 170, 0, .1)); }
.fx-flash.grey { background: rgba(40, 36, 60, .45); }
@keyframes fx-flash { from { opacity: 1; } to { opacity: 0; } }
.fx-shake { animation: fx-shake .45s; }
.fx-shake-strong { animation: fx-shake-strong .6s; }
@keyframes fx-shake { 0%, 100% { transform: none; } 20% { transform: translate(-5px, 2px); } 40% { transform: translate(5px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(3px, 0); } }
@keyframes fx-shake-strong { 0%, 100% { transform: none; } 15% { transform: translate(-10px, 4px) rotate(-.6deg); } 30% { transform: translate(9px, -4px) rotate(.6deg); } 45% { transform: translate(-7px, 3px); } 60% { transform: translate(6px, -2px); } 80% { transform: translate(-3px, 1px); } }
.fx-big { position: fixed; left: 50%; top: 42%; z-index: 215; transform: translate(-50%, -50%); pointer-events: none; white-space: pre-line;
  width: max-content; max-width: 94vw; text-align: center; line-height: 1.15; font-weight: 900; font-size: clamp(2.2rem, 10vw, 5.5rem); letter-spacing: .03em; color: #FFE680;
  -webkit-text-stroke: 3px #2B2350; paint-order: stroke fill; text-shadow: 0 6px 0 #B8461F, 0 0 34px rgba(255, 210, 80, .9);
  animation: fx-big-in .5s cubic-bezier(.2, 1.7, .4, 1) both; }
.fx-big.alarm { color: #FF5A78; text-shadow: 0 6px 0 #6E0F22, 0 0 34px rgba(255, 60, 90, .9); }
.fx-big.miss { color: #C9C6DA; text-shadow: 0 6px 0 #4A4660, 0 0 20px rgba(0, 0, 0, .4); }
.fx-big.out { animation: fx-big-out .35s ease-in forwards; }
/* カード札 (PP・RPP・猫又・処刑): a white plaque like the game's cards */
.fx-plaque { --c: #E8B730; position: fixed; left: 50%; top: 42%; z-index: 215; pointer-events: none;
  width: min(86vw, 360px); padding: 18px 18px 20px; border-radius: 22px; background: #fff; text-align: center; color: #4A3B57;
  box-shadow: 0 0 0 5px var(--c), 0 18px 44px rgba(30, 10, 60, .35); transform: translate(-50%, -50%) rotate(-2deg);
  animation: fx-plaque-in .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.fx-plaque.alarm { --c: #FF5A78; } .fx-plaque.miss { --c: #A9A4C4; }
.fx-plaque.guard { --c: #4A9BE8; }
/* 護衛成功: a white-blue spark where the fangs meet the blade */
.fx-spark { position: fixed; left: 50%; top: 42%; width: 70vmin; height: 70vmin; z-index: 212; pointer-events: none; transform: translate(-50%, -50%);
  background: radial-gradient(circle, #fff 0, rgba(200, 230, 255, .95) 6%, rgba(110, 180, 255, .55) 18%, rgba(80, 140, 255, 0) 45%),
    conic-gradient(from 10deg, transparent 0 8%, rgba(255, 255, 255, .9) 9%, transparent 10% 33%, rgba(255, 255, 255, .8) 34%, transparent 35% 58%,
      rgba(255, 255, 255, .9) 59%, transparent 60% 83%, rgba(255, 255, 255, .8) 84%, transparent 85%);
  -webkit-mask: radial-gradient(circle, #000 0, #000 30%, transparent 50%); mask: radial-gradient(circle, #000 0, #000 30%, transparent 50%);
  animation: fx-spark .8s ease-out forwards; }
@keyframes fx-spark { from { opacity: 1; transform: translate(-50%, -50%) scale(.2) rotate(0); } 25% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -50%) scale(1.15) rotate(25deg); } }
.fx-plaque .fp-tag { display: inline-block; background: var(--c); color: #fff; font-weight: 800; font-size: .78rem; letter-spacing: .14em;
  border-radius: 99px; padding: 3px 12px; }
.fx-plaque .fp-jp { display: block; font-weight: 800; font-size: clamp(1.8rem, 8vw, 2.6rem); margin-top: 8px; letter-spacing: .04em; }
.fx-plaque .fp-sub { display: block; color: #7a7396; font-size: .85rem; margin-top: 4px; }
.fx-plaque.out { animation: fx-plaque-out .35s ease-in forwards; }
@keyframes fx-plaque-in { from { opacity: 0; transform: translate(-50%, -30%) rotate(-8deg) scale(.7); } }
@keyframes fx-plaque-out { to { opacity: 0; transform: translate(-50%, -60%) rotate(3deg) scale(.9); } }
/* 処刑・襲撃 (演出あり): darkness, the card lifted into a spotlight, torn along a jagged line */
.board .card.fx-gone { visibility: hidden; }
.fx-shade { position: fixed; inset: 0; z-index: 205; pointer-events: none; opacity: 0; transition: opacity .45s ease;
  background: radial-gradient(circle at 50% 45%, rgba(40, 6, 16, .35) 0, rgba(24, 4, 10, .86) 46%, rgba(12, 2, 6, .92) 100%); }
.fx-shade.night { background: radial-gradient(circle at 50% 45%, rgba(20, 24, 60, .35) 0, rgba(8, 10, 32, .88) 46%, rgba(4, 4, 18, .94) 100%); }
.fx-shade.on { opacity: 1; }
.fx-tear { position: fixed; z-index: 210; pointer-events: none; transform-origin: 50% 50%; }
.fx-tear .tear-half { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.fx-tear .tear-half.tl { clip-path: polygon(0 0, 53% 0, 47% 11%, 55% 22%, 45% 34%, 54% 47%, 44% 60%, 53% 72%, 46% 85%, 52% 100%, 0 100%); }
.fx-tear .tear-half.tr { clip-path: polygon(53% 0, 100% 0, 100% 100%, 52% 100%, 46% 85%, 53% 72%, 44% 60%, 54% 47%, 45% 34%, 55% 22%, 47% 11%); }
.fx-tear.night .tear-half.tl { clip-path: polygon(0 0, 30% 0, 38% 14%, 34% 30%, 50% 44%, 46% 58%, 62% 70%, 58% 86%, 70% 100%, 0 100%); }
.fx-tear.night .tear-half.tr { clip-path: polygon(30% 0, 100% 0, 100% 100%, 70% 100%, 58% 86%, 62% 70%, 46% 58%, 50% 44%, 34% 30%, 38% 14%); }
.fx-tear:not(.torn) .tear-half { box-shadow: none; }
@keyframes fx-big-in { 0% { transform: translate(-50%, -50%) scale(3) rotate(-8deg); opacity: 0; } 60% { transform: translate(-50%, -50%) scale(.9) rotate(2deg); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); } }
@keyframes fx-big-out { to { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }
.fx-confetti { position: fixed; z-index: 214; width: 10px; height: 14px; border-radius: 2px; pointer-events: none; animation: fx-confetti 1.3s cubic-bezier(.15, .8, .3, 1) forwards; }
@keyframes fx-confetti { from { transform: translate(-50%, -50%) rotate(0); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 160px)) rotate(var(--r)); opacity: 0; } }
.board .card.fx-wobble { animation: fx-wobble .14s ease-in-out infinite alternate; box-shadow: 0 0 0 5px #FFD966, 0 0 26px rgba(255, 217, 102, .9); z-index: 6; }
@keyframes fx-wobble { from { transform: rotate(-3deg) scale(1.05); } to { transform: rotate(3deg) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .fx-shake, .fx-shake-strong, .board .card.fx-wobble, .fx-big, .fx-plaque { animation: none; } .fx-confetti { display: none; } }
.board .card.fx-still { z-index: 6; transform: scale(1.04); box-shadow: 0 0 0 4px #fff, 0 0 0 7px #2B2350, 0 12px 30px rgba(0,0,0,.3); transition: transform .25s; }

.reply-card.warning { border-color: #E0435A; background: color-mix(in srgb, #E0435A 8%, var(--surface)); }
.reply-card.warning > b { color: #C0263E; }

/* 猫又の肉球ルーレット */
.board .card.fx-paw { z-index: 6; box-shadow: 0 0 0 4px #FF8FA3, 0 0 22px rgba(255, 120, 150, .8); }
.board .card.fx-paw::after { content: ""; position: absolute; left: 50%; top: 50%; width: 58%; aspect-ratio: 1; z-index: 8;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g fill='%23E0435A' stroke='white' stroke-width='4'><ellipse cx='50' cy='66' rx='24' ry='20'/><ellipse cx='22' cy='42' rx='10' ry='13'/><ellipse cx='40' cy='26' rx='10' ry='13'/><ellipse cx='60' cy='26' rx='10' ry='13'/><ellipse cx='78' cy='42' rx='10' ry='13'/></g></svg>") center / contain no-repeat; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3));
  animation: fx-paw-hop .22s cubic-bezier(.2, 1.6, .4, 1) both; pointer-events: none; }
@keyframes fx-paw-hop { from { transform: translate(-50%, -80%) scale(.4) rotate(-20deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1) rotate(-8deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .board .card.fx-paw::after { animation: none; transform: translate(-50%, -50%); } }

/* 襲撃の爪痕 */
.card .claw { position: absolute; pointer-events: none; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g fill='none' stroke='%23D21E3C' stroke-linecap='round'><path d='M18 12 Q40 44 30 90' stroke-width='9'/><path d='M44 6 Q66 42 56 94' stroke-width='10'/><path d='M70 12 Q90 44 82 88' stroke-width='9'/></g><g fill='none' stroke='%23FF8A9B' stroke-linecap='round' opacity='.7'><path d='M18 12 Q40 44 30 90' stroke-width='3'/><path d='M44 6 Q66 42 56 94' stroke-width='3'/><path d='M70 12 Q90 44 82 88' stroke-width='3'/></g></svg>") center / contain no-repeat; }
.card .claw.big { left: 8%; top: 8%; width: 84%; height: 84%; z-index: 9; filter: drop-shadow(0 3px 4px rgba(120, 0, 20, .35));
  animation: claw-rip .28s cubic-bezier(.3, .9, .4, 1) both; }
.card .claw.small { right: 5%; bottom: 5%; width: 38%; height: 38%; z-index: 3; }
@keyframes claw-rip { from { clip-path: inset(0 100% 100% 0); transform: rotate(-6deg) scale(1.15); } to { clip-path: inset(0 0 0 0); transform: rotate(-6deg) scale(1); } }
.board.mini .card .claw.small { width: 38%; height: 38%; }
@media (prefers-reduced-motion: reduce) { .card .claw.big { animation: none; } }
/* a card killed at night: greyed by a veil instead of a filter on the whole card, so the claw stays red */
.card.dead.claw-dead { filter: none; opacity: 1; }
.card.claw-dead .dead-veil { position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
  -webkit-backdrop-filter: grayscale(.85) brightness(.92); backdrop-filter: grayscale(.85) brightness(.92); background: rgba(250, 248, 252, .42); }
.card.claw-dead .claw.small { z-index: 6; }
[data-theme="horror"] .card.claw-dead .dead-veil { -webkit-backdrop-filter: grayscale(.55) brightness(.6) sepia(.3); backdrop-filter: grayscale(.55) brightness(.6) sepia(.3); background: rgba(0, 0, 0, .15); }

/* HR ハイパーレア: a rainbow prism, above UR */
.bdg-hyper svg { filter: drop-shadow(0 0 4px rgba(255, 255, 255, .95)) drop-shadow(0 0 10px rgba(180, 140, 255, .8)); animation: bdg-hyper 3s linear infinite; }
@keyframes bdg-hyper { 0% { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 12px #FF7AB8); } 33% { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 12px #7ED8FF); }
  66% { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 12px #8CF5A8); } 100% { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 12px #FF7AB8); } }
.bdg-chip.tier-hyper .bdg-name { background: linear-gradient(90deg, #FF4F9A, #FFB43B, #3BCF6A, #2FA8E8, #8A5CF0, #FF4F9A); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: badge-holo 2.4s linear infinite; font-weight: 900; }
.bdg-tier.tier-hyper { border-color: #B892FF; background: linear-gradient(90deg, #FFD6EC, #FFF1C2, #D6FFE0, #D6F2FF, #E8DCFF); color: #3A1E7A; }
.ach-count.hyper { border-color: #B892FF; background: linear-gradient(90deg, #FFD6EC, #D6F2FF, #E8DCFF); color: #3A1E7A; }
.bdg-cell.got.tier-hyper { background: radial-gradient(circle at 50% 30%, rgba(184, 146, 255, .45), rgba(126, 216, 255, .18) 50%, transparent 72%); }
@media (prefers-reduced-motion: reduce) { .bdg-hyper svg { animation: none !important; } }

/* 開発者バッジ */
.bdg-staff svg { filter: drop-shadow(0 0 4px rgba(255, 210, 90, .95)) drop-shadow(0 0 8px rgba(0, 0, 0, .35)); }
.bdg-chip.tier-staff .bdg-name { background: linear-gradient(90deg, #2A1A00, #C99700, #FFF6C8, #C99700, #2A1A00); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: badge-holo 3s linear infinite; font-weight: 900; }
.bdg-tier.tier-staff { border-color: #C99700; background: linear-gradient(90deg, #0A0810, #3A2A00, #0A0810); color: #FFE38A; }
.bdg-cell.got.tier-staff { background: radial-gradient(circle at 50% 30%, rgba(255, 210, 90, .4), transparent 70%); }
a.btn { text-decoration: none; text-align: center; }
.fx-blade { position: fixed; left: 50%; top: 42%; width: 64vmin; height: 5px; z-index: 213; pointer-events: none; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #fff 30%, #fff 70%, transparent); box-shadow: 0 0 18px 4px rgba(140, 200, 255, .9);
  transform: translate(-50%, -50%) rotate(var(--a)) scaleX(0); animation: fx-blade .7s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes fx-blade { 20% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) scaleX(1); } to { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) scaleX(1.1); } }

/* CO・対抗CO・黒出し (演出あり) */
.board .card.fx-stamp { z-index: 6; box-shadow: 0 0 0 4px #fff, 0 0 22px rgba(255, 255, 255, .9); }
.board .card.fx-stamp .badge { animation: fx-stamp .32s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes fx-stamp { from { opacity: 0; transform: scale(2.8) rotate(-14deg); } 55% { opacity: 1; transform: scale(.88) rotate(3deg); } to { transform: none; } }
.board .card.fx-vs { z-index: 6; box-shadow: 0 0 0 5px #FF5A78, 0 0 28px rgba(255, 90, 120, .85); animation: ppfx-pulse .45s ease-in-out infinite alternate; }
.fx-plaque.vs { --c: #FF5A78; }
.board .card.fx-black { z-index: 6; }
.board .card.fx-black::before { content: "黒"; position: absolute; left: 50%; top: 50%; z-index: 8; width: 62%; aspect-ratio: 1; display: grid; place-items: center;
  transform: translate(-50%, -50%) rotate(-8deg); border: 5px solid #D9304B; border-radius: 50%; color: #D9304B; background: rgba(255, 255, 255, .82); font-weight: 900; font-size: min(3.2rem, 34cqi);
  box-shadow: 0 0 0 3px rgba(217, 48, 75, .25), 0 8px 22px rgba(0, 0, 0, .3); pointer-events: none;
  animation: fx-seal .35s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes fx-seal { from { opacity: 0; transform: translate(-50%, -50%) scale(2.6) rotate(-20deg); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .board .card.fx-stamp .badge, .board .card.fx-vs, .board .card.fx-black::before { animation: none; } }
/* the small pinned board: a corner button to hide it (the setting keeps it hidden) */
.mini-board .mini-hide { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: none;
  background: rgba(43, 35, 80, .55); color: #fff; font-size: .75rem; line-height: 24px; padding: 0; cursor: pointer; z-index: 3; }
