/* 国大戦 (Kuni Daisen) — style */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { width:100%; height:100%; overflow:hidden; background:#0b1118; }
body { font-family:"Hiragino Kaku Gothic ProN","Hiragino Sans","BIZ UDPGothic","Yu Gothic UI","Meiryo",system-ui,sans-serif; color:#e8eef4; }
button { font-family:inherit; }

#app { position:fixed; inset:0; }
#stage {
  position:absolute; left:50%; top:50%;
  width:960px; height:540px;
  transform-origin:center center;
  background:#101820;
  border-radius:10px; overflow:hidden;
  box-shadow:0 20px 60px rgba(0,0,0,.55);
}
#cv { position:absolute; left:0; top:0; display:block; touch-action:none; }

.hidden { display:none !important; }

/* ===== top bar ===== */
#topbar {
  position:absolute; left:0; right:0; top:0; height:40px;
  display:flex; align-items:center; gap:8px; padding:0 10px;
  background:linear-gradient(#0b1118f2, #0b1118d8);
  border-bottom:1px solid #2a3948;
  z-index:20; font-size:14px;
}
.tb-wave { min-width:110px; font-weight:700; color:#ffd76a; }
.tb-coins { min-width:90px; font-weight:700; color:#ffe9a8; }
.tb-bases { flex:1; display:flex; gap:14px; align-items:center; justify-content:flex-end; }
.tb-base { display:flex; align-items:center; gap:6px; }
.tb-base i { font-style:normal; font-size:11px; color:#9fb2c4; }
.tb-base .hp { width:96px; height:10px; background:#22303e; border:1px solid #3a4c5e; border-radius:5px; overflow:hidden; }
.tb-base .hp b { display:block; height:100%; width:100%; transition:width .2s; }
#tb-pb { background:linear-gradient(#9ff09f,#3fbf5f); }
#tb-eb { background:linear-gradient(#ff9d9d,#e33b3b); }
#topbar button {
  background:#1c2836; color:#cfe0ef; border:1px solid #3a4c5e; border-radius:8px;
  padding:6px 10px; font-size:13px; cursor:pointer;
}
#topbar button:active { background:#2a3a4e; }
#topbar input[type=range] { width:60px; accent-color:#ffd76a; margin:0; cursor:pointer; }

/* ===== banner ===== */
#banner {
  position:absolute; left:50%; top:120px; transform:translateX(-50%);
  padding:10px 26px; border-radius:12px;
  background:rgba(10,16,24,.82); border:1px solid #ffd76a66;
  color:#ffd76a; font-size:22px; font-weight:800; letter-spacing:.08em;
  opacity:0; pointer-events:none; z-index:30; white-space:nowrap;
}
#banner.show { animation:banner 2.2s ease forwards; }
@keyframes banner {
  0% { opacity:0; transform:translateX(-50%) translateY(14px); }
  12% { opacity:1; transform:translateX(-50%) translateY(0); }
  80% { opacity:1; }
  100% { opacity:0; }
}

/* ===== unit bar ===== */
#unitbar {
  position:absolute; left:0; right:0; bottom:0; height:104px;
  display:flex; align-items:center; justify-content:center; gap:4px;
  padding:6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background:linear-gradient(#0e161fee, #0b1118f5);
  border-top:1px solid #2a3948;
  z-index:20;
}
.ubtn {
  width:76px; height:92px; flex:0 0 auto;
  display:flex; flex-direction:column; align-items:center; gap:1px;
  background:#16212e; border:1px solid #33465c; border-radius:10px;
  color:#e8eef4; cursor:pointer; padding:2px 0 4px;
}
.ubtn canvas { width:52px; height:52px; }
.ubtn .uname { font-size:11px; font-weight:700; line-height:1.1; }
.ubtn .ucost { font-size:11px; color:#ffd76a; font-weight:700; line-height:1.1; }
.ubtn.sel { border-color:#ffd76a; background:#243447; box-shadow:0 0 10px #ffd76a55; }
.ubtn.off { opacity:.45; }

/* ===== screens ===== */
.screen {
  position:absolute; inset:0; z-index:40;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:18px; padding:30px;
  background:radial-gradient(ellipse at 50% 30%, #16222f 0%, #0b1118 70%);
  overflow-y:auto;
}
.t-logo {
  font-size:64px; font-weight:900; letter-spacing:.14em;
  color:#ffd76a; text-shadow:0 4px 0 #7a4d10, 0 10px 30px rgba(255,180,40,.35);
}
.t-sub { font-size:14px; color:#9fb2c4; letter-spacing:.06em; }
.t-rule {
  background:#131e2acc; border:1px solid #2a3948; border-radius:12px;
  padding:14px 20px; font-size:14px; line-height:2; color:#c6d4e2;
}
.t-btns { display:flex; gap:14px; margin-top:6px; }
.big {
  background:linear-gradient(#2a3d52,#1c2b3c);
  border:1px solid #40587a; border-radius:12px;
  color:#fff; font-size:18px; font-weight:700;
  padding:12px 34px; cursor:pointer;
}
.big:active { transform:translateY(1px); background:#16232f; }

.s-head { font-size:26px; font-weight:800; letter-spacing:.1em; color:#eaf2fa; }
.s-foot { margin-top:8px; }

#stage-list { display:flex; flex-direction:column; gap:10px; width:min(460px, 92%); }
.stage-btn {
  display:flex; align-items:center; gap:14px;
  background:#16212e; border:1px solid #33465c; border-radius:12px;
  color:#e8eef4; padding:12px 16px; cursor:pointer; text-align:left;
}
.stage-btn b { font-size:24px; color:#ffd76a; width:34px; }
.stage-btn span { flex:1; font-size:17px; font-weight:700; }
.stage-btn em { font-style:normal; font-size:12px; color:#9ff09f; }
.stage-btn.locked { opacity:.45; cursor:default; }
.stage-btn.locked em { color:#e37b7b; }
.stage-btn:active { background:#223140; }

#dex-list {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
  gap:10px; width:min(860px, 96%);
  justify-content:center; align-content:center;
}
.dex-card {
  display:flex; gap:10px; align-items:center;
  background:#141f2c; border:1px solid #2c3e52; border-radius:12px;
  padding:10px 12px;
}
.dex-card canvas { width:56px; height:56px; flex:0 0 auto; }
.dex-card h3 { font-size:15px; margin-bottom:2px; }
.dex-card h3 small { color:#9fb2c4; font-weight:400; font-size:12px; }
.dex-card p { font-size:11.5px; line-height:1.45; color:#c0cfdd; }
.dex-card .role { color:#8fc7ff; font-weight:700; }
.dex-card .sp { color:#ffd7a0; }
.dex-card .stats { color:#93a6b8; }

/* ===== end screen ===== */
#scr-end { background:rgba(8,12,18,.88); }
.end-title { font-size:54px; font-weight:900; letter-spacing:.1em; color:#ffd76a; }
.end-sub { font-size:16px; color:#c6d4e2; margin-bottom:10px; }
#end-btns { display:flex; flex-direction:column; gap:12px; align-items:center; }

/* ===== small screens ===== */
@media (max-width:520px), (max-height:420px) {
  .t-logo { font-size:44px; }
  .t-rule { font-size:12.5px; padding:10px 14px; }
  .big { padding:10px 24px; font-size:16px; }
}
