/* Dino Fighter. #app is a fixed 540px-high "logical screen" that main.js layout() scales (and rotates in portrait) to fit,
   so every size in here is in logical px. */
:root { --ink: #3a2418; --soft: #8a6a55; --accent: #ff7a3d; --accent-d: #c9541c; --card: #fff8ec; --gold: #ffb627;
  --fire: #ff7a3d; --leaf: #62c94a; --water: #44b0ff; --light: #ffcf33; --dark: #9a6cf0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c1410; overscroll-behavior: none; }
body { font-family: 'Mali', 'Sukhumvit Set', Thonburi, system-ui, sans-serif; font-weight: 600; color: var(--ink); touch-action: none; position: fixed; inset: 0; }
#app { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; background: #2b1d16; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ui, #pad { position: absolute; inset: 0; }
#ui { pointer-events: none; } #ui > * { pointer-events: auto; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; touch-action: none; }
.el-fire { --c: var(--fire); } .el-leaf { --c: var(--leaf); } .el-water { --c: var(--water); } .el-light { --c: var(--light); } .el-dark { --c: var(--dark); }

.btn { background: var(--accent); color: #fff; font-weight: 700; font-size: 18px; padding: 10px 18px; border-radius: 16px; box-shadow: 0 5px 0 var(--accent-d); transition: transform .06s; white-space: nowrap; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-d); }
.btn.alt { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #d9c3a6; }
.btn.alt:active { box-shadow: 0 1px 0 #d9c3a6; }
.btn.big { font-size: 22px; padding: 12px 22px; }
.btn.big small { display: block; font-size: 13px; font-weight: 600; opacity: .85; }
.btn.sm { font-size: 15px; padding: 7px 13px; border-radius: 13px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- loading ---------- */
#load { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #2b1d16; color: #ffe27a; }
#load h1 { font-size: 56px; margin: 0 0 20px; letter-spacing: 2px; }
#load .bar { width: 320px; height: 14px; background: #4a3426; border-radius: 9px; overflow: hidden; }
#load .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* ---------- title ---------- */
#title { position: absolute; inset: 0; background: linear-gradient(rgba(30,16,10,.25), rgba(30,16,10,.62)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.logo { text-align: center; transform: rotate(-3deg); animation: logoIn .5s cubic-bezier(.2,1.6,.4,1) both; }
.logo small { display: inline-block; background: var(--ink); color: #ffe27a; font-size: 20px; padding: 2px 16px; border-radius: 20px; }
.logo h1 { margin: 4px 0 0; font-size: 96px; line-height: .86; color: #ffd23d; letter-spacing: 3px;
  text-shadow: 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink), 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 9px 0 var(--accent-d), 3px 12px 0 var(--ink), -3px 12px 0 var(--ink), 0 13px 0 var(--ink); }
@keyframes logoIn { from { transform: rotate(-12deg) scale(.3); opacity: 0; } }
.modes { display: flex; gap: 14px; margin-top: 14px; }
.modes .btn { min-width: 168px; }

/* ---------- select ---------- */
#select { position: absolute; inset: 0; background: linear-gradient(#3a2a4a, #2b1d16); display: flex; flex-direction: column; padding: 12px max(18px, env(safe-area-inset-left)) 14px; gap: 10px; }
.shead { display: flex; align-items: center; gap: 14px; color: #fff; }
.shead h2 { margin: 0; font-size: 28px; flex: 1; text-align: center; color: #ffe27a; }
.shead .mode { background: rgba(255,255,255,.16); padding: 4px 14px; border-radius: 20px; font-size: 15px; }
.cards { display: flex; gap: 12px; justify-content: center; flex: none; }
.card { position: relative; flex: 1; min-width: 0; max-width: 196px; height: 216px; background: var(--card); border-radius: 20px; padding: 0; border: 5px solid transparent; box-shadow: 0 6px 0 rgba(0,0,0,.35);
  background-image: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c) 45%, #fff) 0, var(--card) 72%); transition: transform .12s; }
.card canvas { width: 92%; aspect-ratio: 264 / 250; display: block; margin: 6px auto 0; pointer-events: none; }
.card b { display: block; font-size: 22px; line-height: 1.2; }
.card em { position: absolute; top: 2px; right: 8px; font-style: normal; font-size: 22px; }
.card.on { border-color: var(--c); transform: translateY(-8px) scale(1.05); box-shadow: 0 12px 0 rgba(0,0,0,.35), 0 0 0 4px #fff; z-index: 2; }
.info { flex: 1; min-height: 0; background: var(--card); border-radius: 22px; border-left: 12px solid var(--c); display: flex; align-items: center; gap: 22px; padding: 12px 20px; }
.info .who { flex: 1; min-width: 0; }
.info h3 { margin: 0; font-size: 30px; line-height: 1.15; } .info h3 small { font-size: 16px; color: var(--soft); font-weight: 600; margin-left: 6px; }
.info p { margin: 4px 0 0; font-size: 16px; color: var(--soft); }
.mvl { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; margin-top: 6px; font-size: 15px; }
.mvl i { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvl span { display: inline-block; min-width: 62px; text-align: center; background: var(--c); color: #fff; border-radius: 9px; padding: 0 7px; font-size: 13px; margin-right: 6px; }
.mvl span.u { background: var(--ink); color: #ffe27a; }
.info .mv span { background: var(--c); color: #fff; border-radius: 9px; padding: 1px 9px; font-size: 14px; } .info .mv span.u { background: var(--ink); color: #ffe27a; }
.stats { flex: none; width: 190px; display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 15px; } .stat span { width: 40px; }
.stat i { display: flex; gap: 4px; } .stat b { width: 22px; height: 13px; border-radius: 5px; background: #e6d5bd; } .stat b.on { background: var(--c); }
.go { flex: none; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.diff { display: flex; background: #e6d5bd; border-radius: 14px; padding: 4px; gap: 4px; }
.diff button { flex: 1; background: none; border-radius: 11px; padding: 5px 12px; font-size: 15px; font-weight: 700; color: var(--soft); }
.diff button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 0 #cdb696; }

/* ---------- VS splash ---------- */
#vs { position: absolute; left: 0; right: 0; top: 150px; text-align: center; pointer-events: none; animation: vsOut .4s 1.1s both; }
#vs .l, #vs .r { display: inline-block; background: var(--c); color: #fff; font-size: 34px; font-weight: 700; padding: 4px 26px; border-radius: 16px; border: 4px solid #fff; box-shadow: 0 6px 0 rgba(0,0,0,.3); }
#vs .l { animation: vsL .35s both; } #vs .r { animation: vsR .35s both; }
#vs b { font-size: 54px; color: #ffe27a; margin: 0 16px; -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 var(--ink); vertical-align: middle; }
#vs p { color: #fff; font-size: 18px; margin: 10px 0 0; text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink); }
@keyframes vsL { from { transform: translateX(-400px); } } @keyframes vsR { from { transform: translateX(400px); } } @keyframes vsOut { to { opacity: 0; transform: scale(1.2); } }

/* ---------- touch controls ---------- */
#stickZone { position: absolute; left: 0; top: 96px; bottom: 0; width: 46%; }
#stick { position: absolute; left: 118px; top: 400px; width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%; pointer-events: none;
  background: rgba(255,255,255,.14); border: 3px solid rgba(255,255,255,.4); opacity: .55; transition: opacity .15s; }
#stick.on { opacity: 1; }
#stick i { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.pb { position: absolute; border-radius: 50%; font-weight: 700; font-size: 21px; color: #fff; background: color-mix(in srgb, var(--k) 62%, transparent);
  border: 4px solid rgba(255,255,255,.8); text-shadow: 0 2px 0 rgba(0,0,0,.45); box-shadow: 0 5px 0 rgba(0,0,0,.25); }
.pb.on { transform: scale(.9); background: var(--k); box-shadow: 0 0 0 6px rgba(255,255,255,.35); }
#bA { --k: #ff5a4d; width: 100px; height: 100px; right: calc(138px + env(safe-area-inset-right)); bottom: 18px; }
#bB { --k: #ff9a2e; width: 100px; height: 100px; right: calc(22px + env(safe-area-inset-right)); bottom: 86px; }
#bS { --k: #3f9dff; width: 86px; height: 86px; right: calc(150px + env(safe-area-inset-right)); bottom: 132px; font-size: 19px; }
#bG { --k: #5d6b7a; width: 84px; height: 84px; right: calc(254px + env(safe-area-inset-right)); bottom: 18px; }
#bX { --k: #8a5cf0; width: 84px; height: 84px; right: calc(34px + env(safe-area-inset-right)); bottom: 200px; opacity: .3; }
#bX.ready { opacity: 1; --k: #ffb627; animation: ultPulse .5s ease-in-out infinite alternate; }
@keyframes ultPulse { to { box-shadow: 0 0 0 10px rgba(255,214,90,.5), 0 0 30px 8px #ffd65a; transform: scale(1.08); } }
#bPause { position: absolute; left: 50%; top: 74px; width: 40px; height: 34px; margin-left: -20px; border-radius: 11px; background: rgba(255,255,255,.55); font-size: 16px; padding: 0; }
@media (hover: hover) and (pointer: fine) { #stick { display: none; } .pb { opacity: .5; } #bX.ready { opacity: 1; } }

/* ---------- modal ---------- */
#modal { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(30,16,10,.6); z-index: 50; }
#modal.on { display: flex; }
#modal .box { background: var(--card); border-radius: 26px; padding: 16px 26px 20px; min-width: 380px; max-width: 640px; max-height: 510px; text-align: center; animation: pop .22s cubic-bezier(.2,1.5,.4,1);
  display: flex; flex-direction: column; gap: 10px; align-items: center; border: 5px solid #fff; box-shadow: 0 10px 0 rgba(0,0,0,.3); }
#modal h2 { margin: 0; font-size: 32px; }
#modal .tip { margin: 0; color: var(--soft); font-size: 17px; }
#modal .btn.big { min-width: 240px; }
#resArt { width: 170px; height: 147px; margin: -6px 0 -8px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.help { text-align: left; font-size: 16.5px; line-height: 1.35; display: flex; flex-direction: column; gap: 5px; }
.help .k { display: inline-block; min-width: 54px; text-align: center; color: #fff; border-radius: 10px; padding: 0 8px; margin-right: 4px; }
.help .k.a { background: #ff5a4d; } .help .k.b { background: #ff9a2e; } .help .k.s { background: #3f9dff; } .help .k.g { background: #5d6b7a; } .help .k.x { background: #ffb627; }
.help .pc { color: var(--soft); font-size: 14px; margin-top: 2px; }

#bX.ex { opacity: .9; --k: #8a5cf0; }
/* move list */
.moves { display: flex; gap: 18px; text-align: left; font-size: 15px; }
.moves table { border-collapse: collapse; } .moves th { text-align: left; color: var(--soft); font-size: 14px; padding-bottom: 2px; }
.moves td { padding: 2px 8px 2px 0; white-space: nowrap; } .moves td b { color: var(--accent-d); }
.moves em { font-style: normal; font-size: 12px; background: #e6d5bd; border-radius: 6px; padding: 0 5px; } .moves em.lo { background: #ffd2a8; } .moves em.hi { background: #ffc4c4; }
/* combo trials */
#trial { position: absolute; left: 16px; top: 92px; background: rgba(30,18,12,.72); color: #fff; border-radius: 14px; padding: 6px 10px 8px; max-width: 46%; pointer-events: auto; }
#trial .th { display: flex; align-items: center; gap: 6px; font-size: 15px; } #trial .th b { flex: 1; color: #ffe27a; }
#trial .th button { background: rgba(255,255,255,.2); border-radius: 8px; width: 30px; height: 26px; font-size: 13px; padding: 0; }
#trial .steps { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; margin-top: 4px; font-size: 15px; }
#trial .steps span { background: rgba(255,255,255,.16); border-radius: 8px; padding: 1px 8px; } #trial .steps span.ok { background: #4cc46b; }
#trial .steps i { font-style: normal; opacity: .6; } #trial.done { box-shadow: 0 0 0 3px #7dff9a; }

/* online */
.btn.net { background: linear-gradient(#4fb3ff, #2e86d8); box-shadow: 0 5px 0 #1d5f9e; color: #fff; }
#modal .code { font-size: 64px; font-weight: 700; letter-spacing: 14px; color: var(--accent-d); margin: 2px 0 6px; padding-left: 14px; }
#modal .join { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
#modal .join input { width: 150px; font: 700 30px Mali, sans-serif; text-align: center; letter-spacing: 8px; border: 3px solid #e6d5bd; border-radius: 14px; background: #fff; color: var(--ink); text-transform: uppercase; }
#modal .wait { animation: pulse 1.2s infinite alternate; } @keyframes pulse { from { opacity: .45; } }

/* voice chat */
#micB { position: absolute; z-index: 60; left: 50%; top: 74px; margin-left: 28px; height: 34px; padding: 0 10px 0 8px; border-radius: 11px; background: rgba(255,255,255,.55); font-size: 17px; display: flex; align-items: center; gap: 4px; }
#micB[hidden] { display: none; }
#micB small { font-size: 12px; color: var(--ink); } #micB i { font-style: normal; font-size: 14px; animation: pulse .8s infinite alternate; }
#micB.on { background: #7dde8f; }
body[data-screen=select] #micB { top: 10px; left: 160px; margin: 0; }
body[data-screen=title] #micB { top: 14px; left: 16px; margin: 0; }
.toast { position: absolute; z-index: 70; left: 50%; top: 118px; transform: translateX(-50%); background: rgba(30,18,12,.82); color: #fff; padding: 6px 16px; border-radius: 14px; font-size: 16px; pointer-events: none; animation: pop .2s; }

#trial .th button.demo { width: auto; padding: 0 8px; background: #ff5ac8; font-weight: 700; }
#trial { max-width: 60%; }
