:root {
  --felt: #0f5a3c;
  --felt-dark: #083a27;
  --felt-light: #177a52;
  --gold: #f2c14e;
  --gold-dark: #b8872a;
  --ink: #1b1b1f;
  --paper: #fffdf7;
  --red: #d2263a;
  --text: #f4f1e8;
  --muted: rgba(244, 241, 232, 0.65);
  --panel: rgba(0, 0, 0, 0.28);
  --line: rgba(255, 255, 255, 0.14);
  /* カードは画面サイズに合わせて拡大（フルHDで約105px、WQHDで最大130px幅） */
  --cw: clamp(62px, min(5.6vw, 10.5vh), 130px);
  --ch: calc(var(--cw) * 1.42);
  /* ゲーム画面のUI倍率（大きい画面で拡大） */
  --s: 1;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Zen Maru Gothic', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 35%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%) fixed;
  background-color: var(--felt-dark);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 500; }
.small { font-size: 12px; }
.center { text-align: center; }

/* ---------- buttons & inputs ---------- */
.btn {
  font: inherit; font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s, background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #ffd66b, var(--gold) 60%, var(--gold-dark));
  color: #3a2600; border-color: #ffe39a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe08a, #f7cb60 60%, #c99532); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.btn.small { padding: 6px 12px; font-size: 13px; }

input {
  font: inherit; font-size: 16px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--gold); }

/* ---------- lobby ---------- */
.screen { min-height: 100vh; min-height: 100dvh; }
#lobby { display: grid; place-items: center; padding: 24px 16px; }
.lobby-card {
  width: 100%; max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px 28px;
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.logo { display: flex; align-items: center; justify-content: center; gap: 10px; }
.logo .crown { font-size: 44px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.logo h1 {
  margin: 0; font-size: 44px; font-weight: 900; letter-spacing: .06em;
  color: var(--gold); text-shadow: 0 3px 0 #6b4a0e, 0 6px 18px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column; line-height: 1;
}
.logo h1 small { font-size: 14px; letter-spacing: .5em; color: var(--text); text-shadow: none; margin-top: 6px; }
.tagline { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 22px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
#createBtn { margin-top: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 22px 0 4px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; }

/* ---------- room ---------- */
.room-wrap { max-width: 1000px; margin: 0 auto; padding: 20px 16px 40px; }
.room-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.code { font-size: 40px; font-weight: 900; letter-spacing: .25em; color: var(--gold); }
.room-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.room-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.panel h2 { margin: 0 0 12px; font-size: 17px; }
.seat-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.seat-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  min-height: 52px;
}
.seat-list li.empty { border-style: dashed; color: var(--muted); justify-content: space-between; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; font-size: 14px;
  background: var(--gold); color: #3a2600; flex: none;
}
.avatar.cpu { background: #8ab4f8; color: #0c2a55; }
.seat-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: var(--text); white-space: nowrap;
}
.tag.gold { background: var(--gold); color: #3a2600; }
.tag.off { background: #7a2b2b; }
.icon-btn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 18px; padding: 4px 8px; border-radius: 8px;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.1); }
.rule-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.rule {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.rule.on { background: rgba(242, 193, 78, 0.13); border-color: rgba(242, 193, 78, 0.5); }
.rule.readonly { cursor: default; }
.rule .rule-text { flex: 1; min-width: 0; }
.rule b { display: block; font-size: 15px; }
.rule span { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.switch {
  flex: none; width: 42px; height: 24px; border-radius: 999px; margin-top: 2px;
  background: rgba(255,255,255,.2); position: relative; transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.rule.on .switch { background: var(--gold); }
.rule.on .switch::after { transform: translateX(18px); }
.seg { display: flex; gap: 4px; flex: none; margin-top: 2px; }
.seg button {
  font: inherit; font-weight: 700; font-size: 13px;
  min-width: 34px; padding: 4px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
}
.seg button.sel { background: var(--gold); color: #3a2600; border-color: var(--gold); }
.seg button:disabled { cursor: default; }
.seg button:disabled:not(.sel) { opacity: .45; }

/* ---------- cards ---------- */
.card {
  width: var(--cw); height: var(--ch);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0,0,0,.08);
  position: relative;
  flex: none;
  user-select: none;
  font-weight: 900;
}
.card.red { color: var(--red); }
.card .corner {
  position: absolute; top: 5px; left: 6px;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1; font-size: calc(var(--cw) * 0.29);
}
.card .corner i { font-style: normal; font-size: .82em; margin-top: 2px; }
.card .pip {
  position: absolute; right: 7px; bottom: 5px;
  font-size: calc(var(--cw) * 0.5); line-height: 1;
}
.card.joker {
  background: linear-gradient(145deg, #fff8e0, #ffe9a8);
  color: #7a2bb5;
}
.card.joker .corner { font-size: calc(var(--cw) * 0.16); letter-spacing: -.02em; writing-mode: vertical-rl; }
.card.joker .pip { font-size: calc(var(--cw) * 0.52); color: #d4a017; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, #b8323f, #7d1a26);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4), inset 0 0 0 3px #fff;
}

/* ---------- game ---------- */
#game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.game-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(8px * var(--s)) calc(14px * var(--s)); background: rgba(0, 0, 0, .25); border-bottom: 1px solid var(--line);
}
.head-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.head-right { display: flex; gap: 4px; flex: none; }
.round { font-weight: 900; color: var(--gold); white-space: nowrap; font-size: calc(16px * var(--s)); }
.game-head .btn.small { font-size: calc(13px * var(--s)); padding: calc(6px * var(--s)) calc(14px * var(--s)); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: calc(12px * var(--s)); font-weight: 700; padding: calc(3px * var(--s)) calc(10px * var(--s)); border-radius: 999px;
  background: rgba(255,255,255,.14); white-space: nowrap;
}
.timer { font-size: calc(13px * var(--s)); font-weight: 900; padding: calc(3px * var(--s)) calc(10px * var(--s)); border-radius: 999px; background: rgba(0,0,0,.35); font-variant-numeric: tabular-nums; }
.timer.urgent { background: #c0392b; }
.badge.rev { background: #c0392b; animation: pulse 1.6s infinite; }
.badge.back { background: #8e44ad; }
.badge.lock { background: #2471a3; }
@keyframes pulse { 50% { opacity: .65; } }

.table {
  flex: 1; position: relative; min-height: 0;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(0, 2.4fr) minmax(110px, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "left top right" "left center right";
  gap: calc(8px * var(--s)); padding: calc(10px * var(--s)) 14px 0;
  width: 100%; max-width: calc(1500px * var(--s)); margin: 0 auto;
}
.opp[data-pos="left"] { grid-area: left; align-self: center; }
.opp[data-pos="top"] { grid-area: top; justify-self: center; }
.opp[data-pos="right"] { grid-area: right; align-self: center; }
.center { grid-area: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.opp {
  background: rgba(0, 0, 0, .22); border: 2px solid transparent;
  border-radius: 16px; padding: calc(10px * var(--s)) calc(12px * var(--s));
  min-width: calc(150px * var(--s)); max-width: calc(240px * var(--s));
  transition: border-color .2s, box-shadow .2s;
}
.opp:empty { display: none; }
.opp.turn, .me-info.turn { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242, 193, 78, .2), 0 0 24px rgba(242, 193, 78, .35); }
.opp.out { opacity: .6; }
.p-head { display: flex; align-items: center; gap: 8px; }
.opp .p-name, .me-info .p-name { font-size: calc(16px * var(--s)); }
.opp .avatar { width: calc(32px * var(--s)); height: calc(32px * var(--s)); font-size: calc(14px * var(--s)); }
.opp .tag, .me-info .tag, .status { font-size: calc(12px * var(--s)); }
.p-name { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.p-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; font-size: calc(12px * var(--s)); }
.fan { display: flex; margin-top: 8px; height: calc(34px * var(--s)); padding-left: calc(14px * var(--s)); }
.fan .card { --cw: calc(24px * var(--s)); --ch: calc(34px * var(--s)); margin-left: calc(-14px * var(--s)); border-radius: 4px; }
.fan-count { font-size: 22px; font-weight: 900; margin-left: 10px; line-height: 34px; }
.status { font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.35); }
.status.pass { background: #555; }
.status.done { background: var(--gold); color: #3a2600; }
.status.foul { background: #7a2b2b; }

.field {
  position: relative; min-height: calc(var(--ch) + 40px); width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.trick { position: absolute; display: flex; gap: 4px; transition: all .3s; }
.trick.old { opacity: .35; transform: translate(-18px, -14px) scale(.86) rotate(-4deg); filter: grayscale(.3); }
.trick.old.o2 { transform: translate(-34px, -26px) scale(.76) rotate(-8deg); opacity: .2; }
.trick.new { animation: drop .28s ease-out; }
@keyframes drop { from { transform: translateY(-30px) scale(1.1); opacity: 0; } }
.field-empty {
  width: calc(var(--cw) * 2.6); height: var(--ch); border-radius: 12px;
  border: 2px dashed rgba(255,255,255,.2); display: grid; place-items: center;
  color: var(--muted); font-size: calc(13px * var(--s));
}
.field-info { margin-top: 12px; font-size: calc(15px * var(--s)); color: var(--muted); text-align: center; min-height: 20px; }
.field-info b { color: var(--text); }

.me-area {
  width: 100%; max-width: calc(1500px * var(--s)); margin: 0 auto;
  padding: 6px 14px calc(10px + env(safe-area-inset-bottom));
}
.prompt {
  text-align: center; font-weight: 700; font-size: calc(17px * var(--s));
  min-height: 1.5em; margin-bottom: calc(6px * var(--s));
}
.prompt.hot { color: var(--gold); }
/* 左：自分の情報 / 中央：操作ボタン / 右：お知らせ */
.me-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.me-info {
  justify-self: start;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: calc(6px * var(--s)) calc(12px * var(--s)); border-radius: 12px; background: rgba(0,0,0,.22); border: 2px solid transparent;
}
.actions { display: flex; gap: calc(10px * var(--s)); justify-content: center; }
.actions .btn {
  font-size: calc(18px * var(--s)); padding: calc(12px * var(--s)) calc(28px * var(--s));
  min-width: calc(120px * var(--s));
}
.actions .btn.primary { min-width: calc(150px * var(--s)); }
.actions #clearBtn { min-width: 0; font-size: calc(15px * var(--s)); }
.notes { justify-self: end; text-align: right; font-size: calc(12px * var(--s)); color: var(--muted); }
.notes div::before { content: '📩 '; }
.hand {
  display: flex; justify-content: safe center; padding: calc(var(--ch) * 0.24) 8px 6px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.hand .card {
  margin-left: calc(var(--cw) * -0.3);
  cursor: pointer;
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.hand .card:first-child { margin-left: 0; }
.hand .card:hover { transform: translateY(calc(var(--ch) * -0.07)); }
.hand .card.sel { transform: translateY(calc(var(--ch) * -0.2)); box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgba(0,0,0,.45); }
.hand .card.dim { filter: brightness(.62) saturate(.5); }
.hand.wide .card { margin-left: 4px; }

/* ---------- log ---------- */
.log-panel {
  position: fixed; right: 12px; top: 56px; bottom: 12px; width: 300px; z-index: 30;
  background: rgba(10, 30, 20, .95); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#logList { list-style: none; margin: 0; padding: 10px 12px; overflow-y: auto; font-size: 13px; line-height: 1.7; }
#logList li.sys { color: var(--gold); }

/* ---------- overlay / fx / toast ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px);
}
.modal {
  width: 100%; max-width: calc(520px * var(--s)); max-height: 90vh; font-size: calc(16px * var(--s)); overflow-y: auto;
  background: linear-gradient(180deg, #145c3f, #0b3f2b); border: 1px solid rgba(242,193,78,.5);
  border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.modal h2 { margin: 0 0 16px; color: var(--gold); text-align: center; font-size: calc(24px * var(--s)); }
.modal .btn { font-size: calc(16px * var(--s)); padding: calc(10px * var(--s)) calc(20px * var(--s)); }
.result-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.result-table th, .result-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.result-table th { font-size: calc(12px * var(--s)); color: var(--muted); font-weight: 500; }
.result-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.result-table tr.me td { color: var(--gold); }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.rule-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.rule-summary .tag.off { background: rgba(255,255,255,.06); color: var(--muted); text-decoration: line-through; }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; display: grid; place-items: center; }
.fx-text {
  position: absolute; font-size: clamp(40px, 10vw, 96px); font-weight: 900; letter-spacing: .05em;
  color: var(--gold); -webkit-text-stroke: 2px #5b3b00;
  text-shadow: 0 6px 0 #5b3b00, 0 12px 40px rgba(0,0,0,.6);
  animation: fx 1.5s ease-out forwards; white-space: nowrap;
}
.fx-text.bad { color: #ff7a7a; -webkit-text-stroke-color: #4a0b0b; text-shadow: 0 6px 0 #4a0b0b, 0 12px 40px rgba(0,0,0,.6); }
.fx-text.good { color: #9ef0b8; -webkit-text-stroke-color: #0b3a1c; text-shadow: 0 6px 0 #0b3a1c, 0 12px 40px rgba(0,0,0,.6); font-size: clamp(28px, 7vw, 64px); }
@keyframes fx {
  0% { transform: scale(2.2); opacity: 0; }
  15% { transform: scale(1); opacity: 1; }
  75% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1.1) translateY(-30px); opacity: 0; }
}
.toasts { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: #2b2b30; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: toast 2.6s forwards; text-align: center;
}
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .room-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  :root { --cw: 48px; }
  .table {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "left top right" "center center center";
    padding: 8px 8px 0; gap: 6px;
  }
  .opp { min-width: 0; max-width: none; padding: 7px 8px; align-self: start !important; }
  .opp[data-pos="top"] { justify-self: stretch; }
  .p-name { font-size: 13px; }
  .fan { display: none; }
  .p-meta { margin-top: 4px; }
  .code { font-size: 32px; }
  .logo h1 { font-size: 36px; }
  .me-bar { display: flex; gap: 6px; }
  .prompt { font-size: 14px; text-align: left; }
  .actions { margin-left: auto; }
  .actions .btn { padding: 10px 16px; font-size: 16px; min-width: 0; }
  .actions .btn.primary { min-width: 76px; }
  .me-bar { flex-wrap: wrap; }
  .notes { order: 3; flex-basis: 100%; text-align: left; }
  .hand { justify-content: flex-start; padding-top: 24px; }
  .hand .card { margin-left: calc(var(--cw) * -0.5); }
  .hand .card:first-child { margin-left: 0; }
  .log-panel { left: 12px; width: auto; }
}
.rule.select { flex-direction: column; gap: 8px; }
.rule.select .rule-text { width: 100%; }
.result-table th.num { text-align: right; }
@media (max-width: 700px) {
  .opp .avatar { width: 22px; height: 22px; font-size: 11px; }
  .opp .p-head { gap: 5px; }
}

/* 大きい画面（フルHD〜WQHD以上）ではUI全体を拡大 */
@media (min-width: 1600px) and (min-height: 800px) { :root { --s: 1.2; } }
@media (min-width: 2200px) and (min-height: 1150px) { :root { --s: 1.45; } }

/* ================= モード選択 ================= */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-opt {
  font: inherit; color: var(--text); cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px; border-radius: 14px;
  background: rgba(0, 0, 0, .25); border: 2px solid var(--line);
  transition: border-color .15s, background .15s, transform .12s;
}
.mode-opt:hover { background: rgba(255, 255, 255, .08); }
.mode-opt:active { transform: scale(.98); }
.mode-opt .mode-icon { font-size: 26px; line-height: 1.2; }
.mode-opt b { font-size: 15px; }
.mode-opt span:last-child { font-size: 11px; color: var(--muted); }
.mode-opt.sel { border-color: var(--gold); background: rgba(242, 193, 78, .14); }
.mode-opt[data-mode="psychic"].sel { border-color: #b77bff; background: rgba(183, 123, 255, .2); box-shadow: 0 0 18px rgba(183, 123, 255, .45); }

/* ================= 超能力モードのテーマ ================= */
body.psychic {
  --felt: #2a1454;
  --felt-dark: #0b0420;
  --felt-light: #5a2fa0;
  --gold: #6ff3ff;
  --gold-dark: #2a9fd6;
  --panel: rgba(12, 2, 36, .45);
  --line: rgba(190, 160, 255, .22);
  --muted: rgba(230, 220, 255, .66);
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1px 1px at 72% 12%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 38% 72%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 88% 64%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 22% 88%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 58% 38%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(ellipse at 20% 10%, rgba(255, 90, 210, .22), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(80, 220, 255, .18), transparent 50%),
    radial-gradient(ellipse at 50% 35%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%) fixed;
  background-color: var(--felt-dark);
  background-attachment: fixed;
}
body.psychic .btn.primary {
  background: linear-gradient(120deg, #7df9ff, #b77bff 55%, #ff6ad5);
  color: #1a0633; border-color: #e3ccff;
  box-shadow: 0 4px 18px rgba(183, 123, 255, .45);
}
body.psychic .btn.primary:hover:not(:disabled) { background: linear-gradient(120deg, #a4fbff, #c89bff 55%, #ff8ade); }
body.psychic .logo h1 {
  background: linear-gradient(120deg, #7df9ff, #c89bff 50%, #ff6ad5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 3px 10px rgba(183, 123, 255, .6));
}
body.psychic .logo h1 small { -webkit-text-fill-color: var(--text); }
body.psychic .tag.gold, body.psychic .seg button.sel, body.psychic .status.done { background: #6ff3ff; color: #1a0633; border-color: #6ff3ff; }
body.psychic .avatar { background: #c89bff; color: #1a0633; }
body.psychic .rule.on { background: rgba(111, 243, 255, .1); border-color: rgba(111, 243, 255, .45); }
body.psychic .rule.on .switch { background: #6ff3ff; }
body.psychic .opp.turn, body.psychic .me-info.turn {
  border-color: #6ff3ff;
  box-shadow: 0 0 0 4px rgba(111, 243, 255, .18), 0 0 26px rgba(183, 123, 255, .55);
}
body.psychic .card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(111,243,255,.55) 0 18%, transparent 20%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.1) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, #6a2bd0, #2b0e63);
}
body.psychic .modal { background: linear-gradient(180deg, #2c1260, #120530); border-color: rgba(183, 123, 255, .6); }
body.psychic .log-panel { background: rgba(18, 6, 44, .96); }
body.psychic .hand .card.sel { box-shadow: 0 0 0 3px #6ff3ff, 0 0 18px rgba(111, 243, 255, .6); }
body.psychic .fx-text { color: #6ff3ff; -webkit-text-stroke-color: #2b0e63; text-shadow: 0 6px 0 #2b0e63, 0 0 40px rgba(183, 123, 255, .8); }
body.psychic .game-head { background: rgba(8, 0, 26, .45); }

/* ================= 超能力カード ================= */
.tag.psy { background: rgba(183, 123, 255, .3); }
.psy-row {
  display: flex; align-items: center; justify-content: center; gap: calc(8px * var(--s));
  flex-wrap: wrap; margin-top: calc(6px * var(--s));
}
.psy-label { font-size: calc(13px * var(--s)); color: var(--muted); font-weight: 700; }
.psy-card {
  font: inherit; cursor: pointer; color: #fff;
  display: flex; align-items: center; gap: calc(6px * var(--s));
  padding: calc(7px * var(--s)) calc(14px * var(--s)) calc(7px * var(--s)) calc(10px * var(--s));
  border-radius: 12px; border: 2px solid rgba(200, 155, 255, .7);
  background: linear-gradient(135deg, #3a1580, #1c0747);
  box-shadow: 0 0 12px rgba(183, 123, 255, .35);
  transition: transform .12s, box-shadow .15s;
}
.psy-card:hover { transform: translateY(-2px); }
.psy-card.ready { border-color: #6ff3ff; animation: psyglow 1.8s ease-in-out infinite; }
.psy-card.curse { background: linear-gradient(135deg, #3b0a14, #120306); border-color: #c0392b; box-shadow: 0 0 12px rgba(192, 57, 43, .45); }
.psy-card.curse.ready { border-color: #ff5a5a; }
.psy-icon { font-size: calc(22px * var(--s)); line-height: 1; }
.psy-name { font-weight: 900; font-size: calc(15px * var(--s)); }
@keyframes psyglow {
  50% { box-shadow: 0 0 22px rgba(111, 243, 255, .75), 0 0 6px rgba(255, 106, 213, .6); }
}
@media (prefers-reduced-motion: reduce) { .psy-card.ready { animation: none; } }

.psy-dialog { text-align: center; }
.psy-big { font-size: calc(56px * var(--s)); line-height: 1.1; filter: drop-shadow(0 0 16px rgba(183, 123, 255, .8)); }
.psy-dialog h2 { margin: 6px 0 8px; }
.psy-dialog.curse h2 { color: #ff6b6b; }
.psy-desc { margin: 0 0 14px; line-height: 1.6; }
.psy-note { color: #ffd98a; font-size: .92em; }
.target-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 12px; }
.target-btn {
  font: inherit; font-weight: 700; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 18px; border-radius: 12px; min-width: 110px;
  background: rgba(255, 255, 255, .06); border: 2px solid var(--line);
}
.target-btn small { font-weight: 500; color: var(--muted); font-size: .78em; }
.target-btn.sel { border-color: var(--gold); background: rgba(111, 243, 255, .14); }
.psy-rules-h { margin: 14px 0 6px; font-size: 1em; color: var(--gold); }
.psy-rules { margin: 0 0 8px; padding-left: 1.2em; line-height: 1.7; font-size: .9em; }

.fx-text.psy {
  color: #e7c8ff; -webkit-text-stroke: 2px #3a0b6b;
  text-shadow: 0 6px 0 #3a0b6b, 0 0 40px rgba(111, 243, 255, .9);
  font-size: clamp(30px, 7vw, 72px);
}

/* 透視パネル */
.peek-panel {
  position: fixed; left: 50%; top: calc(60px * var(--s)); transform: translateX(-50%); z-index: 45;
  max-width: calc(100vw - 32px);
  background: rgba(18, 6, 44, .94); border: 2px solid #b77bff; border-radius: 16px;
  padding: 10px 14px; box-shadow: 0 0 30px rgba(183, 123, 255, .6);
}
.peek-head { font-weight: 900; margin-bottom: 8px; text-align: center; font-size: calc(14px * var(--s)); }
.peek-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.peek-cards .card { --cw: calc(40px * var(--s)); --ch: calc(57px * var(--s)); border-radius: 5px; }
.peek-cards .card .corner { top: 3px; left: 4px; }
.peek-cards .card .pip { display: none; }

@media (max-width: 700px) {
  .psy-card { padding: 6px 10px; }
  .psy-name { font-size: 13px; }
  .psy-label { flex-basis: 100%; text-align: center; font-size: 12px; }
}

/* ================= 超能力カードの説明 ================= */
.link-btn {
  display: block; margin: 10px auto 0; padding: 4px 8px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  color: var(--gold); background: none; border: none; text-decoration: underline; text-underline-offset: 3px;
}
.psy-guide-intro { margin: 0 0 12px; font-size: .9em; color: var(--muted); line-height: 1.6; }
.psy-guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.psy-tile {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(58, 21, 128, .6), rgba(28, 7, 71, .6));
  border: 1px solid rgba(200, 155, 255, .35);
}
.psy-tile.curse { background: linear-gradient(135deg, rgba(59, 10, 20, .7), rgba(18, 3, 6, .7)); border-color: rgba(192, 57, 43, .5); }
.psy-tile.owned { border-color: #6ff3ff; box-shadow: 0 0 12px rgba(111, 243, 255, .35); }
.psy-tile-icon { font-size: 28px; line-height: 1.1; flex: none; }
.psy-tile b { font-size: 1em; }
.psy-tile p { margin: 3px 0 0; font-size: .86em; line-height: 1.55; color: var(--text); opacity: .9; }
.psy-tile small { display: block; margin-top: 3px; font-size: .75em; }
.owned-tag { font-size: .72em; vertical-align: 2px; }
.room-psy-guide { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.room-psy-guide h2 { font-size: 16px; margin: 0 0 8px; }
.room-psy-guide .psy-guide-grid { grid-template-columns: 1fr; }
.modal .psy-guide { text-align: left; }
.psy-help {
  font: inherit; font-weight: 900; cursor: pointer; color: var(--text);
  width: calc(34px * var(--s)); height: calc(34px * var(--s)); border-radius: 50%;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--line); font-size: calc(15px * var(--s));
}
.psy-help:hover { background: rgba(255, 255, 255, .2); }
body.psychic .modal:has(.psy-guide) { max-width: calc(640px * var(--s)); }
