/* ========== カードアビス · スタイル ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
  background: #0b0a14;
  color: #e8e4f0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#app {
  position: relative;
  width: 100vw; height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(88, 60, 150, .28), transparent 60%),
    radial-gradient(900px 500px at 80% 110%, rgba(40, 90, 140, .18), transparent 60%),
    radial-gradient(700px 400px at 10% 100%, rgba(120, 40, 90, .14), transparent 60%),
    #0b0a14;
  display: flex; flex-direction: column;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- HUD ---------- */
#hud {
  height: 52px; flex: 0 0 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(20,16,36,.96), rgba(16,13,30,.88));
  border-bottom: 1px solid rgba(150,120,255,.18);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
  z-index: 40; gap: 10px;
}
.hud-left { display: flex; align-items: center; gap: 16px; min-width: 320px; }
.hud-hp { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.hp-heart { color: #ff5a6e; font-size: 18px; }
.hp-bar {
  width: 120px; height: 12px; border-radius: 6px;
  background: #2a2038; overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  position: relative;
}
.hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #d8384e, #ff7a5a);
  border-radius: 6px;
  transition: width .35s cubic-bezier(.22,1,.36,1);
}
.hud-gold { color: #ffd166; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.gold-icon { font-size: 14px; }
.hud-act { color: #9d92c2; font-size: 13px; }
.hud-mid { flex: 1; overflow: hidden; }
.hud-relics { display: flex; gap: 6px; flex-wrap: wrap; }
.relic-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(160deg, #2c2347, #1b1530);
  border: 1px solid rgba(255,210,120,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: help;
  box-shadow: inset 0 0 8px rgba(255,200,100,.12);
}
.hud-right { display: flex; align-items: center; gap: 8px; }
.hud-potions { display: flex; gap: 5px; }
.potion-slot {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 1px dashed rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.potion-slot.filled { border-style: solid; border-color: rgba(140,220,255,.5); cursor: pointer; background: radial-gradient(circle at 35% 30%, rgba(140,220,255,.25), rgba(30,40,70,.6)); }
.potion-slot.filled:hover { transform: scale(1.15); box-shadow: 0 0 10px rgba(140,220,255,.5); }
.hud-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.16);
  color: #e8e4f0; border-radius: 8px;
  padding: 5px 10px; font-size: 14px;
  transition: all .15s;
}
.hud-btn:hover { background: rgba(150,120,255,.2); border-color: rgba(150,120,255,.5); }

/* ---------- 共通 ---------- */
.screen { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; }
.panel {
  margin: auto;
  background: linear-gradient(170deg, rgba(32,26,56,.97), rgba(20,16,38,.97));
  border: 1px solid rgba(150,120,255,.25);
  border-radius: 16px;
  padding: 28px 34px;
  max-width: 640px; width: min(92vw, 640px);
  max-height: 86%;
  overflow-y: auto;
  box-shadow: 0 12px 50px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
  text-align: center;
  animation: panelIn .35s cubic-bezier(.22,1,.36,1);
}
.panel.wide { max-width: 900px; width: min(94vw, 900px); }
.panel.narrow { max-width: 380px; }
@keyframes panelIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.panel h2 { margin-bottom: 14px; letter-spacing: 2px; }
.panel p { color: #b8aed8; line-height: 1.7; }
.big-btn {
  display: block; width: 100%; margin: 10px auto;
  padding: 13px 24px; font-size: 17px; font-weight: 700;
  color: #e8e4f0; letter-spacing: 2px;
  background: linear-gradient(170deg, #3a2f63, #241c44);
  border: 1px solid rgba(160,130,255,.4);
  border-radius: 12px;
  transition: all .18s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.big-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(100,70,220,.35); border-color: rgba(190,160,255,.8); }
.big-btn:active { transform: translateY(0); }
.big-btn.primary { background: linear-gradient(170deg, #6d4fd4, #4a2fa0); border-color: rgba(200,170,255,.6); }
.big-btn.danger { background: linear-gradient(170deg, #7a2740, #4c1626); border-color: rgba(255,120,140,.4); }
.big-btn.small { font-size: 14px; padding: 9px 18px; width: auto; min-width: 160px; }
.big-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(5,4,12,.75);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-panel { display: flex; flex-direction: column; }
.modal-body { flex: 1; overflow-y: auto; margin-bottom: 12px; }

/* ---------- タイトル ---------- */
#screen-title { justify-content: center; overflow-y: auto; }
.title-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(2px 2px at 15% 25%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 75% 15%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.5px 1.5px at 45% 60%, rgba(200,180,255,.5), transparent),
    radial-gradient(2px 2px at 88% 70%, rgba(255,255,255,.35), transparent),
    radial-gradient(1.5px 1.5px at 30% 85%, rgba(180,200,255,.4), transparent),
    radial-gradient(2.5px 2.5px at 60% 35%, rgba(255,230,180,.4), transparent);
  animation: starTwinkle 4s ease-in-out infinite alternate;
}
@keyframes starTwinkle { from { opacity: .5; } to { opacity: 1; } }
.title-inner { position: relative; text-align: center; padding: 40px 20px 30px; max-width: 720px; }
.game-title {
  font-size: 72px; letter-spacing: 14px; font-weight: 900;
  background: linear-gradient(180deg, #f0e8ff 20%, #a88cff 60%, #5b3fb0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 24px rgba(130,90,255,.45));
}
.game-title span {
  background: linear-gradient(180deg, #ffd97a 20%, #ff8a5a 70%, #c04a3a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.game-sub { color: #8d80b8; margin: 8px 0 26px; letter-spacing: 4px; }
.title-btns { max-width: 320px; margin: 0 auto; }
.title-best { margin: 14px 0 6px; color: #ffd166; font-size: 14px; min-height: 20px; }
.howto {
  margin-top: 22px; text-align: left;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px; padding: 18px 24px;
}
.howto h3 { color: #c9b8ff; margin-bottom: 10px; letter-spacing: 3px; }
.howto ul { list-style: none; }
.howto li { padding: 5px 0; color: #b3a8d6; font-size: 14px; line-height: 1.6; }
.howto b { color: #ffd166; }

/* ---------- マップ ---------- */
#screen-map { padding-top: 16px; }
.map-title { letter-spacing: 4px; color: #d8ccff; text-shadow: 0 0 20px rgba(140,100,255,.5); }
.map-hint { color: #7d72a5; font-size: 13px; margin: 4px 0 8px; }
.map-scroll { flex: 1; overflow: auto; width: 100%; display: flex; justify-content: center; padding-bottom: 20px; }
#mapSvg { max-width: 96vw; }
.map-node { cursor: default; }
.map-node.reachable { cursor: pointer; }
.map-node.reachable .node-circle { animation: nodePulse 1.4s ease-in-out infinite; }
@keyframes nodePulse {
  0%, 100% { stroke-width: 2.5; filter: drop-shadow(0 0 4px rgba(255,215,120,.9)); }
  50% { stroke-width: 5; filter: drop-shadow(0 0 14px rgba(255,215,120,1)); }
}
.map-node text { pointer-events: none; }

/* ---------- 戦闘 ---------- */
#screen-battle { display: flex; flex-direction: column; }
#battleWrap { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 0; }
#fxCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
#enemiesRow {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 60px; padding: 30px 20px 6px;
}
#playerArea { flex: 0 0 200px; display: flex; align-items: flex-end; justify-content: flex-start; padding: 0 0 8px 8vw; }
.pawn { position: relative; text-align: center; width: 150px; transition: transform .1s; }
.pawn-art {
  font-size: 68px; line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.6));
  transition: filter .1s, opacity .5s, transform .12s;
}
.pawn.enemy-pawn { cursor: default; }
.pawn.targetable { cursor: pointer; }
.pawn.targetable .pawn-art { animation: targetBob .8s ease-in-out infinite alternate; }
.pawn.targetable::after {
  content: ""; position: absolute; inset: -10px -6px;
  border: 2px dashed rgba(255,90,110,.75); border-radius: 16px;
  animation: targetGlow 1s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes targetBob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes targetGlow { from { box-shadow: 0 0 4px rgba(255,90,110,.3); } to { box-shadow: 0 0 18px rgba(255,90,110,.7); } }
.pawn.hitflash .pawn-art { filter: brightness(4) drop-shadow(0 0 10px #fff); transform: translateX(6px); }
.pawn.dying { pointer-events: none; }
.pawn.dying .pawn-art { opacity: 0; transform: translateY(-24px) scale(.6) rotate(12deg); }
.pawn-name { font-size: 13px; color: #cfc4ee; margin: 6px 0 4px; font-weight: 700; letter-spacing: 1px; }
.pawn-hp { width: 130px; margin: 0 auto; height: 14px; position: relative; }
.hp-label {
  position: absolute; inset: 0; font-size: 10px; line-height: 14px;
  text-align: center; color: #fff; text-shadow: 0 1px 2px #000; font-weight: 700;
}
.block-chip {
  position: absolute; left: -14px; top: 40%;
  background: linear-gradient(170deg, #3d6ea8, #26497a);
  border: 1px solid rgba(150,200,255,.6);
  color: #dceaff; font-weight: 800; font-size: 13px;
  padding: 3px 8px; border-radius: 10px;
  box-shadow: 0 0 10px rgba(90,160,255,.5);
  z-index: 5;
}
.intent {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(15,12,28,.92);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px; padding: 3px 10px;
  font-size: 14px; font-weight: 800; cursor: help;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
}
.intent.atk { color: #ff8a7a; border-color: rgba(255,120,100,.45); }
.intent.def { color: #7ab8ff; border-color: rgba(120,180,255,.45); }
.intent.buf { color: #7ee8a0; border-color: rgba(120,230,160,.45); }
.intent.dbf { color: #d08aff; border-color: rgba(200,140,255,.45); }
.status-row {
  display: flex; justify-content: center; gap: 4px; margin-top: 5px;
  flex-wrap: wrap; min-height: 22px;
}
.status-chip {
  font-size: 11px; font-weight: 800; padding: 2px 6px;
  border-radius: 8px; cursor: help;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
}
.status-chip.buff { color: #8fe8a8; border-color: rgba(140,230,170,.4); }
.status-chip.debuff { color: #ff9a8a; border-color: rgba(255,150,130,.4); }

/* 下部の手札エリア */
#battleBottom {
  flex: 0 0 218px;
  display: flex; align-items: flex-end; justify-content: center;
  gap: 14px; padding: 0 14px 12px;
  background: linear-gradient(180deg, transparent, rgba(10,8,20,.85) 40%);
  position: relative; z-index: 20;
}
.pile-box {
  flex: 0 0 62px; height: 58px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  font-size: 12px; color: #9d92c2; text-align: center;
  padding-top: 8px; cursor: pointer; line-height: 1.4;
  transition: all .15s;
}
.pile-box b { color: #e8e4f0; font-size: 15px; }
.pile-box:hover { background: rgba(150,120,255,.15); }
.pile-box.small { flex-basis: 52px; height: 48px; padding-top: 5px; font-size: 11px; }
.energy-orb {
  flex: 0 0 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a0, #f0a83a 45%, #a05c18);
  border: 3px solid rgba(255,230,160,.7);
  box-shadow: 0 0 24px rgba(255,180,60,.55), inset 0 -6px 14px rgba(120,60,0,.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #4a2a06; font-weight: 900;
}
.energy-orb span { font-size: 21px; }
.energy-orb small { font-size: 10px; letter-spacing: 2px; }
.end-turn-btn {
  flex: 0 0 auto; padding: 14px 22px;
  font-size: 16px; font-weight: 800; letter-spacing: 3px;
  color: #ffe9c8;
  background: linear-gradient(170deg, #8a5a2a, #5c3a14);
  border: 1px solid rgba(255,200,120,.5);
  border-radius: 12px;
  transition: all .18s;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
.end-turn-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 0 18px rgba(255,180,80,.45); }
.end-turn-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 手札 */
#handRow {
  flex: 1; max-width: 780px; min-width: 0;
  display: flex; justify-content: center; align-items: flex-end;
  height: 210px; padding-bottom: 2px;
}
.card {
  position: relative;
  width: 132px; height: 188px; flex: 0 1 118px;
  min-width: 0;
  border-radius: 12px;
  background: linear-gradient(170deg, #262040, #171228);
  border: 2px solid #5a5372;
  box-shadow: 0 6px 16px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s, border-color .18s;
  display: flex; flex-direction: column;
  overflow: visible;
}
.card-inner { width: 132px; height: 100%; display: flex; flex-direction: column; padding: 7px 9px 8px; }
.card:hover, .card.selected {
  transform: translateY(-42px) scale(1.28);
  z-index: 25;
  box-shadow: 0 18px 40px rgba(0,0,0,.7), 0 0 22px rgba(160,120,255,.35);
}
.card.selected { border-color: #ffd166 !important; box-shadow: 0 18px 40px rgba(0,0,0,.7), 0 0 26px rgba(255,209,102,.7); }
.card.unplayable { filter: saturate(.35) brightness(.7); }
.card.unplayable:hover { transform: translateY(-30px) scale(1.2); }
.card.rar-common { border-color: #6b7488; }
.card.rar-rare { border-color: #d9a93f; box-shadow: 0 6px 16px rgba(0,0,0,.55), 0 0 10px rgba(217,169,63,.25); }
.card.rar-legendary {
  border-color: #ff7a4a;
  box-shadow: 0 6px 16px rgba(0,0,0,.55), 0 0 14px rgba(255,110,60,.45);
  animation: legendGlow 2.2s ease-in-out infinite alternate;
}
@keyframes legendGlow {
  from { box-shadow: 0 6px 16px rgba(0,0,0,.55), 0 0 10px rgba(255,110,60,.35); }
  to { box-shadow: 0 6px 16px rgba(0,0,0,.55), 0 0 22px rgba(255,140,70,.65); }
}
.card.rar-starter { border-color: #566078; }
.card.rar-curse { border-color: #3d2b4e; filter: saturate(.5); }
.card.t-attack .card-inner { background: linear-gradient(180deg, rgba(160,45,55,.28), transparent 55%); }
.card.t-skill .card-inner { background: linear-gradient(180deg, rgba(40,120,160,.28), transparent 55%); }
.card.t-power .card-inner { background: linear-gradient(180deg, rgba(130,60,190,.30), transparent 55%); }
.card-cost {
  position: absolute; top: -9px; left: -9px;
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a0, #e89a2a 55%, #94540f);
  border: 2px solid rgba(255,235,180,.8);
  color: #3d2305; font-weight: 900; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 3;
}
.card-name {
  font-size: 13px; font-weight: 800; text-align: center;
  color: #f2edff; letter-spacing: 1px;
  padding: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-name.upg { color: #7ee8a0; }
.card-art {
  height: 54px; display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.09), transparent 70%);
  border-radius: 8px; margin-bottom: 4px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
}
.card-type {
  font-size: 9px; letter-spacing: 3px; color: #8d82b5;
  text-align: center; margin-bottom: 3px;
}
.card-desc {
  flex: 1; font-size: 11px; line-height: 1.45; text-align: center;
  color: #cfc6e8; display: flex; align-items: center; justify-content: center;
  padding: 0 1px;
}
.card-desc .kw { color: #ffd166; font-weight: 700; cursor: help; border-bottom: 1px dotted rgba(255,209,102,.6); }
.card.flying {
  position: fixed; z-index: 100; pointer-events: none;
  transition: all .4s cubic-bezier(.5,0,.8,.4);
  margin: 0;
}

/* カードグリッド（報酬/閲覧/ショップ） */
.card-grid { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 10px 0; }
.card-grid .card { flex: 0 0 132px; }
.card-grid .card:hover { transform: translateY(-8px) scale(1.1); }
.card-pick .card:hover { border-color: #ffd166; }
.reward-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px; padding: 10px 16px; margin: 8px auto;
  max-width: 420px; text-align: left;
}
.reward-item .ri-icon { font-size: 26px; }
.reward-item .ri-name { font-weight: 700; }
.reward-item .ri-sub { font-size: 12px; color: #9d92c2; }

/* ショップ */
.shop-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 8px 0 4px; }
.shop-item { text-align: center; }
.price-tag { margin-top: 6px; font-weight: 800; color: #ffd166; font-size: 14px; }
.price-tag.cant { color: #ff7a7a; }
.shop-relic, .shop-potion {
  width: 120px; padding: 12px 8px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; cursor: pointer;
  transition: all .15s;
}
.shop-relic:hover, .shop-potion:hover { transform: translateY(-4px); border-color: rgba(255,209,102,.6); }
.shop-relic .sr-icon, .shop-potion .sr-icon { font-size: 32px; }
.shop-relic .sr-name, .shop-potion .sr-name { font-size: 13px; font-weight: 700; margin-top: 4px; }
.shop-relic .sr-desc, .shop-potion .sr-desc { font-size: 11px; color: #9d92c2; margin-top: 3px; line-height: 1.4; }
.sold { opacity: .35; pointer-events: none; }

/* イベント */
.event-art { font-size: 64px; margin: 6px 0 12px; filter: drop-shadow(0 6px 18px rgba(140,90,255,.4)); }
.event-text { color: #c5bade; line-height: 1.8; margin-bottom: 18px; white-space: pre-line; }
.choice-btn {
  display: block; width: 100%; margin: 10px 0; padding: 12px 18px;
  text-align: left; font-size: 15px; color: #ffe9c8; font-weight: 700;
  background: linear-gradient(170deg, rgba(90,60,140,.4), rgba(40,28,70,.5));
  border: 1px solid rgba(180,140,255,.35);
  border-radius: 12px; transition: all .15s;
}
.choice-btn small { display: block; color: #9d92c2; font-weight: 400; font-size: 12px; margin-top: 3px; }
.choice-btn:hover:not(:disabled) { border-color: rgba(255,209,102,.7); transform: translateX(6px); }
.choice-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 焚き火 */
.camp-fire { font-size: 80px; animation: fireFlicker 1.2s ease-in-out infinite alternate; margin-bottom: 10px; }
@keyframes fireFlicker {
  from { filter: drop-shadow(0 0 18px rgba(255,140,40,.7)); transform: scale(1); }
  to { filter: drop-shadow(0 0 34px rgba(255,180,60,.9)); transform: scale(1.05); }
}

/* リザルト */
.end-title { font-size: 40px; letter-spacing: 8px; margin-bottom: 6px; }
.end-title.win { color: #ffd166; text-shadow: 0 0 30px rgba(255,200,90,.6); }
.end-title.lose { color: #ff6a7a; text-shadow: 0 0 30px rgba(255,90,110,.5); }
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px;
  margin: 18px auto; max-width: 440px; text-align: left;
}
.stat-grid > div { background: rgba(255,255,255,.05); border-radius: 8px; padding: 8px 14px; font-size: 14px; }
.stat-grid b { color: #ffd166; float: right; }
.ach-pop { color: #7ee8a0; font-size: 14px; margin: 4px 0; }

/* 実績リスト */
.ach-row {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 14px; margin: 6px 0;
  background: rgba(255,255,255,.04); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1);
}
.ach-row.done { border-color: rgba(255,209,102,.5); background: rgba(255,200,90,.07); }
.ach-row .ach-icon { font-size: 24px; filter: grayscale(1) opacity(.4); }
.ach-row.done .ach-icon { filter: none; }
.ach-row .ach-name { font-weight: 700; font-size: 14px; }
.ach-row .ach-desc { font-size: 12px; color: #9d92c2; }

/* ヒント/浮遊表示 */
#tooltip {
  position: fixed; z-index: 200; pointer-events: none;
  max-width: 260px; padding: 9px 13px;
  background: rgba(12,10,24,.97);
  border: 1px solid rgba(180,150,255,.45);
  border-radius: 10px;
  font-size: 12.5px; line-height: 1.55; color: #ddd4f5;
  box-shadow: 0 8px 24px rgba(0,0,0,.7);
  white-space: pre-line;
}
#tooltip b { color: #ffd166; }
#toastWrap {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: linear-gradient(170deg, rgba(60,45,110,.96), rgba(35,26,66,.96));
  border: 1px solid rgba(255,209,102,.5);
  border-radius: 12px; padding: 10px 22px;
  font-weight: 700; font-size: 15px; color: #ffe9c8;
  box-shadow: 0 8px 28px rgba(0,0,0,.6);
  animation: toastIn .3s cubic-bezier(.22,1,.36,1), toastOut .4s ease 2.6s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px); } }
.battle-hint {
  position: absolute; bottom: 236px; left: 50%; transform: translateX(-50%);
  z-index: 35; padding: 8px 20px;
  background: rgba(20,16,40,.92); border: 1px solid rgba(255,209,102,.5);
  border-radius: 20px; font-size: 14px; color: #ffd166;
  animation: hintBob 1.4s ease-in-out infinite alternate;
  pointer-events: none; white-space: nowrap;
}
@keyframes hintBob { from { transform: translateX(-50%) translateY(0); } to { transform: translateX(-50%) translateY(-6px); } }

/* 画面スケール対応 */
@media (max-height: 760px) {
  .game-title { font-size: 54px; }
  #battleBottom { flex-basis: 196px; }
  .card { height: 172px; }
  .card-inner { padding-top: 5px; }
  .card-art { height: 44px; font-size: 30px; }
}
@media (max-width: 900px) {
  #enemiesRow { gap: 24px; }
  .hud-left { min-width: 0; }
  .hud-act { display: none; }
}

/* ---------- KanaWorks_AI クレジット ---------- */
.kw-credit {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 20px; padding: 6px 16px 6px 8px;
  background: rgba(20, 16, 36, 0.6);
  border: 1px solid rgba(168, 140, 255, 0.25);
  border-radius: 999px;
  text-decoration: none;
  color: #8d80b8; font-size: 12.5px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.kw-credit img { width: 28px; height: 28px; display: block; }
.kw-credit b { color: #ffd97a; }
.kw-credit:hover {
  transform: translateY(-2px);
  border-color: #a88cff;
  box-shadow: 0 0 20px rgba(130, 90, 255, 0.3);
}

/* ---------- 生成アート（Higgsfield スプライトシート） ---------- */
.art-img {
  background-repeat: no-repeat;
  background-color: #100e1c;
  border: 1px solid rgba(190, 160, 255, .28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(0, 0, 0, .4);
}
.card-art.art-img {
  width: 72px; height: 72px;
  margin: 2px auto 4px;
  border-radius: 10px;
  border-color: rgba(255, 215, 130, .3);
  filter: none;
}
.relic-icon.art-img { font-size: 0; }
.potion-slot.art-img { font-size: 0; border-style: solid; }
.pawn-art.art-img {
  border-radius: 14px;
  border: 2px solid rgba(190, 160, 255, .35);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .6);
}
#playerPawn .pawn-art.art-img { width: 112px; height: 112px; }
.event-art.art-img {
  width: 208px; height: 208px;
  margin: 6px auto 12px;
  border-radius: 16px;
  border-color: rgba(190, 160, 255, .4);
  filter: none;
}
.camp-fire.art-img {
  width: 150px; height: 150px;
  margin: 0 auto 10px;
  border-radius: 16px;
}
.ri-icon.art-img {
  display: inline-block;
  width: 46px; height: 46px;
  flex: 0 0 46px;
  border-radius: 10px;
}
.shop-relic .sr-icon.art-img, .shop-potion .sr-icon.art-img {
  width: 58px; height: 58px;
  margin: 0 auto 6px;
  border-radius: 12px;
}
.deck-mini {
  display: inline-block;
  width: 13px; height: 17px;
  border-radius: 3px;
  vertical-align: -3px;
  border: 1px solid rgba(255, 215, 130, .35);
}
@media (max-width: 560px) {
  .card-art.art-img { width: 46px; height: 46px; }
}

/* タイトル画面：キーアート背景 */
#screen-title {
  background:
    linear-gradient(rgba(11, 10, 20, .35), rgba(11, 10, 20, .93) 78%),
    url('art/title-keyart.jpg') center / cover no-repeat;
}

/* エナジーオーブ：生成アート版 */
.energy-orb {
  background: url('art/ui-kit.jpg') 0% 100% / 200% 200% no-repeat;
  border-color: rgba(200, 165, 255, .75);
  box-shadow: 0 0 24px rgba(160, 100, 255, .6), inset 0 -6px 14px rgba(30, 10, 60, .5);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .9), 0 0 10px rgba(120, 60, 220, .8);
}

/* ---------- シーン背景（生成アート・幕ごと） ---------- */
#screen-campfire { background: linear-gradient(rgba(11,10,20,.45), rgba(11,10,20,.8)), url('art/bg-camp.jpg') center / cover no-repeat; }
#screen-shop     { background: linear-gradient(rgba(11,10,20,.45), rgba(11,10,20,.82)), url('art/bg-shop.jpg') center / cover no-repeat; }
#screen-event    { background: linear-gradient(rgba(11,10,20,.45), rgba(11,10,20,.82)), url('art/bg-event.jpg') center / cover no-repeat; }

body[data-act="1"] #screen-battle, body[data-act="1"] #screen-reward { background: linear-gradient(rgba(11,10,20,.3), rgba(11,10,20,.78)), url('art/bg-act1.jpg') center / cover no-repeat; }
body[data-act="2"] #screen-battle, body[data-act="2"] #screen-reward { background: linear-gradient(rgba(11,10,20,.3), rgba(11,10,20,.78)), url('art/bg-act2.jpg') center / cover no-repeat; }
body[data-act="3"] #screen-battle, body[data-act="3"] #screen-reward { background: linear-gradient(rgba(11,10,20,.3), rgba(11,10,20,.78)), url('art/bg-act3.jpg') center / cover no-repeat; }

body[data-act="1"][data-scene="boss"] #screen-battle { background: linear-gradient(rgba(11,10,20,.3), rgba(11,10,20,.78)), url('art/bg-boss1.jpg') center / cover no-repeat; }
body[data-act="2"][data-scene="boss"] #screen-battle { background: linear-gradient(rgba(11,10,20,.3), rgba(11,10,20,.78)), url('art/bg-boss2.jpg') center / cover no-repeat; }
body[data-act="3"][data-scene="boss"] #screen-battle { background: linear-gradient(rgba(11,10,20,.3), rgba(11,10,20,.78)), url('art/bg-boss3.jpg') center / cover no-repeat; }

body[data-act="1"] #screen-map { background: linear-gradient(rgba(11,10,20,.78), rgba(11,10,20,.94)), url('art/bg-act1.jpg') center / cover no-repeat; }
body[data-act="2"] #screen-map { background: linear-gradient(rgba(11,10,20,.78), rgba(11,10,20,.94)), url('art/bg-act2.jpg') center / cover no-repeat; }
body[data-act="3"] #screen-map { background: linear-gradient(rgba(11,10,20,.78), rgba(11,10,20,.94)), url('art/bg-act3.jpg') center / cover no-repeat; }

body[data-end="win"]  #screen-end { background: linear-gradient(rgba(11,10,20,.35), rgba(11,10,20,.75)), url('art/bg-victory.jpg') center / cover no-repeat; }
body[data-end="lose"] #screen-end { background: linear-gradient(rgba(11,10,20,.45), rgba(11,10,20,.8)), url('art/bg-defeat.jpg') center / cover no-repeat; }

/* ---------- バトル演出強化 ---------- */
.pawn.lunge { animation: pawnLunge .32s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pawnLunge {
  0% { transform: translateY(0); }
  35% { transform: translateY(-30px) scale(1.06); }
  100% { transform: translateY(0); }
}
#handRow { perspective: 900px; }
#handRow .card {
  transform-style: preserve-3d;
  transition: transform .16s ease, box-shadow .16s ease, border-color .12s;
}
#handRow .card:hover {
  transform: translateY(-36px) rotateX(9deg) scale(1.1);
  box-shadow: 0 24px 44px rgba(0, 0, 0, .7), 0 0 24px rgba(150, 100, 255, .4);
  z-index: 6;
}
#handRow .card.selected {
  transform: translateY(-42px) rotateX(6deg) scale(1.12);
  box-shadow: 0 26px 48px rgba(0, 0, 0, .75), 0 0 30px rgba(255, 209, 102, .55);
  z-index: 7;
}

/* ボス登場演出 */
#bossIntro {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; z-index: 40;
  background: radial-gradient(ellipse at center, rgba(60, 10, 30, .0), rgba(8, 4, 16, .78));
  opacity: 0;
}
#bossIntro.play { animation: bossIntroFade 2.1s ease forwards; }
.bi-word {
  font-size: 20px; letter-spacing: 14px; font-weight: 900;
  color: #ff5a7a; text-shadow: 0 0 22px rgba(255, 60, 100, .8);
  margin-bottom: 8px;
}
#bossIntroName {
  font-size: 52px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(180deg, #ffe9d8 20%, #ff9a6a 60%, #c04a3a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 80, 80, .5));
  transform: scale(1.6);
  animation: bossNameZoom 2.1s cubic-bezier(.2, 1, .3, 1) forwards;
}
@keyframes bossIntroFade { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bossNameZoom { 0% { transform: scale(1.7); } 22% { transform: scale(1); } 100% { transform: scale(1); } }

/* ---------- 挑戦の階層セレクター ---------- */
.asc-row {
  display: flex; align-items: stretch; gap: 8px;
  margin: 2px auto; max-width: 340px;
}
.asc-btn {
  width: 46px; font-size: 22px; font-weight: 900;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(150, 120, 255, .35);
  color: #e8e4f0; border-radius: 10px; cursor: pointer;
  transition: all .15s;
}
.asc-btn:hover:not(:disabled) { background: rgba(150, 120, 255, .25); }
.asc-btn:disabled { opacity: .3; cursor: default; }
.asc-mid {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  background: rgba(120, 40, 60, .22);
  border: 1px solid rgba(255, 110, 130, .35);
  border-radius: 10px; padding: 6px 10px;
}
.asc-mid span { font-weight: 800; color: #ff9aac; font-size: 15px; }
.asc-mid small { color: #cba7b8; font-size: 11.5px; margin-top: 2px; }

/* シード入力・表示 */
.seed-input {
  display: block; margin: 2px auto; max-width: 340px; width: 100%;
  background: rgba(255, 255, 255, .05);
  border: 1px dashed rgba(150, 120, 255, .35);
  border-radius: 10px; color: #cfc4ee;
  padding: 9px 14px; font-size: 13px; text-align: center;
  letter-spacing: 2px; outline: none; box-sizing: border-box;
}
.seed-input:focus { border-style: solid; border-color: rgba(150, 120, 255, .6); }
.seed-chip {
  margin: 4px auto 0; padding: 3px 14px; width: fit-content;
  font-size: 12px; letter-spacing: 1.5px; color: #9d92c2;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.seed-chip:hover { color: #ffd166; border-color: rgba(255, 209, 102, .5); }

/* リザルトの階層表示 */
.asc-clear { color: #ff9aac; font-weight: 800; margin-top: 6px; }
.asc-unlock { color: #ffd166; font-weight: 800; }

/* ---------- BGMコントロール ---------- */
#hudMusic.off { opacity: .35; filter: grayscale(1); }
.bgm-vol-row {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 10px; padding: 8px 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(150, 120, 255, .25);
  border-radius: 10px; font-size: 13px; color: #cfc4ee;
}
.bgm-vol-row b { min-width: 26px; text-align: right; color: #ffd166; }
.bgm-vol-row input[type="range"] {
  flex: 1; accent-color: #9a7bff; cursor: pointer;
}

/* ---------- 擬似3D強化 ---------- */
/* 手札の扇状レイアウト＋カーソル追従チルト */
#handRow { perspective: 1000px; }
#handRow .card {
  transform-origin: 50% 115%;
  transform: rotate(var(--fan-r, 0deg)) translateY(var(--fan-y, 0px));
  will-change: transform;
}
#handRow .card:hover {
  transform: translateY(-38px) scale(1.12)
    rotateX(var(--tilt-x, 5deg)) rotateY(var(--tilt-y, 0deg));
  box-shadow: 0 26px 46px rgba(0, 0, 0, .72), 0 0 26px rgba(150, 100, 255, .45);
  z-index: 6;
}
#handRow .card.selected {
  transform: translateY(-44px) scale(1.14);
  box-shadow: 0 28px 50px rgba(0, 0, 0, .78), 0 0 32px rgba(255, 209, 102, .6);
  z-index: 7;
}

/* 戦場のパララックス層 */
#enemiesRow, #playerArea { will-change: transform; transition: transform .12s ease-out; }

/* 立ち絵の呼吸フロート＋地面の影 */
.pawn { position: relative; }
.pawn-art.art-img { animation: pawnFloat 3.2s ease-in-out infinite alternate; }
.enemy-pawn:nth-child(2) .pawn-art.art-img { animation-delay: -1.1s; }
.enemy-pawn:nth-child(3) .pawn-art.art-img { animation-delay: -2.2s; }
@keyframes pawnFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-7px); }
}
.pawn::before {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  width: 74%; height: 14px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55), transparent 70%);
  pointer-events: none;
}
.enemy-pawn::before { bottom: 52px; }
.player-pawn::before { bottom: 46px; }
/* 死亡・ヒット時はフロートを止めて専用アニメを優先 */
.pawn.dying .pawn-art, .pawn.hitflash .pawn-art { animation: none; }
.pawn.lunge .pawn-art { animation: none; }

/* シード入力のヘルプ */
.seed-wrap { position: relative; max-width: 340px; margin: 2px auto; width: 100%; }
.seed-wrap .seed-input { margin: 0; width: 100%; padding-right: 36px; }
#seedHelp {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #9d92c2;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(150, 120, 255, .4);
  cursor: help; transition: all .15s;
}
#seedHelp:hover { color: #ffd166; border-color: rgba(255, 209, 102, .6); }
