/* SOLA AI 精灵训练营 · GBA 像素对战风 */
@font-face { font-family: 'Pixel'; src: url(fonts/pixel.woff2) format('woff2'); font-display: block; }
:root {
  --ink: #282830; --paper: #F8F8F0; --navy: #183B70; --red: #D22B20; --mustard: #F4B731;
  --hp-g: #58D080; --hp-y: #F8C030; --hp-r: #F05838; --line: #484858;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: #1B2440; color: var(--ink); font: 18px/1.5 'Pixel', 'PingFang SC', monospace;
  -webkit-font-smoothing: none; font-smooth: never; }
button { font: inherit; color: inherit; }
img { image-rendering: pixelated; }

/* 顶栏 */
.bar { display: flex; align-items: center; gap: 12px; max-width: 1180px; margin: 0 auto; padding: 18px 20px 14px; color: var(--paper); }
.bar b { font-size: 24px; font-weight: 400; letter-spacing: .06em; }
.sola { display: inline-block; padding: 2px 12px 3px; border-radius: 50%; background: var(--red); color: #fff; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--red);
  font: 16px/1 'Pixel'; transform: skewX(-8deg); }
.mute { margin-left: auto; padding: 4px 12px; background: transparent; border: 2px solid rgba(248, 248, 240, .5); color: var(--paper); cursor: pointer; }

/* 主区：左游戏右小票 */
.play { display: grid; grid-template-columns: minmax(0, 760px) 340px; gap: 22px; justify-content: center; max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.console { background: var(--ink); padding: 10px; border-radius: 10px; box-shadow: 0 0 0 4px #3A4468, 0 18px 40px rgba(0, 0, 0, .4); }

/* 对战画面：逻辑尺寸 480×216，按宽度整体缩放 */
.scene-wrap { position: relative; width: 100%; overflow: hidden; border-radius: 4px; }
.scene { position: absolute; left: 0; top: 0; width: 480px; height: 216px; transform-origin: 0 0; transform: scale(var(--s, 1)); overflow: hidden; font-size: 13px; line-height: 1.2; }
.sky { position: absolute; inset: 0;
  background: linear-gradient(#F8F8E8 0 34%, #E8F0D0 34% 58%, #D8E8B8 58% 100%); }
.sky::before { content: ''; position: absolute; left: 0; right: 0; top: 34%; height: 2px; background: #D0E0B0; }
.pad { position: absolute; border-radius: 50%; background: #A8D088; box-shadow: inset 0 -5px 0 #80B068, 0 0 0 2px #90C078; }
.pad-foe { left: 292px; top: 92px; width: 168px; height: 34px; }
.pad-me { left: 18px; top: 190px; width: 196px; height: 40px; }

.mon { position: absolute; transform-origin: 50% 100%; }
.mon.foe { right: 46px; bottom: 112px; height: 92px; }
.mon.me { left: 56px; bottom: 6px; height: 112px; transform: scaleX(-1); }
.mon.boss { height: 118px; right: 34px; bottom: 104px; }

/* 状态框 */
.hud { position: absolute; background: var(--paper); border: 2px solid var(--line); border-radius: 6px 2px 6px 2px; padding: 5px 9px 6px; box-shadow: 3px 3px 0 rgba(40, 40, 48, .25); }
.hud-foe { left: 14px; top: 14px; width: 200px; }
.hud-me { right: 14px; top: 124px; width: 214px; }
.hud-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.hud-top b { font-weight: 400; }
.bar-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.bar-row i { font-style: normal; font-size: 10px; color: #F8F8F0; background: #707088; padding: 1px 4px; border-radius: 2px; }
.hp { flex: 1; height: 7px; background: #505060; border: 1px solid #404048; border-radius: 3px; overflow: hidden; }
.hp span { display: block; height: 100%; width: 100%; background: var(--hp-g); transition: width .8s steps(16), background-color .2s; }
.hp span.y { background: var(--hp-y); } .hp span.r { background: var(--hp-r); }
.hud-num { text-align: right; font-size: 12px; margin-top: 2px; }
.exp { height: 4px; margin-top: 3px; background: #D8D8E0; }
.exp span { display: block; height: 100%; width: 0; background: #48A0F8; transition: width 1s steps(20); }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }

/* 动作 */
.hit { animation: hit .5s steps(2) 1; }
@keyframes hit { 0%, 40%, 80% { opacity: 0; } 20%, 60%, 100% { opacity: 1; } }
.shake { animation: shake .4s steps(4) 1; }
@keyframes shake { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
.lunge.me { animation: lungeMe .35s steps(3) 1; }
@keyframes lungeMe { 50% { translate: 18px -6px; } }
.lunge.foe { animation: lungeFoe .35s steps(3) 1; }
@keyframes lungeFoe { 50% { translate: -18px 6px; } }
.faint { animation: faint .7s steps(6) forwards; }
@keyframes faint { to { translate: 0 60px; opacity: 0; } }
.enter-me { animation: enterMe .6s steps(6) 1; }
@keyframes enterMe { from { translate: -240px 0; } }
.enter-foe { animation: enterFoe .6s steps(6) 1; }
@keyframes enterFoe { from { translate: 260px 0; } }
.flash.on { animation: flash .3s steps(2) 1; }
@keyframes flash { 50% { opacity: .85; } }

/* 对话框与招式 */
.dialog { margin-top: 10px; }
.textbox { position: relative; min-height: 112px; padding: 16px 22px 18px; background: var(--paper); border: 4px solid #F8F8F0; border-radius: 8px;
  box-shadow: inset 0 0 0 3px #6878A8, inset 0 0 0 6px var(--paper); cursor: pointer; user-select: none; }
.textbox p { margin: 0; white-space: pre-line; font-size: 24px; line-height: 1.5; }
.textbox .next { position: absolute; right: 18px; bottom: 10px; color: var(--red); visibility: hidden; animation: bob .8s steps(2) infinite; }
.textbox.wait .next { visibility: visible; }
@keyframes bob { 50% { translate: 0 3px; } }
.textbox .good { color: #208048; } .textbox .bad { color: var(--red); }

.moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; padding: 10px; background: var(--paper); border-radius: 8px; box-shadow: inset 0 0 0 3px #6878A8; }
.moves[hidden] { display: none; }
.move { position: relative; display: block; text-align: left; padding: 8px 12px 8px 26px; background: #fff; border: 2px solid #C8C8D8; border-radius: 4px; cursor: pointer; }
.move b { display: block; font-weight: 400; font-size: 24px; line-height: 1.3; }
.move small { color: #686878; font-size: 12px; }
.move:hover, .move:focus-visible { outline: none; border-color: var(--navy); }
.move:hover::before, .move:focus-visible::before { content: '▶'; position: absolute; left: 8px; top: 10px; color: var(--red); font-size: 14px; }
.move.tried { opacity: .45; }
.moves .ask { grid-column: 1 / -1; margin: 0 0 2px; font-size: 12px; color: #484858; }

/* 订单小票 */
.ticket { align-self: start; position: sticky; top: 16px; background: #FFFDF4; padding: 18px 18px 22px; border-radius: 4px; color: #2B2B30; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); font-size: 16px; }
.t-head { font-size: 24px; border-bottom: 2px dashed #B8B0A0; padding-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.t-head small { font-size: 14px; color: #888; }
.t-wish { margin: 12px 0; color: #777; }
.t-wish span { color: #2B2B30; }
.ticket ol { margin: 0; padding: 0; list-style: none; }
.ticket li { padding: 8px 0; border-bottom: 1px dashed #D8D0C0; line-height: 1.55; animation: print .5s steps(5) 1; }
.ticket li b { display: inline-block; margin-right: 6px; padding: 0 6px; background: var(--navy); color: #fff; font-weight: 400; font-size: 12px; }
@keyframes print { from { clip-path: inset(0 0 100% 0); } }
.t-empty { color: #999; margin: 10px 0 0; }

@media (max-width: 900px) {
  .play { grid-template-columns: 1fr; padding: 0 10px 30px; gap: 14px; }
  .bar { padding: 12px 12px 10px; }
  .console { padding: 6px; }
  .textbox { min-height: 104px; padding: 12px 14px 16px; }
  .textbox p { font-size: 18px; }
  .moves { grid-template-columns: repeat(2, 1fr); padding: 8px; gap: 6px; }
  .move { padding: 6px 8px 6px 22px; }
  .move b { font-size: 18px; }
  .ticket { position: static; }
}
