/* =========================================================
   ゲピサバイバーズ / styles.css
   ========================================================= */
:root {
  --bg: #141018;
  --ink: #f4eefb;
  --sub: #b9aecb;
  --line: rgba(255, 255, 255, .14);
  --card: rgba(28, 22, 38, .92);
  --gold: #ffd257;
  --cyan: #5ad7ff;
  --green: #7dffb0;
  --red: #ff6b6b;
  --purple: #b6a2ff;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud[hidden] { display: none; }

.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 8px 56px 0 10px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
}

.xpwrap { display: flex; align-items: center; gap: 8px; }
.xpbar {
  flex: 1; height: 12px; border-radius: 7px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--line);
  overflow: hidden;
}
.xpbar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #3aa8ff, var(--cyan));
  transition: width .12s linear;
}
.lv {
  font-weight: 800; font-size: 13px; letter-spacing: .02em;
  background: rgba(0, 0, 0, .55); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 7px; min-width: 52px; text-align: center;
}

.hud-row { display: flex; align-items: center; gap: 10px; margin-top: 7px; }

.hp {
  position: relative; width: 190px; max-width: 42vw; height: 20px;
  background: rgba(0, 0, 0, .55); border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden;
}
.hp i {
  position: absolute; inset: 0; width: 100%;
  background: linear-gradient(90deg, #d63f4f, #ff8a8a);
  transition: width .15s ease-out;
}
.hp span {
  position: relative; display: block; text-align: center;
  font-size: 12px; line-height: 18px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}

.clock {
  flex: 1; text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: 800;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .85);
}
.kills {
  font-size: 14px; font-weight: 700; white-space: nowrap;
  background: rgba(0, 0, 0, .5); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 7px;
}
.kills .ic { opacity: .8; margin-right: 4px; }

.bosswrap { margin: 8px auto 0; max-width: 520px; }
.bossname {
  text-align: center; font-size: 12px; font-weight: 800;
  letter-spacing: .12em; color: #ffb1b1;
  text-shadow: 0 1px 3px #000;
}
.bossbar {
  height: 12px; margin-top: 3px; border-radius: 6px;
  background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 120, 120, .5);
  overflow: hidden;
}
.bossbar i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff3b5c, #ffb36b);
  transition: width .1s linear;
}

.hud-bottom {
  position: absolute; right: 10px;
  bottom: calc(12px + var(--safe-b));
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.slots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 46vw; }
.slot {
  width: 36px; height: 36px; border-radius: 9px;
  background: rgba(0, 0, 0, .55); border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
  font-size: 17px;
}
.slots.small .slot { width: 28px; height: 28px; font-size: 13px; border-radius: 7px; }
.slot b {
  position: absolute; right: -2px; bottom: -4px;
  font-size: 10px; font-weight: 800; color: #12101a;
  background: var(--gold); border-radius: 5px; padding: 0 3px;
  line-height: 13px;
}
.slot.max b { background: var(--green); }

/* icons.webp（4列 x 4行）から 1 枚だけ切り出して出す。
   画像がなければ絵文字のまま。 */
.icn {
  display: block; width: 100%; height: 100%;
  background-image: var(--icons);
  background-repeat: no-repeat;
  background-size: 400% 400%;
  image-rendering: auto;
}
.offer .oi .icn { width: 42px; height: 42px; }

.pausebtn {
  position: absolute; right: 10px;
  top: calc(8px + env(safe-area-inset-top, 0px));
  pointer-events: auto;
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(0, 0, 0, .5); border: 1px solid var(--line);
  color: var(--ink); font-size: 13px; cursor: pointer;
}

/* ---------------- 画面スティック ---------------- */
#pad {
  position: absolute; left: 18px;
  bottom: calc(18px + var(--safe-b));
  width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03) 62%, transparent 70%);
  border: 1px solid rgba(255, 255, 255, .16);
  touch-action: none; z-index: 5;
  opacity: .5; transition: opacity .15s;
}
#pad.on { opacity: .9; }
#pad[hidden] { display: none; }
#knob {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff8, #fff2 60%, transparent);
  border: 1px solid rgba(255, 255, 255, .35);
  pointer-events: none;
}

/* ---------------- 画面（オーバーレイ） ---------------- */
.screen {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; padding: 20px;
  background: radial-gradient(circle at 50% 30%, #241c33, #100c17 70%);
  text-align: center;
  overflow-y: auto;
}
.screen[hidden] { display: none; }
.screen.dim { background: rgba(10, 8, 16, .82); backdrop-filter: blur(3px); }

.panel {
  width: min(560px, 100%);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

.brand {
  font-size: 26px; margin: 0; letter-spacing: .06em;
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand.big { font-size: clamp(30px, 8vw, 52px); }
.tag { margin: -4px 0 6px; color: var(--sub); font-size: 14px; }
.head { margin: 0 0 12px; font-size: 20px; letter-spacing: .04em; }
.lvhead { color: var(--gold); text-shadow: 0 2px 10px rgba(255, 210, 87, .35); }

.titlelogo { width: min(420px, 78vw); max-height: 34vh; object-fit: contain; }
.titlefoot { display: flex; gap: 10px; }

.btn {
  appearance: none; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .07); color: var(--ink);
  font: inherit; font-weight: 700;
  padding: 11px 22px; border-radius: 11px; cursor: pointer;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, #ffdf8a, #f0a92e);
  color: #26190a; border-color: #ffdf8a;
  box-shadow: 0 6px 18px rgba(240, 169, 46, .3);
}
.btn.ghost { background: rgba(255, 255, 255, .05); color: var(--sub); padding: 9px 16px; font-size: 13px; }
.btn.back { margin-top: 4px; }
.prow { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

/* ---------------- キャラ選択 ---------------- */
.chars { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.charcard {
  width: 176px; padding: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; cursor: pointer; text-align: center;
  transition: transform .1s, border-color .15s, box-shadow .15s;
}
.charcard:hover, .charcard:focus-visible {
  transform: translateY(-3px); border-color: var(--gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}
.charcard img { width: 96px; height: 96px; object-fit: contain; }
.charcard .cn { font-size: 16px; font-weight: 800; margin-top: 2px; }
.charcard .ct { font-size: 11px; color: var(--gold); letter-spacing: .1em; }
.charcard .cd { font-size: 12px; color: var(--sub); margin: 7px 0; line-height: 1.5; min-height: 54px; }
.charcard .cs { display: flex; justify-content: center; gap: 8px; font-size: 11px; color: var(--sub); }
.charcard .cs b { color: var(--ink); }
.charcard .cw {
  margin-top: 8px; font-size: 11px; padding: 4px 6px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(90, 215, 255, .12); border: 1px solid rgba(90, 215, 255, .3);
}

/* ---------------- レベルアップの選択 ---------------- */
/* ここだけは明るいカードにする。暗い戦闘画面の上で
   「読むために止まっている場所」だとひと目で分かるように。 */
.offers { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; width: min(720px, 100%); }
.offer {
  flex: 1 1 200px; max-width: 226px; min-width: 176px;
  padding: 14px 12px; text-align: left;
  background: linear-gradient(180deg, #ffffff, #eee7f5);
  border: 1px solid rgba(255, 255, 255, .9);
  border-top: 3px solid var(--gold);
  border-radius: 14px; cursor: pointer;
  color: #1d1726;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  transition: transform .1s, box-shadow .15s, filter .15s;
  animation: offerIn .22s cubic-bezier(.2, .9, .3, 1.2) both;
}
.offer:nth-child(2) { animation-delay: .05s; }
.offer:nth-child(3) { animation-delay: .1s; }
.offer:nth-child(4) { animation-delay: .15s; }
@keyframes offerIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to { opacity: 1; transform: none; }
}
.offer:hover, .offer:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.04);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .55);
}
.offer .oh { display: flex; align-items: center; gap: 9px; }
.offer .oi {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 21px;
  background: #1d1726;
  border: 1px solid rgba(0, 0, 0, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.offer .on { font-weight: 800; font-size: 15px; line-height: 1.2; color: #1d1726; }
.offer .ol { font-size: 11px; letter-spacing: .06em; color: #6d6280; }
.offer .od { font-size: 12.5px; color: #2c2438; margin-top: 9px; line-height: 1.55; font-weight: 700; }
.offer .osub {
  display: block; margin-top: 5px;
  font-size: 11px; color: #6d6280; line-height: 1.5; font-weight: 400;
}
.offer .otag {
  display: inline-block; margin-top: 9px; font-size: 10px; font-weight: 800;
  letter-spacing: .1em; padding: 3px 8px; border-radius: 20px;
}
.offer .otag.new { background: #ffe9a8; color: #6b4a05; border: 1px solid #e8bd4a; }
.offer .otag.up { background: #d3f7e2; color: #16603a; border: 1px solid #79cfa1; }

/* ---------------- ビルド一覧 / リザルト ---------------- */
.buildlist { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 12px 0 4px; }
.bchip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 5px 9px; border-radius: 9px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
}
.bchip b { color: var(--gold); font-size: 11px; }
.bchip .bi { width: 18px; height: 18px; display: block; }

.stats { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; margin: 6px 0 2px; }
.stat { min-width: 84px; }
.stat .sv { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .sl { font-size: 11px; color: var(--sub); letter-spacing: .06em; }

.help { text-align: left; font-size: 13px; color: var(--sub); line-height: 1.75; padding-left: 20px; margin: 4px 0 16px; }
.help b { color: var(--ink); }

.load { color: var(--sub); font-size: 13px; margin: 6px 0; }
.loadbar { width: min(320px, 70vw); height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0%; background: var(--gold); transition: width .2s; }

@media (max-width: 560px) {
  .charcard { width: 150px; }
  .charcard img { width: 80px; height: 80px; }
  .offer { min-width: 150px; padding: 11px 10px; }
  .offer .od { min-height: 0; }

  .clock { font-size: 21px; }
  .hp { width: 148px; height: 18px; }
  .hp span { font-size: 11px; line-height: 16px; }
  .kills { font-size: 12px; padding: 2px 7px; }
  .hud-row { gap: 7px; }
  .slots { max-width: 60vw; }
  .slot { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
  .slots.small .slot { width: 24px; height: 24px; font-size: 11px; }
}
