/* ===== テーマ（見た目の仕上げ）: style.css の上に重ねる ===== */
:root {
  --ink: #070a12; --ink2: #0d1220; --glass: rgba(12, 16, 28, .78); --glass2: rgba(20, 26, 44, .72);
  --gold: #e3c06a; --gold2: #b48a2c; --gold3: #fff1c4; --line: rgba(227, 192, 106, .22); --line2: rgba(227, 192, 106, .45);
  --text: #eef0f6; --muted: #98a0b8; --accent: #f0c75e; --p0: #5cc8ff; --p1: #ff6f6a;
  --cand: #52ffb0; --sel: #ffd257; --danger: #ff4f5a;
  --font: "Zen Kaku Gothic New", "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif;
  --font-title: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
  --font-latin: "Cinzel", "Times New Roman", serif;
}
html, body { background: var(--ink); font-family: var(--font); font-feature-settings: "palt"; letter-spacing: .02em; }
::selection { background: rgba(227, 192, 106, .35); }
* { scrollbar-width: thin; scrollbar-color: rgba(227, 192, 106, .35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: rgba(227, 192, 106, .3); border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }

/* ----- ボタン ----- */
button {
  position: relative; overflow: hidden; color: var(--text); font-weight: 700; letter-spacing: .05em;
  background: linear-gradient(180deg, #2a3350, #182036); border: 1px solid rgba(160, 175, 220, .28);
  border-radius: 8px; padding: 6px 14px; box-shadow: 0 2px 0 rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .12s, box-shadow .2s, filter .2s, background .2s;
}
button:hover { background: linear-gradient(180deg, #34406a, #1d2844); filter: brightness(1.08); box-shadow: 0 0 0 1px rgba(227, 192, 106, .35), 0 4px 14px rgba(0, 0, 0, .5); }
button:active { transform: translateY(1px) scale(.98); }
button::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .22), transparent); transform: skewX(-20deg); transition: left .5s; pointer-events: none; }
button:hover::after { left: 130%; }
button.primary {
  color: #1d1405; text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  background: linear-gradient(180deg, #ffe7a1 0%, #e9be55 45%, #b8862a 100%); border: 1px solid #ffe3a0;
  box-shadow: 0 2px 0 #6b4a10, 0 0 18px rgba(240, 199, 94, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
}
button.primary:hover { background: linear-gradient(180deg, #fff0bf 0%, #f3cb66 45%, #c8952f 100%); box-shadow: 0 2px 0 #6b4a10, 0 0 26px rgba(240, 199, 94, .6); }
button.danger { background: linear-gradient(180deg, #7a2633, #4a1520); border-color: #c4505f; }
button:disabled { filter: grayscale(.7) brightness(.7); }
select, input[type=text], input:not([type]), input[type=number], textarea {
  background: rgba(6, 9, 18, .8); color: var(--text); border: 1px solid rgba(160, 175, 220, .25); border-radius: 7px; padding: 6px 8px; transition: border-color .2s, box-shadow .2s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 192, 106, .18); }
input[type=checkbox], input[type=radio] { accent-color: var(--gold); }

.screen { animation: screen-in .45s ease-out; }
@keyframes screen-in { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }

/* ----- タイトル画面 ----- */
#menu { position: relative; overflow: hidden; background: #05070d; }
#menu .menu-bg { position: absolute; inset: -4%; background: url(../assets/title.jpg) center/cover no-repeat, radial-gradient(circle at 50% 30%, #2a3a5e, #070a12); animation: kenburns 40s ease-in-out infinite alternate; filter: saturate(1.08); }
#menu .menu-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(5, 7, 13, 0) 0%, rgba(5, 7, 13, .35) 55%, rgba(5, 7, 13, .9) 100%), linear-gradient(180deg, rgba(5, 7, 13, .1), rgba(5, 7, 13, .65)); }
#menu canvas.embers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1.5%, -1%); } }
.title-wrap { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 22px; width: min(720px, 94vw); }
.logo { text-align: center; animation: logo-in 1.2s cubic-bezier(.2, .8, .2, 1) both; }
.logo .en { font-family: var(--font-latin); font-weight: 700; letter-spacing: .5em; font-size: 14px; color: var(--gold3); opacity: .85; text-shadow: 0 0 10px rgba(255, 220, 140, .6); margin-left: .5em; }
.logo .jp {
  font-family: var(--font-title); font-size: clamp(30px, 5vw, 70px); line-height: 1.1; white-space: nowrap; margin: 6px 0 4px; letter-spacing: .04em;
  background: linear-gradient(180deg, #fff8dc 0%, #ffe08a 38%, #d79a2a 62%, #fff0b8 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #4a2e06) drop-shadow(0 0 24px rgba(255, 190, 80, .45));
}
.logo .sub { color: #d7dcef; letter-spacing: .4em; font-size: 13px; margin-left: .4em; text-shadow: 0 1px 4px #000; }
.logo .line { width: 280px; height: 1px; margin: 10px auto 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
@keyframes logo-in { from { opacity: 0; transform: translateY(-14px) scale(.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.menu-box {
  position: relative; background: linear-gradient(180deg, rgba(14, 19, 34, .82), rgba(8, 11, 22, .9)); backdrop-filter: blur(10px);
  border: 1px solid var(--line2); border-radius: 16px; padding: 22px 26px 18px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 0 4px rgba(227, 192, 106, .05);
  animation: rise .9s .25s cubic-bezier(.2, .8, .2, 1) both;
}
.menu-box::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(227, 192, 106, .12); border-radius: 12px; pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.menu-box h1 { display: none; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mode-cards input { display: none; }
.mode-card {
  position: relative; cursor: pointer; border-radius: 12px; padding: 14px 10px 12px; text-align: center; border: 1px solid rgba(160, 175, 220, .2);
  background: linear-gradient(180deg, rgba(40, 50, 80, .55), rgba(16, 20, 36, .7)); transition: transform .18s, border-color .2s, box-shadow .2s, background .2s;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--line2); }
.mode-card .ic { font-size: 26px; display: block; margin-bottom: 4px; filter: drop-shadow(0 2px 4px #000); }
.mode-card .t { font-weight: 900; font-size: 15px; letter-spacing: .08em; }
.mode-card .d { font-size: 11px; color: var(--muted); margin-top: 3px; }
.mode-cards input:checked + .mode-card { border-color: var(--gold); background: linear-gradient(180deg, rgba(120, 90, 30, .55), rgba(40, 28, 8, .75)); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(227, 192, 106, .35); }
.mode-cards input:checked + .mode-card .t { color: var(--gold3); }
.menu-grid { grid-template-columns: 150px 1fr; gap: 10px 14px; }
.menu-grid > label { color: #c9cfe2; font-weight: 700; font-size: 13px; }
.menu-buttons { margin-top: 18px; gap: 12px; }
.menu-buttons button { padding: 11px 30px; font-size: 16px; border-radius: 10px; }
.menu-buttons #btn-start { padding: 12px 46px; font-size: 18px; letter-spacing: .2em; }
.menu-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 12px; }
.help { margin-top: 0; }
.help summary { cursor: pointer; }
.help[open] { max-height: 32vh; overflow: auto; }
.snd-toggle { display: flex; gap: 10px; }
.snd-toggle label { cursor: pointer; }

/* ----- 対戦画面 ----- */
#game { grid-template-columns: 300px 1fr 340px; background: var(--ink); }
#board { background: #06080e; }
#board::before { content: ""; position: absolute; inset: 0; background: url(../assets/mat.jpg) center/cover no-repeat; opacity: .75; filter: saturate(.95) brightness(.85); }
#board::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(3, 5, 10, .75) 100%); z-index: 0; }
#board canvas.embers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; opacity: .7; }
#plane { position: relative; z-index: 2; background: linear-gradient(180deg, rgba(10, 14, 30, .45), rgba(10, 14, 30, .05) 30%, rgba(10, 14, 30, .05) 70%, rgba(10, 14, 30, .5)); box-shadow: 0 0 80px rgba(0, 0, 0, .6) inset; }
#game.tilt #plane { transform: rotateX(16deg); }

.row { border-radius: 12px; }
.row.field { background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015)); border: 1px solid rgba(227, 192, 106, .12); box-shadow: inset 0 0 30px rgba(0, 0, 0, .35); }
.row.land { background: linear-gradient(180deg, rgba(150, 110, 40, .1), rgba(90, 60, 20, .06)); border: 1px solid rgba(227, 192, 106, .08); }
.row.hand { background: transparent; }
.row .rlabel { font-family: var(--font); font-weight: 900; letter-spacing: .3em; color: rgba(227, 192, 106, .55); font-size: 10px; text-shadow: 0 1px 2px #000; }

/* カード */
.card { border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .6); transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .2s, filter .2s; }
.card img { border-radius: 6px; }
.row.field .card:hover, .row.land .card:hover { transform: translateY(-4px) scale(1.06); z-index: 5; box-shadow: 0 10px 22px rgba(0, 0, 0, .8), 0 0 0 1px rgba(227, 192, 106, .6); }
.row.hand .card:hover { transform: translateY(-16px) scale(1.25); box-shadow: 0 18px 30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(227, 192, 106, .7); }
.card .back, .fx-ghost .back {
  background: url(../assets/back.jpg) center/cover no-repeat, radial-gradient(circle at 50% 45%, #3a2a6e, #140e2c 70%);
  border: none; box-shadow: inset 0 0 0 2px rgba(227, 192, 106, .75), inset 0 0 0 4px rgba(0, 0, 0, .55), inset 0 0 18px rgba(0, 0, 0, .6);
  color: transparent; font-size: 0; border-radius: 6px;
}
.card.night::after {
  content: "夜"; font-family: var(--font-title); font-size: calc(var(--ch) * .15); color: #fff3c4; align-items: flex-end; padding-bottom: 7%;
  background: url(../assets/night.jpg) center/cover no-repeat, radial-gradient(circle at 30% 25%, #4a4a90, #0d0c26);
  border: none; box-shadow: inset 0 0 0 2px rgba(170, 160, 255, .75), inset 0 0 22px rgba(0, 0, 30, .8);
  text-shadow: 0 0 10px #ffd86b, 0 0 2px #000; border-radius: 6px;
}
.card.sick { filter: saturate(.6) brightness(.85); }
.card.sick::before { content: "待機"; top: -7px; left: -5px; background: linear-gradient(180deg, #6b7290, #3b4058); border: 1px solid rgba(255, 255, 255, .25); font-weight: 700; padding: 0 4px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.card.swift::before, .card.quick::before { position: absolute; top: -7px; left: -5px; z-index: 3; font-size: 9px; font-weight: 700; padding: 0 4px; border-radius: 4px; color: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .35); }
.card.swift::before { content: "駿足"; background: linear-gradient(180deg, #3fcf7f, #1f7f4a); }
.card.quick::before { content: "待機・早業"; background: linear-gradient(180deg, #6b7290, #3b4058); }
.card.quick { filter: saturate(.75) brightness(.92); }
.card.playable { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(240, 199, 94, .8), 0 3px 8px rgba(0, 0, 0, .7); animation: glow-gold 1.6s ease-in-out infinite; }
.card.cand { box-shadow: 0 0 0 3px var(--cand), 0 0 18px var(--cand); animation: glow-cand 1.2s ease-in-out infinite; }
.card.sel { box-shadow: 0 0 0 4px var(--sel), 0 0 22px var(--sel); animation: none; transform: translateY(-4px); }
.card.attacking { box-shadow: 0 0 0 3px #ff4f5a, 0 0 22px rgba(255, 60, 70, .9); }
.card.blocking { box-shadow: 0 0 0 3px #5cc8ff, 0 0 22px rgba(80, 190, 255, .9); }
@keyframes glow-gold { 50% { box-shadow: 0 0 0 2px #fff0b8, 0 0 26px rgba(240, 199, 94, 1), 0 3px 8px rgba(0, 0, 0, .7); } }
@keyframes glow-cand { 50% { box-shadow: 0 0 0 3px #b8ffdd, 0 0 28px var(--cand); } }
.card .pt {
  bottom: -6px; right: -6px; padding: 1px 6px; font-size: 13px; font-weight: 900; border-radius: 7px; letter-spacing: 0;
  background: linear-gradient(180deg, #232a44, #0a0d18); border: 1px solid rgba(227, 192, 106, .7); box-shadow: 0 2px 6px rgba(0, 0, 0, .8); color: #fff;
}
.card .pt .up { color: #6dffa0; } .card .pt .down { color: #ff7b7b; }
.card .dmg { background: radial-gradient(circle at 35% 30%, #ff8a8a, #c0101e); border: 1px solid #ffc0c0; box-shadow: 0 0 10px rgba(255, 40, 60, .8); font-weight: 900; }
.card .kwb span { background: rgba(10, 40, 30, .88); border: 1px solid rgba(110, 255, 180, .35); color: #b5ffd6; font-weight: 700; }
.card .ctrs span { background: linear-gradient(180deg, #8a6bff, #4f33c2); border: 1px solid rgba(255, 255, 255, .3); font-weight: 700; }
.card .eqb { background: linear-gradient(180deg, #ffe08a, #b88a1e); font-weight: 700; }
.token-face { background: radial-gradient(circle at 50% 30%, #3a4f78, #141b30); border: 2px solid rgba(160, 200, 255, .55); color: #e6efff; box-shadow: inset 0 0 14px rgba(0, 0, 0, .6); }

/* プレイヤー欄 */
.pinfo {
  position: relative; gap: 12px; padding: 4px 12px 4px 6px; min-height: 38px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(10, 14, 26, .92), rgba(16, 22, 40, .78) 60%, rgba(10, 14, 26, .5)); border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .05); backdrop-filter: blur(6px);
}
.pinfo .pname { font-size: 15px; font-weight: 900; letter-spacing: .08em; text-shadow: 0 0 10px currentColor; }
.pinfo .life {
  display: inline-flex; align-items: center; justify-content: center; min-width: 50px; height: 30px; padding: 0 10px 0 8px; font-size: 21px; font-weight: 900; border-radius: 15px;
  background: radial-gradient(circle at 30% 30%, #4a1018, #1a0508); border: 1px solid rgba(255, 110, 120, .6); box-shadow: 0 0 12px rgba(255, 60, 80, .35), inset 0 0 8px rgba(0, 0, 0, .7);
  font-variant-numeric: tabular-nums;
}
.pinfo .life::before { content: "❤"; font-size: 14px; margin-right: 5px; color: #ff5d6a; text-shadow: 0 0 6px #ff2d4a; }
.pinfo .zc { font-size: 12px; } .pinfo .zc b { font-size: 14px; }
.pinfo button { padding: 2px 9px; font-size: 11px; border-radius: 6px; }
.pinfo.active-turn { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(227, 192, 106, .5), 0 0 24px rgba(227, 192, 106, .35), 0 6px 18px rgba(0, 0, 0, .5); }
.pinfo .prio { color: var(--gold3); text-shadow: 0 0 10px var(--gold); animation: prio 1.2s ease-in-out infinite; }
@keyframes prio { 50% { opacity: .55; } }

/* 中央の帯 */
#midbar {
  position: relative; z-index: 3; justify-content: center; gap: 4px; min-height: 34px; padding: 4px 12px;
  background: linear-gradient(90deg, transparent, rgba(6, 9, 18, .9) 12%, rgba(6, 9, 18, .9) 88%, transparent);
  border: none; box-shadow: 0 1px 0 rgba(227, 192, 106, .35), 0 -1px 0 rgba(227, 192, 106, .35);
}
#midbar .turn { font-family: var(--font); font-weight: 900; letter-spacing: .1em; margin-right: 10px; color: var(--gold3); text-shadow: 0 0 10px rgba(227, 192, 106, .7); }
#midbar .ph { position: relative; padding: 3px 14px 3px 18px; font-weight: 700; font-size: 12px; color: #7d86a3; background: rgba(255, 255, 255, .04); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); border-radius: 0; }
#midbar .ph.on { color: #1d1405; background: linear-gradient(180deg, #ffe7a1, #d9a83c); box-shadow: none; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
#midbar .combat { margin-left: 12px; color: #ff9b8e; text-shadow: 0 0 8px rgba(255, 80, 60, .6); }

/* 左右のパネル */
#detail, #panel { background: linear-gradient(180deg, rgba(14, 18, 32, .97), rgba(7, 10, 18, .98)); border-color: var(--line); }
#detail { border-right: 1px solid var(--line); box-shadow: 6px 0 24px rgba(0, 0, 0, .5); z-index: 3; }
#panel { border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0, 0, 0, .5); z-index: 3; }
#detail .dhead, .phead { font-family: var(--font-latin); letter-spacing: .3em; font-size: 11px; color: var(--gold); padding: 9px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(227, 192, 106, .1), transparent); }
#detail #preview img { border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(227, 192, 106, .35); animation: pv-in .25s ease-out; }
@keyframes pv-in { from { opacity: .3; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
#preview .ptext .nm { color: var(--gold3); font-weight: 900; text-shadow: 0 0 10px rgba(227, 192, 106, .4); }
#preview .ab { background: rgba(255, 255, 255, .035); border-radius: 7px; }
.pempty { text-align: center; padding-top: 20px !important; line-height: 1.8; }
.pempty::before { content: ""; display: block; width: 62%; aspect-ratio: .716; margin: 10px auto 18px; border-radius: 12px; background: url(../assets/back.jpg) center/cover; opacity: .55; box-shadow: 0 10px 30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(227, 192, 106, .35); }
#topbar { padding: 8px; gap: 10px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .25); }
#topbar label { color: #c3c9dc; cursor: pointer; }
#prompt { background: linear-gradient(180deg, rgba(40, 32, 12, .55), rgba(16, 14, 8, .4)); border-bottom: 1px solid var(--line); padding: 12px; min-height: 92px; }
#prompt:not(.waiting) { box-shadow: inset 3px 0 0 var(--gold); animation: prompt-in .3s ease-out; }
@keyframes prompt-in { from { background-color: rgba(227, 192, 106, .2); } }
#prompt .who { font-weight: 900; letter-spacing: .06em; }
#prompt .ptitle { font-weight: 700; font-size: 14px; }
#prompt .btns button { padding: 7px 14px; }
#prompt.waiting .ptitle { color: var(--muted); }
#prompt.waiting .ptitle { animation: prio 1.6s ease-in-out infinite; }
#pile { border-bottom: 1px solid var(--line); }
#pile .item { background: linear-gradient(90deg, rgba(40, 48, 78, .7), rgba(20, 24, 40, .5)); border-radius: 8px; border-left-width: 4px; animation: pv-in .25s ease-out; }
#log { font-size: 12px; }
#log .l { border-bottom: 1px solid rgba(255, 255, 255, .04); padding: 1px 0; }
#log .turn { color: var(--gold3); font-weight: 900; margin-top: 10px; padding: 3px 6px; border-radius: 5px; background: linear-gradient(90deg, rgba(227, 192, 106, .15), transparent); }

/* モーダル・メニュー */
#modal { background: rgba(2, 3, 8, .72); backdrop-filter: blur(4px); animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.mbox { background: linear-gradient(180deg, rgba(20, 26, 44, .97), rgba(9, 12, 22, .98)); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .8); animation: pop-in .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(10px); } }
.mbox h3 { color: var(--gold3); font-weight: 900; letter-spacing: .05em; }
.mgrid .mc { transition: transform .15s; } .mgrid .mc:hover { transform: translateY(-4px); }
.mgrid .mc img { border-radius: 8px; box-shadow: 0 6px 14px rgba(0, 0, 0, .7); }
#ctxmenu { background: linear-gradient(180deg, rgba(22, 28, 48, .98), rgba(10, 13, 24, .98)); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, .8); }
#ctxmenu .mi:hover { background: rgba(227, 192, 106, .14); }
#toast { background: linear-gradient(180deg, rgba(20, 24, 40, .95), rgba(8, 10, 20, .95)); border: 1px solid var(--gold); border-radius: 12px; box-shadow: 0 0 30px rgba(227, 192, 106, .35); font-weight: 700; }

/* クリックで詳細を表示中のカード */
.card.inspect { outline: 2px solid #9be7ff; outline-offset: 2px; }
/* ダイアログの詳細欄 */
.mbox.wide { width: min(1240px, 97vw); }
.mbody { display: grid; grid-template-columns: 1fr 300px; gap: 12px; min-height: 0; flex: 1; overflow: hidden; }
.mbody .mgrid { align-content: flex-start; }
.mdetail { overflow: auto; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 12px; line-height: 1.5; }
.mdetail img { width: 100%; max-width: 230px; align-self: center; border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, .8); animation: pv-in .2s ease-out; }
.mdetail .ptext { white-space: pre-wrap; }
.mdetail .nm { color: var(--gold3); font-weight: 900; font-size: 15px; white-space: normal; }
.mdetail .meta { color: var(--muted); white-space: normal; }
.mdetail .ab { margin-top: 5px; padding: 4px 6px; border-radius: 6px; background: rgba(255, 255, 255, .04); border-left: 3px solid #666; white-space: pre-wrap; }
.mdetail .ab.auto { border-left-color: #3ccf7a; } .mdetail .ab.man { border-left-color: #f0b43c; }
.mdetail .abtag { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; margin-right: 5px; color: #111; }
.mdetail .ab.auto .abtag { background: #3ccf7a; } .mdetail .ab.man .abtag { background: #f0b43c; }
.mdetail .kwline { color: #bfffd8; } .mdetail .pempty { padding-top: 30px !important; }
.mdetail .pempty::before { display: none; }
.mgrid .mc { position: relative; }
.mgrid .mc .mz { position: absolute; top: 4px; right: 4px; z-index: 3; padding: 0 5px; font-size: 12px; line-height: 20px; border-radius: 6px; opacity: .85; }
.mgrid .mc.look img { outline: 2px solid #9be7ff; outline-offset: 2px; }
#ctxmenu .mi.cancel { color: var(--muted); }
@media (max-width: 900px) { .mbody { grid-template-columns: 1fr; } .mdetail { max-height: 30vh; } }

/* コピー表示 */
.card .cpb { position: absolute; left: -4px; right: -4px; bottom: 30%; text-align: center; font-size: 9px; font-weight: 900; color: #e9f6ff; background: linear-gradient(90deg, rgba(40, 120, 200, .2), rgba(30, 100, 190, .95), rgba(40, 120, 200, .2)); border-top: 1px solid rgba(150, 210, 255, .6); border-bottom: 1px solid rgba(150, 210, 255, .6); z-index: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.copybox { margin-top: 10px; padding: 8px; border-radius: 10px; border: 1px solid rgba(120, 190, 255, .45); background: linear-gradient(180deg, rgba(30, 70, 130, .3), rgba(10, 20, 40, .3)); }
.copybox .cph { color: #bfe3ff; margin-bottom: 6px; } .copybox .cph b { color: #fff; } .copybox .cph small { color: #8fb3d6; display: block; }
.copybox .cpimg { width: 46% !important; max-width: 140px; display: block; margin: 4px 0 6px; border-radius: 8px !important; }

/* 結果画面 */
.mbox.result { width: min(560px, 94vw); align-items: center; text-align: center; padding: 26px 28px 20px; gap: 6px; overflow: hidden; position: relative; }
.mbox.result::before { content: ""; position: absolute; inset: -50%; background: conic-gradient(from 0deg, transparent, rgba(255, 210, 120, .12), transparent 25%, rgba(255, 210, 120, .1), transparent 50%, rgba(255, 210, 120, .12), transparent 75%); animation: spin 18s linear infinite; pointer-events: none; }
.mbox.result.lose::before { background: conic-gradient(from 0deg, transparent, rgba(120, 140, 200, .1), transparent 30%, rgba(120, 140, 200, .08), transparent 60%); }
.mbox.result > * { position: relative; }
.rs-big { font-family: var(--font-latin); font-weight: 700; font-size: 54px; letter-spacing: .14em; line-height: 1; background: linear-gradient(180deg, #fffbe6, #ffd76a 45%, #b07a12 70%, #fff0b0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #4a2e06) drop-shadow(0 0 18px rgba(255, 200, 80, .6)); }
.mbox.result.lose .rs-big { background: linear-gradient(180deg, #e8eefc, #8d9ab8 60%, #4c5878); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 3px 0 #10141f); }
.rs-turn { font-family: var(--font-latin); letter-spacing: .4em; color: var(--muted); font-size: 12px; }
.rs-ps { display: flex; align-items: stretch; gap: 12px; margin: 10px 0 8px; width: 100%; }
.rs-p { flex: 1; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); }
.rs-p.won { border-color: var(--gold); box-shadow: 0 0 20px rgba(227, 192, 106, .3); background: rgba(227, 192, 106, .08); }
.rs-n { font-weight: 900; } .rs-p.p0 .rs-n { color: var(--p0); } .rs-p.p1 .rs-n { color: var(--p1); }
.rs-l { font-family: var(--font-title); font-size: 34px; color: #fff; } .rs-l::before { content: "❤ "; font-size: 18px; color: #ff5d6a; }
.rs-s { font-size: 11px; color: var(--muted); }
.rs-vs { align-self: center; font-family: var(--font-latin); color: var(--gold); font-weight: 700; }
.mbox.result .mbtns { justify-content: center; margin-top: 6px; }
.mbox.result .mbtns button { padding: 9px 18px; }

/* デッキ構築 */
#builder { display: grid; grid-template-columns: 1fr 1fr; background: var(--ink); height: 100vh; }
.bd-deck { display: flex; flex-direction: column; min-height: 0; background: linear-gradient(180deg, rgba(16, 20, 36, .98), rgba(7, 10, 18, .99)); border-right: 1px solid var(--line2); box-shadow: 8px 0 30px rgba(0, 0, 0, .5); z-index: 2; }
.bd-top { display: flex; gap: 8px; padding: 10px 12px 6px; align-items: center; }
.bd-top #b-name { flex: 1; font-size: 16px; font-weight: 900; padding: 7px 10px; }
.bd-top #b-load { max-width: 34%; }
.bd-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; align-items: center; border-bottom: 1px solid var(--line); }
.bd-actions button { padding: 5px 10px; font-size: 12px; }
.bd-view { margin-left: auto; display: flex; gap: 8px; font-size: 12px; color: #c3c9dc; }
.bd-stats { display: flex; gap: 14px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.st-curve { display: flex; align-items: flex-end; gap: 4px; height: 64px; padding-top: 4px; }
.st-curve .bar { position: relative; width: 22px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.st-curve .bar span { display: block; width: 100%; background: linear-gradient(180deg, #ffe08a, #b88a1e); border-radius: 3px 3px 0 0; min-height: 2px; box-shadow: 0 0 8px rgba(227, 192, 106, .35); }
.st-curve .bar b { position: absolute; top: -2px; font-size: 10px; color: #fff; }
.st-curve .bar i { font-style: normal; font-size: 10px; color: var(--muted); margin-top: 2px; }
.st-info { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #c3c9dc; justify-content: center; }
.st-info .tg { display: inline-block; margin-right: 5px; padding: 1px 7px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.st-col .c { display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 9px; font-weight: 700; color: #111; }
.c.cP, .f-colors .cP { --cc: #f2e6a6; } .c.cM, .f-colors .cM { --cc: #ff9a7a; } .c.cW, .f-colors .cW { --cc: #7ac8ff; } .c.cF, .f-colors .cF { --cc: #7ee08f; } .c.cN, .f-colors .cN { --cc: #b9a8ff; } .c.cA, .f-colors .cA { --cc: #cfd3dc; }
.st-col .c { background: var(--cc); }
#b-errors { padding: 6px 12px; font-size: 12px; color: #ffb36b; border-bottom: 1px solid var(--line); }
#b-errors .ok { color: #7fe0a0; font-weight: 700; }
#b-list { flex: 1; overflow: auto; padding: 6px 12px 12px; }
.bd-sec { margin-bottom: 10px; }
.bd-h { position: sticky; top: -6px; z-index: 3; padding: 6px 4px; color: var(--gold3); font-weight: 900; letter-spacing: .08em; background: linear-gradient(180deg, rgba(16, 20, 36, 1) 70%, rgba(16, 20, 36, 0)); }
.bd-h b { font-size: 18px; }
.bd-type { margin: 8px 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.bd-empty { color: var(--muted); font-size: 12px; padding: 8px 4px; }
.bd-cards.img { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.dc { position: relative; cursor: pointer; border-radius: 7px; transition: transform .15s; }
.dc img { width: 100%; display: block; border-radius: 7px; box-shadow: 0 4px 10px rgba(0, 0, 0, .7); }
.dc:hover { transform: translateY(-3px); }
.dc .n { position: absolute; right: 3px; bottom: 3px; background: linear-gradient(180deg, #ffe7a1, #c8952f); color: #1d1405; font-weight: 900; font-size: 13px; padding: 0 6px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, .7); }
.dc .pm { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; opacity: 0; transition: opacity .15s; padding: 3px; }
.dc:hover .pm { opacity: 1; }
.dc .pm button { padding: 0 7px; font-size: 13px; line-height: 20px; border-radius: 6px; }
.dc.sel img, .bc.sel img { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(227, 192, 106, .7); }
.bd-cards.list .dl { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.bd-cards.list .dl:hover, .bd-cards.list .dl.sel { background: rgba(227, 192, 106, .1); }
.dl .cnt { width: 22px; text-align: right; font-weight: 900; color: var(--gold3); }
.dl .cost { width: 20px; height: 20px; border-radius: 50%; background: #222a44; text-align: center; line-height: 20px; font-size: 11px; font-weight: 700; }
.dl .nm { flex: 1; } .dl .cs { color: var(--muted); font-size: 11px; }
.dl button { padding: 0 7px; font-size: 12px; }
#b-preview { flex: none; height: 30vh; min-height: 190px; display: flex; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line2); background: linear-gradient(180deg, rgba(30, 26, 12, .35), rgba(8, 10, 18, .9)); overflow: hidden; }
#b-preview { max-height: none; }
#b-preview img { width: auto; height: 100%; aspect-ratio: .716; border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, .8), 0 0 0 1px rgba(227, 192, 106, .35); flex: none; animation: pv-in .25s ease-out; }
#b-preview .ptext { flex: 1; overflow: auto; font-size: 12px; line-height: 1.55; }
#b-preview .nm { color: var(--gold3); font-weight: 900; font-size: 15px; }
#b-preview .meta { color: var(--muted); margin-bottom: 4px; }
#b-preview .ab { margin-top: 5px; padding: 4px 6px; border-radius: 6px; background: rgba(255, 255, 255, .04); border-left: 3px solid #666; white-space: pre-wrap; }
#b-preview .ab.auto { border-left-color: #3ccf7a; } #b-preview .ab.man { border-left-color: #f0b43c; }
#b-preview .abtag { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; margin-right: 5px; color: #111; }
#b-preview .ab.auto .abtag { background: #3ccf7a; } #b-preview .ab.man .abtag { background: #f0b43c; }
#b-preview .kwline { color: #bfffd8; margin-top: 4px; }
.bp-btns { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.bp-empty { color: var(--muted); margin: auto; }
.bd-pool { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.bd-pool .b-filter { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 12px; background: linear-gradient(180deg, rgba(14, 18, 32, .97), rgba(7, 10, 18, .98)); border-bottom: 1px solid var(--line); }
.bd-pool .b-filter #f-text { flex: 1; min-width: 180px; }
.f-colors { display: flex; gap: 3px; }
.f-colors label { cursor: pointer; padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .15); font-weight: 700; font-size: 12px; color: var(--cc); }
.f-colors label:has(input:checked) { background: var(--cc); color: #111; }
.f-colors input { display: none; }
.f-auto { font-size: 12px; color: #c3c9dc; cursor: pointer; }
#f-count { color: var(--muted); font-size: 12px; margin-left: auto; }
.bd-help { padding: 4px 12px; font-size: 11px; color: var(--muted); background: rgba(0, 0, 0, .25); }
#b-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 12px; align-content: start; background: radial-gradient(ellipse at 50% 0%, #1a2240, #070a12 70%); }
#b-grid .bc { width: auto; position: relative; cursor: pointer; transition: transform .15s, filter .2s; }
#b-grid .bc img { width: 100%; display: block; border-radius: 8px; box-shadow: 0 6px 14px rgba(0, 0, 0, .7); }
#b-grid .bc:hover { transform: translateY(-4px) scale(1.04); z-index: 2; }
#b-grid .bc.in img { box-shadow: 0 0 0 2px rgba(227, 192, 106, .7), 0 6px 14px rgba(0, 0, 0, .7); }
#b-grid .bc .n { position: absolute; top: 4px; right: 4px; background: linear-gradient(180deg, #ffe7a1, #c8952f); color: #1d1405; font-weight: 900; border-radius: 10px; padding: 0 7px; box-shadow: 0 2px 6px rgba(0, 0, 0, .7); }
#b-grid .bc .auto.part { position: absolute; bottom: 4px; left: 4px; background: #a07a1e; color: #fff; font-size: 10px; border-radius: 3px; padding: 0 4px; }
#b-grid .bc.banned { filter: grayscale(1) brightness(.6); }
#b-grid .bc .ban { position: absolute; top: 40%; left: 0; right: 0; text-align: center; background: rgba(160, 20, 30, .9); color: #fff; font-weight: 900; }

/* ===== 演出の仕上げ ===== */
.fx-banner { min-width: 560px; padding: 18px 80px; border: none; background: linear-gradient(90deg, transparent, rgba(4, 6, 14, .92) 18%, rgba(4, 6, 14, .92) 82%, transparent); }
.fx-banner::before, .fx-banner::after { content: ""; position: absolute; left: 10%; right: 10%; height: 2px; background: linear-gradient(90deg, transparent, currentColor, transparent); }
.fx-banner::before { top: 0; } .fx-banner::after { bottom: 0; }
.fx-banner.p0 { color: var(--p0); } .fx-banner.p1 { color: var(--p1); }
.fx-banner .bm { font-family: var(--font-title); font-size: 42px; font-weight: 400; letter-spacing: .18em; color: #fff; }
.fx-banner.p0 .bm { text-shadow: 0 0 22px var(--p0), 0 0 4px var(--p0), 0 3px 0 #0a2a44; }
.fx-banner.p1 .bm { text-shadow: 0 0 22px var(--p1), 0 0 4px var(--p1), 0 3px 0 #44100e; }
.fx-banner .bs { font-family: var(--font-latin); color: var(--gold3); letter-spacing: .6em; font-size: 15px; margin-top: 4px; }
.fx-phase { font-family: var(--font); font-weight: 900; color: #1d1405; background: linear-gradient(180deg, #ffeab0, #d9a83c); border-radius: 3px; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); padding: 5px 34px; box-shadow: none; filter: drop-shadow(0 0 12px rgba(240, 199, 94, .8)); }
.fx-ghost.cast { box-shadow: 0 0 0 2px #ffe8a8, 0 0 50px rgba(255, 200, 90, .85), 0 30px 60px rgba(0, 0, 0, .9); border-radius: 12px; }
.fx-ghost.cast::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(255, 220, 140, .35), transparent 30%, rgba(255, 220, 140, .25), transparent 60%, rgba(255, 220, 140, .35), transparent); border-radius: 50%; animation: spin 3s linear infinite; z-index: -1; filter: blur(6px); }
.fx-ghost.cast::after { content: ""; position: absolute; inset: 0; border-radius: 12px; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 45%, transparent 60%); background-size: 250% 100%; animation: sheen 1.1s ease-out .15s both; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheen { from { background-position: 130% 0; } to { background-position: -60% 0; } }
.fx-castlabel { font-family: var(--font); font-weight: 900; background: linear-gradient(180deg, rgba(14, 18, 32, .95), rgba(6, 8, 16, .95)); border: 1px solid var(--gold); padding: 4px 16px; bottom: -36px; box-shadow: 0 6px 16px rgba(0, 0, 0, .7); }
.fx-float { font-family: var(--font-title); font-weight: 400; -webkit-text-stroke: 1px rgba(0, 0, 0, .7); }
.fx-float.big { font-size: 44px; }
.fx-stamp { font-family: var(--font-title); font-weight: 400; color: #9be7ff; border: 3px solid #9be7ff; background: rgba(4, 14, 30, .75); box-shadow: 0 0 30px rgba(80, 200, 255, .6); }
.fx-end { font-family: var(--font-latin); font-weight: 700; font-size: 110px; letter-spacing: .12em; }
.fx-end.win { background: linear-gradient(180deg, #fffbe6, #ffd76a 45%, #b07a12 70%, #fff0b0); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 4px 0 #4a2e06) drop-shadow(0 0 30px rgba(255, 200, 80, .8)); }
.fx-end.lose { color: #aab4cc; text-shadow: 0 0 40px #24304c, 0 4px 0 #0a0d18; }
.fx-flash { position: fixed; inset: 0; pointer-events: none; }
.fx-shock { position: fixed; width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 0 30px rgba(255, 255, 255, .7), inset 0 0 20px rgba(255, 255, 255, .5); pointer-events: none; }
.fx-slash { position: fixed; height: 5px; margin-top: -2px; transform-origin: 50% 50%; border-radius: 3px; background: linear-gradient(90deg, transparent, #fff 40%, #ffd0a0 60%, transparent); box-shadow: 0 0 16px #ff8a4a, 0 0 4px #fff; pointer-events: none; }
.fx-orb { position: fixed; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #fff, rgba(255, 220, 140, .9) 40%, rgba(255, 180, 60, 0) 70%); box-shadow: 0 0 18px #ffcf6a; }
.fx-vignette { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 140px rgba(255, 30, 40, .55); }

/* 設定のパネル（右上） */
.opt-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.vol { display: inline-flex; align-items: center; gap: 4px; }
.vol input[type=range] { width: 70px; accent-color: var(--gold); }

@media (max-width: 1250px) { #game { grid-template-columns: 230px 1fr 280px; } }
@media (max-width: 950px) { #game { grid-template-columns: 160px 1fr 230px; } .mode-cards .d { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* アプリとしてインストール */
#btn-install { background: linear-gradient(180deg, #2b4a7a, #1b3157); border-color: #5b86c7; }
.install-guide { width: min(480px, 94vw); }
.install-guide p { margin: 0; color: #c9d6cf; line-height: 1.6; }
.install-guide ol { margin: 4px 0 6px; padding-left: 1.4em; line-height: 1.8; }

/* 【対応】ボタン（右下） */
.respond-btn { position: fixed; right: 14px; bottom: 14px; z-index: 40; min-width: 92px; padding: 6px 14px 8px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; line-height: 1.15;
  background: linear-gradient(180deg, #2a3350, #161c30); border: 1px solid #6b7fb6; color: #e8ecff; box-shadow: 0 6px 18px rgba(0,0,0,.45); cursor: pointer; }
.respond-btn small { font-size: 11px; letter-spacing: .3em; color: #aab6dc; }
.respond-btn b { font-size: 17px; }
.respond-btn[data-mode="all"] { border-color: #f2c14e; box-shadow: 0 0 14px rgba(242,193,78,.45); }
.respond-btn[data-mode="all"] b { color: #f2c14e; }
.respond-btn[data-mode="off"] { opacity: .8; border-color: #555; }
.respond-btn[data-mode="off"] b { color: #9aa; }
#game.hidden ~ .respond-btn, .screen.hidden .respond-btn { display: none; }

/* 先攻・後攻の演出 */
.fx-first { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; background: radial-gradient(ellipse at center, rgba(10,14,28,.85), rgba(2,3,8,.95)); perspective: 900px; }
.ff-title { font-size: 20px; letter-spacing: .25em; color: #cfd8f5; }
.ff-coin { position: relative; width: 220px; height: 220px; transform-style: preserve-3d; }
.ff-face { position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; font: 900 22px 'Zen Kaku Gothic New', sans-serif; backface-visibility: hidden; border: 6px solid #f2c14e; box-shadow: 0 0 40px rgba(242,193,78,.5), inset 0 0 30px rgba(0,0,0,.4); }
.ff-face.p0 { background: radial-gradient(circle at 35% 30%, #3f7fd9, #173763); }
.ff-face.p1 { background: radial-gradient(circle at 35% 30%, #d9573f, #631d17); }
.ff-b { transform: rotateY(180deg); }
.ff-res { font: 900 30px 'Dela Gothic One', sans-serif; color: #f2c14e; opacity: 0; transform: scale(.6); transition: all .35s cubic-bezier(.2,1.4,.4,1); text-shadow: 0 0 18px rgba(242,193,78,.6); }
.ff-res.on { opacity: 1; transform: scale(1); }
@media (max-width: 760px) { .respond-btn { right: 8px; bottom: 8px; min-width: 76px; } .ff-coin { width: 170px; height: 170px; } }

/* ===== オンライン ===== */
.mode-cards { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
.mode-cards .mode-card .d:empty { display: none; }
.mode-cards .mc-online .mode-card { background: linear-gradient(180deg, rgba(40, 80, 140, .6), rgba(14, 24, 50, .8)); }
.mode-cards label:not(.mc-online) .mode-card .t { font-size: 13px; }
.mode-cards label:not(.mc-online) .mode-card .d { color: #8a90a8; font-size: 10px; letter-spacing: .2em; }
.menu-grid input#opw { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #3c4766; background: #0d1222; color: #eef; font-size: 14px; }
.menu-buttons { flex-wrap: wrap; }
.menu-buttons #btn-random, .menu-buttons #btn-pw { padding: 12px 26px; font-size: 17px; letter-spacing: .08em; }
.acct-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: rgba(10, 14, 28, .7); border: 1px solid rgba(160, 175, 220, .18); font-size: 13px; color: #c9cfe2; }
.acct-bar .ac-name b { color: var(--gold3); font-size: 15px; }
.acct-bar .ac-rate b { color: #9be7ff; }
.acct-bar .ac-guest { flex: 1; color: var(--muted); }
.acct-bar .ac-btn { margin-left: auto; padding: 5px 14px; font-size: 13px; }
.acct-bar .ac-btn + .ac-btn { margin-left: 0; }
.auth-box { width: min(460px, 94vw); }
.auth-box .mform input { padding: 8px 10px; border-radius: 8px; border: 1px solid #3c4766; background: #0d1222; color: #eef; font-size: 15px; }
.au-msg { min-height: 1.4em; font-size: 12px; color: #9fb3c6; }
.au-msg.err { color: #ff8a7a; }
.ac-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.ac-stats div { background: rgba(255,255,255,.04); border-radius: 8px; padding: 8px 2px; }
.ac-stats b { display: block; font-size: 20px; color: var(--gold3); }
.ac-stats small { color: var(--muted); font-size: 11px; }
.wait-box { width: min(420px, 92vw); align-items: center; text-align: center; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--gold); animation: spin 1s linear infinite; margin: 6px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.hist-box { width: min(1000px, 96vw); }
.tbl-wrap { overflow: auto; max-height: 64vh; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: #151b30; color: #aeb7d4; text-align: left; padding: 6px 8px; font-weight: 700; }
.tbl td { padding: 6px 8px; border-top: 1px solid rgba(255,255,255,.06); }
.tbl tr.me td { background: rgba(227,192,106,.12); }
.tbl button { padding: 3px 10px; font-size: 12px; }
.r-w { color: #7dff9a; font-weight: 900; } .r-l { color: #ff8a7a; font-weight: 900; } .r-d { color: #ddd; } .r-p { color: #f2c14e; }
.tbl td small { margin-left: 4px; color: #9be7ff; }
.online-bar { padding: 8px 10px; border-bottom: 1px solid var(--line2, #333); background: rgba(12, 18, 36, .8); font-size: 12px; display: flex; flex-direction: column; gap: 5px; }
.ob-vs { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 14px; }
.ob-vs small { color: #9be7ff; font-weight: 700; }
.ob-x { color: var(--gold); font-size: 11px; }
.ob-info { color: #aeb7d4; }
.ob-info .warn { color: #ff8a7a; }
.ob-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ob-btns button { padding: 3px 10px; font-size: 12px; }
.ob-btns button.on { border-color: var(--gold); color: var(--gold3); }
.cdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.cdot.on { background: #4ade80; box-shadow: 0 0 6px #4ade80; } .cdot.off { background: #ef4444; }
.stamp-bubble { position: absolute; z-index: 30; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 18px; background: #fffbe8; color: #222; font-weight: 900; font-size: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.5); animation: stampPop 3.2s ease both; pointer-events: none; white-space: nowrap; }
.side { position: relative; }
.stamp-bubble.opp { top: 8px; } .stamp-bubble.me { bottom: 8px; }
@keyframes stampPop { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 8% { opacity: 1; transform: translateX(-50%) scale(1.06); } 14% { transform: translateX(-50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
#log .l.chat { color: #fff3b0; }
@media (max-width: 760px) {
  .mode-cards { grid-template-columns: 1fr 1fr 1fr; }
  .mode-cards .mc-online { grid-column: 1 / -1; }
  .ac-stats { grid-template-columns: repeat(3, 1fr); }
}
.deckimg-wrap { overflow: auto; max-height: 66vh; text-align: center; }
.deckimg-wrap img { max-width: 100%; border-radius: 8px; }
a.btnlike { display: inline-block; padding: 8px 18px; border-radius: 8px; text-decoration: none; color: #1a1205; background: linear-gradient(180deg, #f5d98a, #c99a3a); font-weight: 900; }

/* ===== デッキ選択（タブ） ===== */
.dpick { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 12px; border-radius: 8px; font-size: 14px; background: #0d1222; border: 1px solid #3c4766; color: #eef; cursor: pointer; }
.dpick:hover { border-color: var(--gold); }
.dp-tag { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 6px; background: rgba(227,192,106,.18); color: var(--gold3); }
.dp-arrow { margin-left: auto; color: var(--muted); font-size: 11px; }
.dp-bad { color: #ff8a7a; font-size: 12px; margin-left: 4px; }
.dp-box { width: min(640px, 96vw); }
.dp-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.dp-tabs button { padding: 6px 14px; border-radius: 8px 8px 0 0; }
.dp-tabs button small { margin-left: 6px; color: var(--muted); }
.dp-tabs button.on { border-color: var(--gold); color: var(--gold3); background: rgba(227,192,106,.12); }
.dp-list { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(227,192,106,.3); padding-top: 6px; }
.dp-row { padding: 8px 12px; border-radius: 8px; cursor: pointer; background: rgba(255,255,255,.03); border: 1px solid transparent; }
.dp-row:hover { border-color: var(--line2); background: rgba(255,255,255,.07); }
.dp-row.on { border-color: var(--gold); background: rgba(227,192,106,.12); }
.dp-n { font-weight: 900; font-size: 14px; }
.dp-s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dp-c { display: inline-block; min-width: 2.5em; margin-right: 8px; color: #9be7ff; font-weight: 700; }

/* カウント */
#counts { padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12px; }
#counts .ph { color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.ct-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 2px 0; }
.ct-who { font-weight: 900; margin-right: 4px; min-width: 4em; }
.ct-row.p0 .ct-who { color: #8ab8ff; } .ct-row.p1 .ct-who { color: #ff9a8a; }
.ct { padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,.07); white-space: nowrap; }
.ct b { color: var(--gold3); }
.ct.mem { background: rgba(155,231,255,.12); }
.ct-none { color: var(--muted); }

/* 予備デッキ */
.bd-target { display: inline-flex; gap: 8px; align-items: center; padding: 3px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); font-size: 12px; }
.bd-target b { color: var(--muted); font-weight: 700; }
.bd-target.to-reserve { border-color: #9be7ff; background: rgba(155,231,255,.1); }
.bd-sec.reserve .bd-h { color: #9be7ff; }
.bd-sec.reserve .bd-h small { color: var(--muted); font-weight: 400; font-size: 11px; }

/* デッキ調整 */
.aj-box { width: min(1100px, 97vw); }
.aj-body { overflow: auto; max-height: 70vh; display: flex; flex-direction: column; gap: 8px; }
.aj-h { font-weight: 900; font-size: 13px; color: var(--gold3); margin-bottom: 4px; }
.aj-sec.res .aj-h { color: #9be7ff; }
.aj-row, .aj-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.aj-c { position: relative; width: 74px; font-size: 10px; text-align: center; cursor: default; }
.aj-grid .aj-c { cursor: pointer; }
.aj-c img { width: 74px; border-radius: 4px; display: block; }
.aj-c span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #c9cfe2; }
.aj-c b { position: absolute; right: 2px; top: 2px; background: rgba(0,0,0,.75); color: #fff; font-size: 11px; padding: 0 4px; border-radius: 6px; }
.aj-c.sel img { outline: 3px solid var(--gold); box-shadow: 0 0 12px rgba(227,192,106,.7); }
.aj-grid .aj-c:hover img { filter: brightness(1.2); }
.aj-hint { padding: 6px 10px; border-radius: 8px; background: rgba(227,192,106,.1); color: #f5e3b0; font-size: 13px; }

/* 非公式の注意書き */
.fan-note { position: relative; z-index: 2; max-width: 760px; margin: 14px auto 10px; padding: 8px 14px; font-size: 11px; line-height: 1.6; color: #b7bfd8; text-align: center; background: rgba(5, 7, 13, .6); border-radius: 8px; }
.fan-note b { color: #f5d98a; }
#menu { flex-direction: column; }
.logo .jp { letter-spacing: .14em; }
@media (max-width: 760px) { .fan-note { margin: 10px 10px 16px; } }

/* トップページ: 画面に収める（収まらないときは縦にスクロール） */
#menu { overflow-x: hidden; overflow-y: auto; justify-content: safe center; padding: 12px 0; }
#menu .menu-bg, #menu .menu-shade, #menu canvas.embers { position: fixed; }
.title-wrap { gap: 12px; flex: none; }
.logo .jp { font-size: clamp(30px, 4.6vh, 64px); margin: 2px 0; }
.logo .en { font-size: 12px; }
.menu-box { padding: 16px 22px 14px; }
.mode-cards { margin-bottom: 10px; }
.mode-card { padding: 9px 8px 8px; }
.mode-card .ic { font-size: 20px; margin-bottom: 2px; }
.menu-grid { gap: 7px 14px; }
.menu-buttons { margin-top: 12px; }
.fan-note { flex: none; margin: 10px auto 4px; }
@media (max-height: 760px) { .logo .en, .logo .sub { display: none; } .acct-bar { margin-bottom: 8px; padding: 6px 10px; } }
#menu .menu-bg { inset: 0; transform-origin: 50% 50%; }

/* ログのカード */
#log .lc { display: inline-flex; align-items: center; gap: 3px; padding: 0 4px 0 1px; margin: 1px 1px; border-radius: 4px; background: rgba(227,192,106,.12); color: #ffe7a8; cursor: pointer; vertical-align: middle; white-space: nowrap; }
#log .lc:hover { background: rgba(227,192,106,.3); }
#log .lc img { height: 30px; width: auto; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.6); }

/* 選べないカード */
.mgrid .mc.off { cursor: default; }
.mgrid .mc.off img, .mgrid .mc.off .token-face { filter: grayscale(.85) brightness(.4); }
.mgrid .mc.off .cap { color: #6c7390; }
.mgrid .mc.off:hover { transform: none; }
/* 【対応】ボタンはフィールドの右下 */
#board > .respond-btn { position: absolute; right: 12px; bottom: 12px; z-index: 30; }

/* キーワード能力の説明 */
.kw { color: #9be7ff; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.kw:hover { color: #d4f4ff; }
.kwb span[data-kw] { cursor: help; }
#kw-pop { position: fixed; z-index: 120; display: none; padding: 10px 12px; border-radius: 10px; background: #141b30; border: 1px solid var(--gold); color: #e6e9f5; font-size: 13px; line-height: 1.6; box-shadow: 0 10px 30px rgba(0,0,0,.7); }
#kw-pop b { color: var(--gold3); display: block; margin-bottom: 4px; }

#board > .land-btn { right: 118px; }
@media (max-width: 760px) { #board > .land-btn { right: 92px; } }

/* 不具合報告 */
.rp-top { text-align: center; margin: 6px 0 2px; }
.rp-link { background: transparent; border: 1px solid var(--line2); color: #c9d2ee; border-radius: 999px; padding: 5px 14px; font-size: 12px; cursor: pointer; }
.rp-link:hover { border-color: var(--gold); color: var(--gold3); }
#report-ov { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); padding: 16px; }
#report-ov.on { display: flex; }
.rp-box { width: min(520px, 100%); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; max-height: 92dvh; overflow: auto; }
.rp-box h3 { margin: 0; }
.rp-hint { margin: 0; font-size: 12px; color: #aeb7d3; line-height: 1.6; }
.rp-box textarea { min-height: 140px; resize: vertical; font: inherit; font-size: 14px; padding: 8px; border-radius: 8px; background: #0b1020; color: #e6e9f5; border: 1px solid var(--line2); }
.rp-box input[type=text], .rp-box #rp-name { font: inherit; padding: 7px 8px; border-radius: 8px; background: #0b1020; color: #e6e9f5; border: 1px solid var(--line2); }
.rp-chk { font-size: 12px; color: #c9d2ee; display: flex; gap: 6px; align-items: center; }
.rp-meta { font-size: 12px; color: #aeb7d3; }
.rp-btns { display: flex; gap: 8px; justify-content: flex-end; }
.rp-btns button { min-height: 40px; padding: 6px 18px; }
.rp-msg { font-size: 12px; color: #ffb4b4; min-height: 1em; }

/* コイントスの勝者が先攻・後攻を選ぶ */
.ff-choose { pointer-events: auto; }
.ff-choose .ff-sub { color: #e6e9f5; font-size: 16px; margin: 8px 0 18px; text-align: center; }
.ff-pick { display: flex; gap: 16px; justify-content: center; }
.ff-pick button { min-width: 130px; min-height: 56px; font-size: 20px; font-weight: 900; border-radius: 14px; }

/* カードの詳細を画面いっぱいに（スマホ） */
#card-pop { position: fixed; inset: 0; z-index: 160; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px; background: rgba(2, 4, 10, .88); }
#card-pop.on { display: flex; }
#card-pop .cp-in { display: flex; gap: 14px; align-items: flex-start; max-width: min(760px, 100%); max-height: calc(100dvh - 50px); overflow: auto; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, rgba(20, 26, 44, .98), rgba(9, 12, 22, .98)); border: 1px solid var(--line2); }
#card-pop .cp-in > img, #card-pop .cp-in > .pimg, #card-pop .cp-in > :first-child:not(.ptext) { flex: none; width: min(42vw, 260px); max-height: calc(100dvh - 80px); object-fit: contain; }
#card-pop .cp-in img { width: 100%; height: auto; border-radius: 8px; }
#card-pop .ptext { flex: 1; min-width: 0; font-size: 14px; line-height: 1.6; }
#card-pop .cp-close { color: #8f9bbd; font-size: 12px; }
@media (orientation: portrait) {
  #card-pop .cp-in { flex-direction: column; align-items: center; }
  #card-pop .cp-in > :first-child:not(.ptext) { width: min(62vw, 260px); }
}
/* スマホ: 選ぶ画面の下の細い詳細欄は出さない（🔍・長押しで大きく見る） */
@media (hover: none), (max-width: 700px), (max-height: 560px) {
  #modal .mbody .mdetail { display: none !important; }
  #modal .mbody { grid-template-columns: 1fr !important; }
}

/* カードのタグを隠す（設定の「カードのタグ」） */
body.hide-tags .card .kwb, body.hide-tags .card .ctrs, body.hide-tags .card .eqb, body.hide-tags .card .cpb { display: none !important; }
