:root {
  --bg: #0f1b2d;
  --panel: #182a44;
  --panel-2: #20365a;
  --panel-3: #0d1a2c;
  --line: #2f4d7a;
  --text: #eef3fb;
  --muted: #9fb2cf;
  --accent: #ffb020;
  --accent-2: #ff7a1a;
  --danger: #e5484d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  height: 100dvh;
  background: radial-gradient(circle at 50% 0%, #1f3a63, var(--bg) 70%);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}
button { touch-action: manipulation; }

.screen { display: none; height: 100%; }
.screen.active { display: flex; align-items: center; justify-content: center; padding: 8px; }
#screen-game.active { flex-direction: column; align-items: stretch; padding: 0; }

.panel {
  background: rgba(24, 42, 68, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.center-panel { text-align: center; width: min(400px, 100%); }
.wide-panel { width: min(860px, 100%); max-height: 100%; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

.logo { font-size: clamp(30px, 9vw, 42px); line-height: 1.1; margin: 0 0 4px; letter-spacing: -1px; font-weight: 900; }
.logo span { color: var(--accent); }
.logo small { font-size: 16px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pts { color: #ffd25a; white-space: nowrap; }
.pts.big { font-size: 20px; }

input {
  background: var(--panel-3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  flex: 1;
  min-width: 0;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#loginForm { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: transparent; color: #2a1600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.gap-l { gap: 24px; }
.actions { margin-top: 18px; flex-wrap: wrap; }

/* fundo animado */
#bgfx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#bgfx i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(70px); opacity: .35; animation: drift 22s ease-in-out infinite alternate; }
#bgfx i:nth-child(1) { background: #ff7a1a; left: -20vmax; top: -25vmax; }
#bgfx i:nth-child(2) { background: #3e8ef7; right: -25vmax; top: 10vmax; animation-delay: -7s; }
#bgfx i:nth-child(3) { background: #a855f7; left: 20vmax; bottom: -35vmax; animation-delay: -14s; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

/* palco 3D */
.stage-slot {
  position: relative; overflow: hidden; border-radius: 14px; flex: none;
  background: radial-gradient(ellipse at 50% 35%, #4aa3e8 0%, #2a5d9a 55%, #17304f 100%);
}
.stage-slot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-slot.has-3d .fallback2d { display: none; }
.stage-slot .fallback2d { object-fit: contain; }
.stage-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; font-weight: 800; font-size: 14px;
  background: linear-gradient(transparent, rgba(5,10,20,.75)); text-align: center; pointer-events: none;
}

/* lobby */
.hero { display: flex; gap: 16px; align-items: center; background: var(--panel-2); border-radius: 14px; padding: 10px; margin-bottom: 14px; }
.hero-stage { width: 200px; height: 190px; }
.hero-info { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: start; }
.hero-info p { margin: 0; }
.hero-info h2 { margin: 0; font-size: 26px; }
.profile-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.shop-top { display: flex; gap: 14px; align-items: center; }
.shop-stage { width: 150px; height: 140px; }

.room-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.room-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.room-list .empty { justify-content: center; color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--muted); margin-left: 8px; }
.tag.live { color: var(--accent); }

/* loja */
.tabs { display: flex; gap: 6px; margin: 10px 0 12px; flex-wrap: wrap; }
.tab { background: var(--panel-3); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--accent); color: #2a1600; border-color: transparent; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.card { background: var(--panel-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; }
.card.owned { border-color: #2f7a4a; }
.card .ic { font-size: 34px; line-height: 1; }
.card canvas { width: 70px; height: 80px; align-self: center; }
.card h4 { margin: 0; font-size: 16px; }
.card p { margin: 0; font-size: 12px; color: var(--muted); flex: 1; }
.card .stats { font-size: 12px; color: #cfe0ff; }
.pips { display: flex; gap: 3px; }
.pips i { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-3); }
.pips i.on { background: #ffd25a; }

/* sala */
.map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.map-card { background: var(--panel-2); border: 2px solid transparent; border-radius: 10px; padding: 8px; color: var(--text); font: inherit; text-align: center; cursor: pointer; }
.map-card .ic { font-size: 28px; display: block; }
.map-card b { font-size: 13px; display: block; }
.map-card span { font-size: 11px; color: var(--muted); }
.map-card.sel { border-color: var(--accent); background: #3d3218; }
.map-card:disabled { cursor: default; opacity: 1; }
.map-card:disabled:not(.sel) { opacity: .5; }

.segmented { display: inline-flex; background: var(--panel-3); border-radius: 10px; padding: 3px; gap: 3px; }
.segmented button { background: transparent; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.segmented button.sel { background: var(--panel-2); color: var(--text); }
.segmented button:disabled { cursor: default; }

.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.team { background: var(--panel-2); border-radius: 12px; padding: 10px; border-top: 5px solid var(--tc); display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.team-head { display: flex; align-items: center; gap: 6px; }
.team-head .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--tc); flex: none; }
.team-head input { padding: 4px 8px; font-weight: 700; }
.team-head h4 { margin: 0; flex: 1; font-size: 15px; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatches button { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches button.sel { border-color: #fff; }
.swatches button:disabled { opacity: .2; cursor: not-allowed; }
.team { min-width: 0; }
.team ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; flex: 1; align-content: start; }
.team li { display: flex; align-items: center; gap: 6px; background: var(--panel-3); padding: 4px 6px; border-radius: 8px; min-width: 0; }
.team li canvas { width: 30px; height: 34px; flex: none; }
.team li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.team li .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 4px; }
.team-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.add-team { border: 2px dashed var(--line); background: transparent; color: var(--muted); border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer; min-height: 140px; }

/* assistente da sala */
.wizard { width: min(1000px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 4px; }
.steps li {
  flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; cursor: pointer;
  color: var(--muted); background: var(--panel-3); position: relative; min-width: 0;
}
.steps li span {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel-2); font-weight: 800; font-size: 13px;
}
.steps li b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li.done span { background: #2f7a4a; color: #fff; }
.steps li.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -3px 0 var(--accent); }
.steps li.active span { background: var(--accent); color: #2a1600; }

.wiz-body { display: grid; grid-template-columns: 300px 1fr; gap: 16px; flex: 1; min-height: 0; }
.wiz-stage { width: 100%; height: 100%; min-height: 260px; }
.wiz-content { min-height: 0; overflow: auto; padding-right: 4px; }
.step-pane { display: none; }
.step-pane.active { display: block; }
.step-pane h3 { margin: 4px 0 8px; font-size: 18px; }
.step-pane h3 + p { margin-top: -4px; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.pick {
  background: var(--panel-2); border: 2px solid transparent; border-radius: 12px; padding: 8px; cursor: pointer;
  color: var(--text); font: inherit; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px;
  position: relative; transition: translate .15s, border-color .15s;
}
.pick:hover { translate: 0 -2px; }
.pick.sel { border-color: var(--accent); background: #3d3218; }
.pick.locked { background: var(--panel-3); }
.pick.locked .ic, .pick.locked canvas { filter: grayscale(.9) brightness(.7); }
.pick .ic { font-size: 30px; line-height: 1.1; }
.pick canvas { width: 56px; height: 64px; }
.pick b { font-size: 13px; }
.pick small { font-size: 11px; color: var(--muted); }
.pick .lock { position: absolute; top: 4px; right: 6px; font-size: 12px; }
.pick .buy { margin-top: 4px; padding: 3px 8px; font-size: 12px; }

.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.summary div { background: var(--panel-2); border-radius: 12px; padding: 10px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.summary .ic { font-size: 26px; }
.summary small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.ready-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ready-list li { display: flex; align-items: center; gap: 8px; background: var(--panel-3); border-radius: 10px; padding: 6px 10px; }
.ready-list .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ready-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ready-list .st { font-size: 12px; font-weight: 700; color: var(--muted); }
.ready-list .st.ok { color: #46c46a; }

.wiz-nav { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.wiz-nav #roomHint { flex: 1; text-align: center; }
#readyBtn.on { background: #2f7a4a; border-color: #46c46a; }

.badge { background: var(--danger); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; }
.badge:empty { display: none; }

.over-stage { width: 100%; height: 170px; margin-bottom: 8px; }

@media (max-width: 760px) {
  .wiz-body { grid-template-columns: 1fr; grid-template-rows: 170px auto; }
  .wiz-stage { min-height: 0; }
  .steps li b { display: none; }
  .steps li { justify-content: center; }
}
@media (max-width: 560px) {
  .panel { padding: 14px; }
  .hero { flex-direction: column; align-items: stretch; }
  .hero-stage { width: 100%; height: 170px; }
  .shop-stage { width: 110px; height: 110px; }
}

/* ---------- jogo ---------- */
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#banner {
  position: absolute; left: 0; right: 0; top: 32%; text-align: center;
  font-size: clamp(28px, 7vw, 54px); font-weight: 900; color: #fff; opacity: 0; pointer-events: none;
  text-shadow: 0 4px 0 var(--accent-2), 0 8px 30px rgba(0,0,0,.6);
  transition: opacity .25s;
  white-space: nowrap;
}
#banner.show { opacity: 1; }

#feed { position: absolute; right: 12px; top: 64px; list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; pointer-events: none; max-width: 45%; }
#feed li { background: rgba(10,20,35,.75); padding: 4px 10px; border-radius: 6px; font-size: 13px; text-align: right; transition: opacity .6s; }

#overlay { position: absolute; inset: 0; background: rgba(5,10,20,.6); display: flex; align-items: center; justify-content: center; padding: 8px; z-index: 5; }
#overlay.hidden { display: none; }
.over-panel { max-height: 100%; overflow: auto; width: min(460px, 100%); }
#rewards { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 13px; }
#rewards th { color: var(--muted); font-weight: 600; text-align: right; padding: 4px; }
#rewards td { padding: 4px; text-align: right; border-top: 1px solid var(--line); }
#rewards th:first-child, #rewards td:first-child { text-align: left; }
#rewards tr.me td { color: #ffd25a; font-weight: 700; }
#rewards .tdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

#rotate { display: none; position: absolute; inset: 0; z-index: 9; background: rgba(5,10,20,.92); align-items: center; justify-content: center; text-align: center; font-size: 22px; font-weight: 700; padding: 20px; }

#hud {
  display: grid; grid-template-columns: 240px 1fr auto; gap: 18px; align-items: center;
  background: linear-gradient(180deg, #1b2f4f, #12223a); border-top: 2px solid var(--line);
  padding: 10px 16px; height: 112px;
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.hud-stats { display: grid; gap: 6px; }
.stat { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bar { position: relative; height: 16px; background: #0b1626; border-radius: 99px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; transition: width .2s; }
.bar span { position: relative; font-size: 11px; color: #fff; padding-left: 8px; font-weight: 700; line-height: 16px; white-space: nowrap; }
.bar.hp i { background: linear-gradient(90deg, #2fae55, #6fe08c); }
.bar.en i { background: linear-gradient(90deg, #d79a12, #ffd25a); }
.bar.rage i { background: linear-gradient(90deg, #c2246d, #ff5ca8); }
.bar.rage.full i { animation: pulse .6s infinite alternate; }
@keyframes pulse { to { filter: brightness(1.6); } }

kbd { background: #0b1626; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 11px; color: var(--text); }

.hud-aim { display: grid; gap: 8px; min-width: 0; }
.aim-top { display: flex; gap: 16px; align-items: center; }
.angle { font-size: 13px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.angle .wicon { font-size: 20px; }
.angle b { font-size: 22px; color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#powerBar {
  position: relative; height: 26px; border-radius: 6px; overflow: hidden;
  background: repeating-linear-gradient(90deg, #0b1626 0 calc(10% - 1px), #22395c calc(10% - 1px) 10%);
  border: 1px solid var(--line);
}
#powerFill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #36c46b, #ffd25a 60%, #ff4d3a); }
#powerMark { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #fff; box-shadow: 0 0 6px #fff; display: none; }
#powerText { position: absolute; right: 8px; top: 3px; font-weight: 800; font-size: 14px; }

.hud-items { display: flex; gap: 8px; }
.item {
  width: 70px; height: 78px; border-radius: 10px; background: var(--panel-2); border: 2px solid var(--line);
  color: var(--text); font: inherit; font-size: 11px; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px;
}
.item .ic { font-size: 22px; line-height: 1; }
.item .cost { color: #ffd25a; font-size: 10px; }
.item kbd { position: absolute; top: 3px; left: 4px; }
.item.on { border-color: var(--accent); background: #3d3218; }
.item:disabled { opacity: .4; cursor: not-allowed; }

/* controles de toque */
#touch { display: none; }
body.touch #touch { display: block; }
body.touch .hint, body.touch kbd { display: none; }
#touch button {
  width: 50px; height: 50px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  background: rgba(15,27,45,.55); color: #fff; font-size: 20px; font-weight: 800;
  touch-action: none; user-select: none; -webkit-user-select: none; backdrop-filter: blur(2px);
}
#touch button.down { background: rgba(255,176,32,.7); border-color: #fff; }
.tc { position: absolute; display: flex; gap: 8px; z-index: 3; }
.tc-move { left: max(8px, env(safe-area-inset-left)); bottom: 10px; }
.tc-aim { right: calc(max(8px, env(safe-area-inset-right)) + 84px); bottom: 10px; flex-direction: column; }
.tc-extra { right: max(8px, env(safe-area-inset-right)); top: 8px; }
.tc-extra button { width: 40px !important; height: 40px !important; font-size: 16px !important; }
#touch .tc-fire {
  position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: 12px; z-index: 3;
  width: 74px; height: 74px; font-size: 30px; background: rgba(229,72,77,.65);
}
body.touch #feed { top: 56px; }

/* celular deitado ou tela estreita: HUD fino */
@media (max-height: 520px), (max-width: 700px) {
  #hud { height: 54px; grid-template-columns: 150px 1fr auto; gap: 10px; padding-top: 4px; padding-bottom: 4px; }
  .hud-stats { gap: 3px; }
  .stat { grid-template-columns: 1fr; }
  .stat label { display: none; }
  .bar { height: 13px; }
  .bar span { font-size: 9px; line-height: 13px; padding-left: 6px; }
  .hud-aim { gap: 3px; }
  .aim-top { gap: 8px; }
  .angle b { font-size: 15px; }
  .angle .wicon { font-size: 14px; }
  .hint { display: none; }
  #powerBar { height: 18px; }
  #powerText { top: 0; font-size: 12px; }
  .hud-items { gap: 4px; }
  .item { width: 42px; height: 44px; font-size: 0; gap: 0; border-radius: 8px; }
  .item .ic { font-size: 18px; }
  .item .cost { font-size: 9px; }
  .item kbd { display: none; }
  #touch button { width: 44px; height: 44px; font-size: 18px; }
  .tc-aim { right: calc(max(8px, env(safe-area-inset-right)) + 72px); gap: 6px; }
  #touch .tc-fire { width: 62px; height: 62px; font-size: 26px; }
  #feed li { font-size: 11px; }
}

/* menus em tela baixa (celular deitado): mais compactos */
@media (max-height: 520px) and (orientation: landscape) {
  .panel { padding: 12px 14px; }
  .panel-head { margin-bottom: 6px; }
  .panel-head h2 { font-size: 20px; }
  .section-title { margin: 10px 0 6px; }
  .map-list { grid-auto-flow: column; grid-auto-columns: 96px; grid-template-columns: none; overflow-x: auto; padding-bottom: 4px; }
  .map-card { padding: 6px; }
  .map-card .ic { font-size: 22px; }
  .map-card span:not(.ic) { display: none; }
  .hero { padding: 6px; margin-bottom: 8px; }
  .hero-stage { width: 150px; height: 130px; }
  .hero-info h2 { font-size: 20px; }
  .wizard { padding: 10px 12px; }
  .steps { margin-bottom: 8px; }
  .steps li { padding: 4px 6px; }
  .wiz-body { grid-template-columns: 210px 1fr; grid-template-rows: none; gap: 10px; }
  .wiz-stage { min-height: 0; }
  .wiz-nav { margin-top: 8px; padding-top: 8px; }
  .step-pane h3 { font-size: 15px; margin-bottom: 6px; }
  .pick-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .pick .ic { font-size: 24px; }
  .over-stage { height: 110px; }
}

@media (orientation: portrait) {
  body.touch #rotate { display: flex; }
}

@media (max-width: 1000px) and (min-width: 701px) and (min-height: 521px) {
  #hud { grid-template-columns: 1fr; height: auto; gap: 8px; }
  .hud-items { flex-wrap: wrap; }
}

body.in-game #bgfx { display: none; }

/* tela de entrada */
.login-stage { width: 100%; height: 210px; margin-bottom: 14px; }
.is-hidden { display: none !important; }
@media (max-height: 520px) and (orientation: landscape) {
  .login-panel { display: grid; grid-template-columns: 220px 1fr; gap: 0 16px; align-items: center; text-align: left; width: min(640px, 100%); }
  .login-stage { grid-row: span 4; height: 220px; margin: 0; }
  .login-panel .auth-tabs { justify-content: flex-start; margin: 8px 0; }
}

/* miniaturas 3D dos cards */
.thumb3d { width: 76px; height: 76px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); pointer-events: none; user-select: none; }
.card .thumb3d { width: 92px; height: 92px; align-self: center; }
.pick .thumb3d { width: 64px; height: 64px; }
.pick.locked .thumb3d { filter: grayscale(.85) brightness(.7) drop-shadow(0 6px 8px rgba(0,0,0,.45)); }

/* contas */
.auth-tabs { justify-content: center; margin: 14px 0 10px; }
#authForm { display: flex; flex-direction: column; gap: 10px; }
.auth-error { color: #ff8a8f; min-height: 1.2em; margin: 8px 0 0; }
#loginForm { display: none; }

/* lobby */
.lobby-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#codeInput { text-transform: uppercase; letter-spacing: .25em; font-weight: 800; }
#codeInput::placeholder { letter-spacing: normal; font-weight: 400; text-transform: none; }
#codeInput.shake { animation: shake .4s; border-color: var(--danger); }
@keyframes shake { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
.room-list .owner { font-size: 12px; color: var(--muted); margin-left: 8px; }
.room-list .code { font-family: ui-monospace, monospace; letter-spacing: .15em; color: #ffd25a; }
.room-list .acts { display: flex; gap: 6px; align-items: center; }
.tag.mine { color: #46c46a; }
@media (max-width: 640px) { .lobby-actions { grid-template-columns: 1fr; } }
.lobby-actions > * { min-width: 0; }

/* código da sala no topo */
.room-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.code-chip {
  background: var(--panel-3); border: 1px dashed var(--accent); color: var(--text); border-radius: 99px;
  padding: 4px 12px; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.code-chip b { font-family: ui-monospace, monospace; letter-spacing: .2em; color: #ffd25a; }
.code-chip.copied span::after { content: ' copiado!'; color: #46c46a; font-size: 12px; }

/* espaço e emoji na dificuldade dos bots */
.step-pane h3.spaced { margin-top: 22px; }
.segmented { gap: 6px; padding: 5px; }
.segmented button { padding: 8px 18px; display: inline-flex; align-items: center; gap: 8px; }
.segmented button .em { font-size: 18px; }

/* chat flutuante no canto direito: mensagens sobem */
.chat-dock {
  position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: 14px; z-index: 20;
  width: min(320px, calc(100vw - 28px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.chat-dock #chatLog {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  max-height: 46vh; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%);
}
.chat-dock:hover #chatLog, .chat-dock:focus-within #chatLog { overflow-y: auto; pointer-events: auto; -webkit-mask-image: none; mask-image: none; }
.chat-dock li {
  align-self: flex-end; max-width: 100%; background: rgba(13, 26, 44, 0.88); border: 1px solid var(--line);
  border-left: 3px solid var(--tc, var(--accent)); border-radius: 12px 12px 4px 12px; padding: 6px 10px; font-size: 13px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); word-wrap: break-word; transition: opacity .8s;
}
.chat-dock li.me { border-left-color: transparent; border-right: 3px solid var(--accent); }
.chat-dock li b { color: var(--tc, var(--accent)); margin-right: 4px; }
.chat-dock li.old { opacity: 0; }
.chat-dock:hover li.old, .chat-dock:focus-within li.old { opacity: 1; }
.chat-input { display: flex; gap: 6px; pointer-events: auto; }
.chat-input input { border-radius: 99px; background: rgba(13, 26, 44, 0.92); padding: 10px 14px; }
.chat-input button {
  width: 42px; height: 42px; border-radius: 50%; border: 0; flex: none; cursor: pointer; font-size: 16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #2a1600;
}
@media (max-height: 520px) and (orientation: landscape) {
  .chat-dock { width: 240px; bottom: 8px; }
  .chat-dock #chatLog { max-height: 34vh; }
  .chat-input input { padding: 7px 12px; }
  .chat-input button { width: 34px; height: 34px; }
}
@media (max-width: 760px) and (min-height: 521px) {
  .chat-dock { width: 220px; }
}

/* partida 3D: WebGL embaixo, canvas 2D (nomes, mira, HUD) por cima */
#canvas3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#stage #canvas { position: absolute; inset: 0; z-index: 1; }
.view-btn {
  position: absolute; z-index: 4; top: 12px; right: 12px; padding: 4px 10px; border-radius: 99px; cursor: pointer;
  background: rgba(10, 22, 40, 0.75); border: 1px solid var(--line); color: #fff; font: inherit; font-weight: 800; font-size: 12px;
}
.view-btn.on { border-color: var(--accent); color: #ffd25a; }
body.touch .view-btn { right: calc(max(8px, env(safe-area-inset-right)) + 144px); top: 14px; }

/* ---------- celular em pé / telas estreitas ---------- */
@media (max-width: 560px) {
  .screen.active { padding: 6px; align-items: stretch; }
  .panel { border-radius: 12px; }
  .wide-panel, .wizard { max-height: 100%; }
  .panel-head { flex-wrap: wrap; row-gap: 8px; }
  .panel-head h2 { font-size: 19px; }
  .room-title { flex: 1 1 100%; order: -1; flex-wrap: wrap; }
  .room-title h2 { flex: 1; min-width: 0; }
  .hero-info { justify-items: stretch; }
  .hero-info .row { justify-content: flex-start; }
  .room-list li { flex-wrap: wrap; gap: 6px; }
  .room-list li > span:first-child { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  .room-list .tag, .room-list .owner { margin-left: 0; }
  .room-list .acts { margin-left: auto; }
  .lobby-actions .btn { padding: 10px 12px; }
  .pick-grid { grid-template-columns: repeat(2, 1fr); }
  .pick small:nth-of-type(2) { display: none; }
  .wiz-nav { flex-wrap: wrap; }
  .wiz-nav #roomHint { order: -1; flex: 1 1 100%; }
  .wiz-nav .btn { flex: 1; }
  .teams { grid-template-columns: 1fr; }
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 10px; }
}

/* HUD em tela estreita (em pé): status e mira lado a lado, itens embaixo */
@media (max-width: 700px) and (min-height: 521px) {
  #hud { height: auto; grid-template-columns: 1fr 1.3fr; grid-template-areas: 'stats aim' 'items items'; gap: 6px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .hud-stats { grid-area: stats; }
  .hud-aim { grid-area: aim; }
  .hud-items { grid-area: items; justify-content: space-between; }
  .item { flex: 1; width: auto; }
}

/* aviso de girar: dá para dispensar e jogar em pé */
#rotate button { margin-top: 16px; font-size: 15px; }
body.allow-portrait #rotate { display: none !important; }

/* chat: no celular vira um botão que abre o painel */
.chat-toggle { display: none; }
@media (max-width: 760px), (pointer: coarse) {
  .chat-dock { bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px)); width: min(280px, calc(100vw - 28px)); align-items: flex-end; }
  .chat-toggle {
    display: grid; place-items: center; position: relative; pointer-events: auto; width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--line); background: rgba(13, 26, 44, 0.92); color: #fff; font-size: 20px; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.4);
  }
  .chat-toggle .badge { position: absolute; top: -4px; right: -4px; }
  .chat-dock:not(.open) .chat-input { display: none; }
  .chat-dock .chat-input { width: 100%; }
  /* fechado: só as 3 últimas mensagens, que somem rápido */
  .chat-dock:not(.open) #chatLog li:nth-last-child(n+4) { display: none; }
  .chat-dock.open #chatLog { overflow-y: auto; pointer-events: auto; -webkit-mask-image: none; mask-image: none; max-height: 40vh; }
  .chat-dock.open li.old { opacity: 1; }
  .chat-dock #chatLog { width: 100%; }
}

/* legenda sobre o canvas 3D */
.stage-caption { z-index: 2; }
/* tela de entrada sempre centralizada */
#screen-login.active { align-items: center; }
/* partida em pé no celular: botões extras em coluna, longe do vento e do placar */
@media (orientation: portrait) {
  body.touch .tc-extra { flex-direction: column; top: 72px; }
  body.touch .view-btn { right: max(10px, env(safe-area-inset-right)); top: 214px; }
}
