:root {
  color-scheme: dark;
  --bg: #10282d;
  --card: #1b3a3e;
  --card2: #23474a;
  --line: #4b7372;
  --cream: #fff0d2;
  --muted: #bed3c9;
  --gold: #ffcd75;
  --coral: #fa886f;
  --jade: #6dd7bd;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 50% -15%, #366364 0, var(--bg) 52%); color: var(--cream); font: 500 15px/1.4 system-ui, -apple-system, sans-serif; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
#app { max-width: 540px; min-height: 100dvh; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px max(26px, env(safe-area-inset-bottom)); }
h1,h2,h3,p { margin-top: 0; }
h1,h2,h3 { font-family: system-ui, -apple-system, sans-serif; line-height: 1.1; }
h1 { font-size: clamp(30px, 8vw, 44px); letter-spacing: -.04em; }
h2 { font-size: 26px; }
h3 { font-size: 18px; }
small,.muted { color: var(--muted); }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.brand { font: 800 21px system-ui, sans-serif; letter-spacing: -.04em; color: var(--gold); }
.tag { border: 1px solid var(--line); background: #123133; border-radius: 999px; padding: 5px 9px; font-size: 11px; color: var(--muted); }
.panel { background: linear-gradient(145deg, #204246, #183437); border: 1px solid #527273; border-radius: 24px; padding: 18px; box-shadow: 0 16px 32px #071b2099; }
.panel + .panel { margin-top: 12px; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.lead { color: var(--muted); font-size: 14px; max-width: 38ch; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.button { border: 1px solid #e5b968; background: linear-gradient(#ffd989, #e2a94c); color: #342714; border-radius: 14px; padding: 12px 16px; font-weight: 800; min-height: 47px; box-shadow: 0 4px 0 #a87633; }
.button:active { transform: translateY(2px); box-shadow: 0 2px 0 #a87633; }
.button.alt { border-color: #83c3b2; background: #27625d; color: var(--cream); box-shadow: 0 4px 0 #174840; }
.button.ghost { border-color: var(--line); background: #163539; color: var(--cream); box-shadow: none; }
.button.full { width: 100%; }
.button.small { padding: 7px 11px; min-height: 35px; border-radius: 10px; font-size: 12px; }
.hero-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero-card { text-align: left; border: 1px solid #557671; border-radius: 20px; background: #25494a; color: var(--cream); overflow: hidden; padding: 0; }
.hero-card img { display: block; width: 100%; height: 145px; object-fit: contain; background: radial-gradient(circle at 50% 55%, #5d8270, #1a383d 70%); }
.hero-card div { padding: 9px 11px 12px; }
.hero-card strong { display: block; font-family: system-ui, sans-serif; font-size: 15px; }
.hero-card small { display: block; font-size: 11px; }
.hero-card.locked { filter: grayscale(.65); }
.hero-card.selected { outline: 3px solid var(--gold); }
.portrait-stage { position: relative; height: 275px; overflow: hidden; border-radius: 21px; background: radial-gradient(circle at 55% 55%, #4c8079, #17383c 70%); }
.portrait-stage::after { content: ''; position: absolute; left: -5%; right: -5%; bottom: -20px; height: 62px; border-radius: 50%; background: #b17b4e; border: 7px solid #d1a46c; }
.portrait-stage img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 8px 8px #001a1d99); }
.chipline { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.chip { border-radius: 999px; border: 1px solid #668c82; padding: 6px 10px; background: #244b49; color: var(--cream); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.stat { border: 1px solid #456d6b; background: #153538; border-radius: 13px; padding: 8px 10px; font-size: 12px; }
.stat strong { display: block; color: var(--gold); font-size: 17px; }
.list { display: grid; gap: 8px; }
.item { border: 1px solid #557773; border-radius: 15px; background: #15383a; padding: 11px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.item strong { display: block; font-size: 14px; }
.item small { display: block; font-size: 11px; margin-top: 3px; }
.item.active { border-color: var(--gold); background: #3d4b39; }
.section-title { margin: 22px 0 9px; display: flex; align-items: baseline; justify-content: space-between; }
.section-title h3 { margin: 0; }
.battle-scene { background: linear-gradient(#6e9c91 0 62%, #bc9668 62% 100%); border: 4px solid #d4ae75; box-shadow: inset 0 0 0 3px #705b42; border-radius: 22px; min-height: 300px; overflow: hidden; position: relative; }
.battle-scene::before { content: ''; position: absolute; inset: 10px 20px 37%; border-radius: 100% 100% 0 0; border: 4px solid #d1be9d; opacity: .6; }
.fighters { display: flex; position: absolute; inset: 24px 3px 18px; align-items: end; justify-content: space-between; }
.fighter { width: 49%; height: 245px; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 8px 5px #3a372c88); transition: transform .15s; }
.fighter.bot { transform: scaleX(-1); }
.fighter.pulse { animation: strike .35s ease-out; }
@keyframes strike { 50% { transform: translateX(15px) rotate(-3deg) scale(1.04); } }
.fighter.bot.pulse { animation: botstrike .35s ease-out; }
@keyframes botstrike { 50% { transform: scaleX(-1) translateX(15px) rotate(-3deg) scale(1.04); } }
.battle-head { display: grid; gap: 7px; margin-bottom: 12px; }
.health { background: #0c2628; border: 1px solid #56706d; height: 13px; border-radius: 999px; overflow: hidden; }
.health > span { display: block; height: 100%; background: linear-gradient(90deg,#8ee0a7,#4dbf7a); transition: width .2s; }
.health.enemy > span { background: linear-gradient(90deg,#f7b28e,#eb6f67); }
.card-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.card-action { min-height: 91px; padding: 7px; border: 1px solid #d1ae7b; border-radius: 12px; background: #ead8aa; color: #3f342c; font-size: 12px; font-weight: 800; }
.card-action small { display: block; color: #675540; font-weight: 500; font-size: 10px; margin-top: 4px; }
.card-action.used { opacity: .4; }
.battle-log { min-height: 92px; font-size: 12px; line-height: 1.3; display: grid; gap: 4px; }
.battle-log div { border-bottom: 1px solid #476361; padding-bottom: 3px; }
.result { text-align: center; }
.result img { display: block; height: 210px; width: 100%; object-fit: contain; }
.notice { font-size: 12px; color: var(--muted); margin: 15px 0 0; }
@media (max-width: 370px) { .fighter { height: 210px; } .battle-scene { min-height: 265px; } .hero-card img { height: 115px; } }
input[name="invite"] { box-sizing: border-box; width: 100%; margin: 12px 0 16px; padding: 14px 16px; border: 1px solid #7ea9a4; border-radius: 12px; background: #eef3e9; color: #142d30; font: inherit; }
