/* Interface do Primórdia Online — estilo janela de RPG, pensada para toque na horizontal. */
:root {
  --win-top: #22324a;
  --win-bottom: #141d2c;
  --gold: #e8c77d;
  --gold-dark: #8a6a2c;
  --border-soft: rgba(232, 199, 125, 0.4);
  --text: #fdf7ea;
  --muted: #b3bccb;
  --accent: #ffcf5a;
  --hp: #ff5d6c;
  --mp: #4fa3ff;
  --xp: #b98cff;
  --danger: #ff6b6b;
  --ok: #7be38b;
  --slot: rgba(8, 12, 20, 0.55);
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0d1612; color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- Janela de RPG ---------- */
.window {
  position: relative;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  border: 2px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(20, 14, 6, 0.85), 0 0 0 4px var(--gold-dark), 0 14px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 30px rgba(0, 0, 0, 0.35);
  padding: 16px;
}
.window::before, .window::after {
  content: ""; position: absolute; width: 14px; height: 14px; top: -7px;
  background: radial-gradient(circle at 35% 35%, #fff4c9, var(--gold) 45%, var(--gold-dark));
  transform: rotate(45deg); border: 1px solid #3a2a10; pointer-events: none;
}
.window::before { left: -7px; }
.window::after { right: -7px; }
.win-title { margin: 0 0 12px; font-size: 19px; color: var(--accent); letter-spacing: 0.5px; text-shadow: 0 2px 0 #3a2506; }
.win-title.danger { color: var(--danger); }

.btn {
  position: relative; font: inherit; font-weight: bold; font-size: 16px; color: var(--text);
  background: linear-gradient(180deg, #4a5f7a, #2c3a4f 55%, #233044);
  border: 2px solid var(--border-soft); border-radius: 11px; padding: 10px 18px; min-height: 44px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 0 rgba(0, 0, 0, 0.35); text-shadow: 0 1px 1px #000;
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn.primary { background: linear-gradient(180deg, #ffe08a, #f0b23e 55%, #d9922a); color: #3a2506; border-color: #fff1c4; text-shadow: none; }
.btn.danger { background: linear-gradient(180deg, #e06565, #a83a3a); }
.btn.good { background: linear-gradient(180deg, #6fd88a, #2f9a52); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { font-size: 14px; min-height: 36px; padding: 6px 12px; }
.btn:disabled { opacity: 0.45; filter: grayscale(0.6); }

input, select {
  font: inherit; font-size: 16px; color: var(--text);
  background: rgba(0, 0, 0, 0.4); border: 2px solid var(--border-soft); border-radius: 10px;
  padding: 9px 12px; width: 100%; min-height: 44px; user-select: text; -webkit-user-select: text;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 10px rgba(255, 207, 90, 0.35); }
label { display: block; font-size: 14px; color: var(--muted); margin: 8px 0; }
label input { margin-top: 4px; }
.row { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.row > * { flex: 1; }
.msg { min-height: 20px; margin: 10px 0 0; font-size: 14px; color: var(--danger); text-align: center; }
.msg.ok { color: var(--ok); }

/* ---------- Telas de entrada ---------- */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: calc(10px + var(--sat)) calc(16px + var(--sar)) calc(10px + var(--sab)) calc(16px + var(--sal));
  background: radial-gradient(ellipse at 50% 40%, rgba(10, 20, 15, 0.15), rgba(6, 10, 8, 0.7));
  overflow-y: auto; touch-action: pan-y;
}
.title-block { text-align: center; }
.logo { margin: 0; line-height: 1; }
.logo-main {
  display: block; font-size: clamp(36px, 7vw, 56px); font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff6d0 10%, #ffd36b 45%, #e09a2a 70%, #fff0b0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a3508) drop-shadow(0 0 14px rgba(255, 200, 90, 0.55));
}
.logo-sub { display: block; font-size: 15px; letter-spacing: 10px; color: #fff; text-shadow: 0 2px 6px #000; margin-top: 4px; }
.subtitle { margin: 6px 0 0; color: #dfe9d8; text-shadow: 0 1px 4px #000; font-style: italic; }
.login-panel { width: min(380px, 100%); }
.server-box { margin-top: 12px; font-size: 13px; color: var(--muted); }
.server-box summary { cursor: pointer; padding: 6px 0; }

.chars-panel { width: min(760px, 100%); }
.chars-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chars-head .win-title { margin: 0; }
.chars-head .btn { flex: none; }
.char-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.char-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px 12px;
  font: inherit; color: var(--text); cursor: pointer; border-radius: 14px; border: 2px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0.25));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15); transition: transform 0.12s, border-color 0.12s;
}
.char-card:hover, .char-card:active { border-color: var(--accent); transform: translateY(-2px); }
.cc-stage { width: 100%; display: flex; justify-content: center; border-radius: 10px;
  background: radial-gradient(ellipse at 50% 85%, #5f8f4a 0 30%, #2d4a2a 62%, #16241a); }
.cc-stage canvas { width: 96px; height: 108px; image-rendering: pixelated; }
.cc-name { font-weight: bold; font-size: 17px; margin-top: 4px; }
.cc-sub { color: var(--muted); font-size: 13px; }
.cc-play { margin-top: 6px; color: #3a2506; font-weight: bold; font-size: 13px; padding: 4px 14px; border-radius: 9px;
  background: linear-gradient(180deg, #ffe08a, #e9a93a); }
.char-card.empty-slot { border-style: dashed; background: rgba(0, 0, 0, 0.25); justify-content: center; min-height: 190px; }
.cc-plus { font-size: 42px; color: var(--accent); line-height: 1; }
.empty { color: var(--muted); font-size: 14px; }

/* Criação de personagem */
.create-panel {
  width: min(980px, 100%); max-height: 100%; padding: 12px;
  display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px 14px;
}
.cr-preview { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.cr-stage { position: relative; border-radius: 12px; border: 2px solid var(--border-soft); flex: 1; min-height: 120px;
  background: radial-gradient(ellipse at 50% 88%, #6fa055 0 22%, #3a5f34 50%, #1a2a1e); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.cr-stage canvas { width: 100%; height: 100%; max-height: 216px; object-fit: contain; image-rendering: pixelated; }
.cr-rot { position: absolute; bottom: 6px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.45); color: var(--text); font-size: 18px; cursor: pointer; }
.cr-rot.left { left: 6px; } .cr-rot.right { right: 6px; }
.class-pick { display: flex; gap: 6px; }
.class-pick button {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--slot); border: 2px solid var(--border-soft);
  border-radius: 10px; padding: 2px; cursor: pointer; transition: transform 0.1s;
}
.class-pick button.sel { border-color: var(--accent); background: linear-gradient(180deg, rgba(255, 207, 90, 0.3), rgba(255, 207, 90, 0.05)); transform: translateY(-2px); }
.class-pick canvas { display: block; margin: 0 auto; width: 44px; height: 50px; image-rendering: pixelated; }
.cp-name { font-size: 11px; font-weight: bold; }
.cr-info, .cr-custom { min-height: 0; overflow-y: auto; touch-action: pan-y; }
.class-info { font-size: 13px; color: var(--muted); }
.ci-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ci-title { font-size: 22px; font-weight: bold; color: var(--accent); text-shadow: 0 2px 0 #3a2506; }
.ci-role { font-size: 12px; color: var(--text); background: rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 1px 8px; }
.ci-diff { color: #ffd56b; font-size: 12px; margin: 2px 0 4px; }
.ci-desc { color: var(--text); margin-bottom: 6px; }
.stat-bars { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; margin: 4px 0 8px; font-size: 12px; }
.stat-bars i { display: block; height: 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
.stat-bars i b { display: block; height: 100%; background: linear-gradient(90deg, #ffd56b, #e0a53a); }
.ci-skills { display: flex; flex-wrap: wrap; gap: 5px; }
.ci-skill { width: 36px; height: 36px; border-radius: 9px; border: 2px solid var(--border-soft); background: var(--slot); font-size: 18px; cursor: pointer; padding: 0; }
.ci-skill.passive { border-radius: 50%; }
.ci-skill.sel { border-color: var(--accent); box-shadow: 0 0 8px rgba(255, 207, 90, 0.5); }
.ci-skill-text { font-size: 12px; margin-top: 5px; min-height: 32px; color: var(--text); }
.cr-custom-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cr-custom-head .section-title { margin: 0; }
.cr-custom-head .btn { flex: none; }
.cr-options { display: flex; flex-direction: column; gap: 6px; }
.cr-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; background: var(--slot); border-radius: 10px; padding: 5px 8px; }
.cr-label { font-size: 12px; color: var(--muted); font-weight: bold; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.6); cursor: pointer; padding: 0;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.35); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), 0 0 10px rgba(255, 207, 90, 0.6); transform: scale(1.1); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .btn { flex: none; min-height: 30px; padding: 2px 12px; font-size: 18px; }
.st-name { flex: 1; text-align: center; font-weight: bold; font-size: 14px; }
.cr-footer { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.cr-footer .btn { flex: none; }
.cr-footer input { flex: 1; min-height: 40px; }
.create-panel .msg { grid-column: 1 / -1; margin: 0; min-height: 16px; }

@media (max-height: 430px) {
  .create-panel { grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.2fr); padding: 10px; gap: 8px 12px; }
  .ci-title { font-size: 18px; }
  .cr-row { padding: 3px 6px; grid-template-columns: 80px 1fr; }
  .swatch { width: 21px; height: 21px; }
  .char-card.empty-slot { min-height: 170px; }
  .cc-stage canvas { width: 80px; height: 90px; }
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .window, #joystick-zone, #player-frame, #minimap-box, #target-frame, #hud .overlay { pointer-events: auto; }

#player-frame {
  position: absolute; top: calc(8px + var(--sat)); left: calc(8px + var(--sal));
  display: flex; gap: 8px; align-items: center;
  background: linear-gradient(180deg, rgba(34, 50, 74, 0.92), rgba(20, 29, 44, 0.92));
  border: 2px solid var(--gold); border-radius: 40px 14px 14px 40px;
  box-shadow: 0 0 0 2px rgba(20, 14, 6, 0.8), 0 4px 12px rgba(0, 0, 0, 0.5);
  padding: 4px 12px 4px 4px; width: clamp(220px, 30vw, 300px);
}
#portrait { image-rendering: pixelated; width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(#5c7c6a, #22342b); border: 2px solid var(--gold); flex: none; }
.pf-info { flex: 1; min-width: 0; }
.pf-name { display: flex; justify-content: space-between; font-weight: bold; font-size: 14px; white-space: nowrap; overflow: hidden; }
.pf-level { color: var(--accent); margin-left: 6px; }
.pf-coins { font-size: 12px; color: var(--accent); margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.sp-badge { background: #7b4fd6; color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { filter: brightness(1.5); } }

.bar { position: relative; height: 13px; margin-top: 3px; background: rgba(0, 0, 0, 0.6); border-radius: 7px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.18); }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: 7px; transition: width 0.15s; }
.bar span { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; font-weight: bold; text-shadow: 0 1px 2px #000; }
.bar.hp i { background: linear-gradient(#ff97a0, var(--hp) 60%, #c43a48); }
.bar.mp i { background: linear-gradient(#9fd0ff, var(--mp) 60%, #2f6fc0); }

#target-frame {
  position: absolute; top: calc(8px + var(--sat)); left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(34, 50, 74, 0.92), rgba(20, 29, 44, 0.92));
  border: 2px solid var(--border-soft); border-radius: 12px; padding: 5px 12px; width: clamp(160px, 24vw, 240px);
}
.tf-name { font-size: 13px; font-weight: bold; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tf-level { color: var(--accent); }
#target-frame.elite { border-color: #c48cff; }

#quest-tracker { position: absolute; left: calc(10px + var(--sal)); top: calc(118px + var(--sat)); max-width: 230px; font-size: 12px; text-shadow: 0 1px 3px #000, 0 0 3px #000; }
#quest-tracker .qt-name { color: var(--accent); font-weight: bold; }
#quest-tracker .qt-obj { color: #e6eef8; }
#quest-tracker .qt-obj.done { color: var(--ok); }

#right-top { position: absolute; top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); display: flex; gap: 8px; align-items: flex-start; }
#minimap-box { position: relative; order: 2; cursor: pointer; }
#minimap { width: clamp(104px, 15vw, 140px); height: clamp(104px, 15vw, 140px); border-radius: 50%; border: 3px solid var(--gold); background: #1c2a20; box-shadow: 0 0 0 2px rgba(20, 14, 6, 0.8), 0 4px 14px rgba(0,0,0,0.5); display: block; }
#region-name { text-align: center; font-size: 11px; font-weight: bold; margin-top: 3px; text-shadow: 0 1px 3px #000, 0 0 4px #000; max-width: 150px; }
#top-buttons { display: grid; grid-template-columns: repeat(2, 44px); gap: 6px; order: 1; }
.icon-btn {
  position: relative; width: 44px; height: 44px; font-size: 21px; border-radius: 12px; cursor: pointer; padding: 0; color: var(--text);
  background: linear-gradient(180deg, rgba(52, 70, 98, 0.95), rgba(24, 34, 50, 0.95)); border: 2px solid var(--border-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 3px 8px rgba(0,0,0,0.4);
}
.icon-btn:active { border-color: var(--accent); }
.dot { position: absolute; top: -4px; right: -4px; width: 13px; height: 13px; border-radius: 50%; background: #ff4b4b; border: 2px solid #fff; }

#net-status { position: absolute; left: calc(14px + var(--sal)); top: calc(100px + var(--sat)); font-size: 11px; color: var(--muted); text-shadow: 0 1px 2px #000; }

#joystick-zone { position: absolute; left: 0; bottom: 0; width: 42%; height: 60%; touch-action: none; }
#joy-base {
  position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  left: calc(100px + var(--sal)); top: calc(100% - 100px - var(--sab));
  background: radial-gradient(rgba(255,255,255,0.12), rgba(255,255,255,0.04)); border: 2px solid rgba(232, 199, 125, 0.45);
  opacity: 0.55; transition: opacity 0.15s;
}
#joy-base.active { opacity: 1; transition: none; }
#joy-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6dc, #e3c27a 60%, #a8823a); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* Botões de ação: ataque grande + 4 habilidades em arco + esquiva e poção. */
#action-buttons { position: absolute; right: calc(12px + var(--sar)); bottom: calc(16px + var(--sab)); width: 270px; height: 186px; }
.act {
  position: absolute; border-radius: 50%; padding: 0; cursor: pointer; color: var(--text); touch-action: none;
  background: radial-gradient(circle at 35% 30%, rgba(84, 104, 130, 0.97), rgba(22, 30, 44, 0.97));
  border: 3px solid var(--border-soft); box-shadow: 0 0 0 2px rgba(20, 14, 6, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5); overflow: hidden;
}
.act:active, .act.pressed { filter: brightness(1.3); border-color: var(--accent); }
.act .ic { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.act.attack { right: 0; bottom: 0; width: 88px; height: 88px; font-size: 38px; border-color: var(--gold);
  background: radial-gradient(circle at 35% 30%, #d4553f, #6e1f19); }
.act.attack.talk { background: radial-gradient(circle at 35% 30%, #5ac0ff, #1d4f8a); }
.act.skill { width: 56px; height: 56px; font-size: 25px; }
.act.skill[data-slot="0"] { right: 100px; bottom: 0; }
.act.skill[data-slot="1"] { right: 92px; bottom: 62px; }
.act.skill[data-slot="2"] { right: 52px; bottom: 112px; }
.act.skill[data-slot="3"] { right: -4px; bottom: 124px; }
.act.skill[data-slot="4"] { right: 160px; bottom: 34px; }
.act.skill[data-slot="5"] { right: 118px; bottom: 124px; }
.act.skill.locked { opacity: 0.45; }
.act.small { width: 48px; height: 48px; font-size: 21px; }
.act.dodge { right: 222px; bottom: 0; }
.act.potion { right: 220px; bottom: 56px; }
.act .count { position: absolute; right: 2px; bottom: 0; font-size: 11px; text-shadow: 0 1px 2px #000; }
.act .cd {
  position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: bold; text-shadow: 0 1px 2px #000;
  background: conic-gradient(rgba(0, 0, 0, 0.65) calc(var(--p, 0) * 1turn), transparent 0);
}
.act.nomana .ic { filter: grayscale(1) brightness(0.6); }

#xp-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(2px + var(--sab)); width: min(44vw, 420px); height: 10px; background: rgba(0, 0, 0, 0.6); border-radius: 5px; overflow: hidden; border: 1px solid rgba(232, 199, 125, 0.4); }
#xp-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#e2cdff, var(--xp)); transition: width 0.3s; }
#xp-bar span { position: absolute; inset: 0; font-size: 8px; line-height: 9px; text-align: center; font-weight: bold; text-shadow: 0 1px 1px #000; }

#toasts { position: absolute; left: 50%; bottom: calc(22px + var(--sab)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 30; pointer-events: none; max-width: 46vw; }
.toast { background: rgba(14, 20, 32, 0.88); border: 1px solid var(--border-soft); border-radius: 10px; padding: 5px 12px; font-size: 13px; animation: toast 2.6s forwards; white-space: nowrap; }
.toast.warn { border-color: var(--danger); color: #ffd0d0; }
.toast.good { border-color: var(--ok); }
.toast.item { border-color: #5aa8ff; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 10%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

#banner { position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%); text-align: center; animation: banner 3s forwards; }
#banner .b-title { font-size: 28px; font-weight: bold; color: var(--accent); text-shadow: 0 3px 0 #6b3e0a, 0 0 18px rgba(0,0,0,0.8); }
#banner .b-sub { font-size: 14px; color: var(--text); text-shadow: 0 1px 4px #000; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%); } 12%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }

.overlay, #death-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 8, 12, 0.6); pointer-events: auto; z-index: 20; padding: calc(8px + var(--sat)) calc(8px + var(--sar)) calc(8px + var(--sab)) calc(8px + var(--sal)); }
#death-overlay .window { text-align: center; }
.close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--border-soft); background: rgba(0,0,0,0.35); color: var(--text); font-size: 18px; cursor: pointer; z-index: 2; }

/* ---------- Menu com abas ---------- */
.menu-window { width: min(900px, 100%); height: min(560px, 100%); display: flex; flex-direction: column; padding: 10px 12px 12px; }
.tabs { display: flex; gap: 4px; padding-right: 48px; overflow-x: auto; flex: none; }
.tabs button {
  font: inherit; font-size: 18px; color: var(--muted); background: rgba(0, 0, 0, 0.3); border: 2px solid transparent;
  border-radius: 10px 10px 0 0; padding: 6px 12px; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 42px;
}
.tabs button span { font-size: 14px; font-weight: bold; }
.tabs button.sel { color: var(--text); background: linear-gradient(180deg, rgba(255, 207, 90, 0.22), rgba(255, 207, 90, 0.05)); border-color: var(--border-soft); border-bottom-color: transparent; }
@media (max-width: 720px) { .tabs button span { display: none; } }
.menu-body { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; border-top: 2px solid var(--border-soft); padding-top: 12px; }
.split { display: flex; gap: 14px; height: 100%; }
.split > .col { flex: 1; min-width: 0; overflow-y: auto; touch-action: pan-y; }
.split > .col.side { flex: 0 0 min(300px, 42%); position: sticky; top: 0; align-self: flex-start; max-height: 100%; }
.section-title { font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin: 4px 0 8px; }
.note { font-size: 13px; color: var(--muted); background: rgba(255, 207, 90, 0.08); border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 6px; margin-top: 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.stat-grid div { background: var(--slot); border-radius: 8px; padding: 6px 10px; font-size: 13px; display: flex; justify-content: space-between; }
.stat-grid b { color: var(--accent); }
/* Pontos de atributo (aba Herói) */
.attr-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.attr-row { display: flex; align-items: center; gap: 6px; background: var(--slot); border-radius: 8px; padding: 4px 8px; }
.attr-row .attr-n { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.attr-row .attr-n small { opacity: 0.75; font-size: 11px; }
.attr-row .attr-v { color: var(--accent); min-width: 26px; text-align: right; }
.attr-row .btn.small { min-width: 38px; padding: 4px 6px; }
.hero-card { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.hero-card canvas { width: 96px; height: 96px; border-radius: 14px; background: radial-gradient(#5c7c6a, #1c2b24); border: 2px solid var(--gold); }
.hero-card .hc-name { font-size: 20px; font-weight: bold; }
.hero-card .hc-sub { color: var(--muted); font-size: 13px; }

/* Slots de itens */
.equip-row { display: flex; gap: 8px; margin-bottom: 10px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.slot {
  position: relative; aspect-ratio: 1; min-height: 54px; border-radius: 10px; background: var(--slot); border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex; align-items: center; justify-content: center; font-size: 26px; cursor: pointer; padding: 0; color: var(--text);
}
.slot.equip { width: 64px; min-height: 64px; flex-direction: column; font-size: 26px; }
.slot.equip small { font-size: 9px; color: var(--muted); position: absolute; bottom: 2px; }
.slot.sel { box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(255, 207, 90, 0.5); }
.slot .q { position: absolute; right: 4px; bottom: 1px; font-size: 11px; font-weight: bold; text-shadow: 0 1px 2px #000; }
.slot.r-uncommon { border-color: #6ee26e; } .slot.r-rare { border-color: #5aa8ff; } .slot.r-epic { border-color: #c07bff; } .slot.r-legendary { border-color: #ffb43a; }
.item-detail { background: var(--slot); border-radius: 12px; padding: 10px 12px; }
.item-detail .id-name { font-size: 17px; font-weight: bold; }
.item-detail .id-meta { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.item-detail .id-stats div { font-size: 13px; }
.up { color: var(--ok); } .down { color: var(--danger); }
.item-detail .row { flex-wrap: wrap; }

/* Árvore de habilidades */
.tree-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tree-head .pts { font-weight: bold; color: #c9a8ff; }
.tree { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; position: relative; }
.tree .tier-label { grid-column: 1 / -1; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: -8px; }
.node {
  display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--slot);
  border: 2px solid rgba(255, 255, 255, 0.12); cursor: pointer; text-align: left; font: inherit; color: var(--text); min-height: 64px;
}
.node .n-ic { font-size: 26px; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); border: 2px solid var(--border-soft); flex: none; }
.node.passive .n-ic { border-radius: 10px; }
.node .n-name { font-weight: bold; font-size: 14px; }
.node .n-rank { font-size: 12px; color: var(--accent); }
.node.locked { opacity: 0.5; }
.node.learned { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 207, 90, 0.18), rgba(255, 207, 90, 0.04)); }
.node.can { border-color: #9b7bff; box-shadow: 0 0 10px rgba(155, 123, 255, 0.45); }
.node.sel { box-shadow: 0 0 0 2px var(--accent); }
.pips { display: flex; gap: 3px; margin-top: 3px; }
.pips i { width: 10px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
.pips i.on { background: var(--accent); }

/* Missões */
.quest-item { padding: 10px; border-radius: 10px; background: var(--slot); margin-bottom: 8px; border-left: 4px solid var(--border-soft); cursor: pointer; }
.quest-item.ready { border-left-color: var(--ok); }
.quest-item.available { border-left-color: var(--accent); }
.quest-item .qi-name { font-weight: bold; }
.quest-item .qi-kind { font-size: 11px; color: var(--muted); margin-left: 6px; }
.quest-item .qi-obj { font-size: 13px; color: #d6e2f0; margin-top: 3px; }
.quest-item .qi-obj.done { color: var(--ok); }
.rewards { font-size: 13px; color: var(--accent); margin-top: 6px; }

/* Configurações */
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; }
.settings-row > span { font-size: 15px; }
.seg { display: flex; gap: 4px; }
.seg button { font: inherit; font-size: 14px; color: var(--text); padding: 8px 12px; min-height: 40px; border-radius: 10px; border: 2px solid var(--border-soft); background: rgba(255,255,255,0.06); cursor: pointer; }
.seg button.sel { border-color: var(--accent); background: rgba(255, 207, 90, 0.2); }
input[type=range] { width: 180px; padding: 0; min-height: 30px; border: none; background: none; accent-color: var(--accent); }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; accent-color: var(--accent); }
#full-map { display: block; max-width: 100%; max-height: calc(100vh - 170px); margin: 0 auto; image-rendering: pixelated; border-radius: 10px; border: 2px solid var(--border-soft); }

/* Diálogo com NPC */
.dialog-window { width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 14px; }
#dialog-body { overflow-y: auto; touch-action: pan-y; min-height: 0; }
.npc-head { display: flex; gap: 12px; align-items: center; padding-right: 44px; }
.npc-head canvas { width: 72px; height: 72px; border-radius: 12px; background: radial-gradient(#5c7c6a, #1c2b24); border: 2px solid var(--gold); flex: none; }
.npc-head .nh-name { font-size: 18px; font-weight: bold; color: var(--accent); }
.npc-head .nh-role { font-size: 12px; color: var(--muted); }
.speech { margin: 10px 0; padding: 10px 12px; background: rgba(255, 255, 255, 0.92); color: #2a2216; border-radius: 12px; font-size: 15px; line-height: 1.4; }
.options { display: flex; flex-direction: column; gap: 6px; }
.options .btn { text-align: left; }
.shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--slot); cursor: pointer; border: 2px solid transparent; }
.shop-row.sel { border-color: var(--accent); }
.shop-row .sr-ic { font-size: 24px; width: 34px; text-align: center; }
.shop-row .sr-name { flex: 1; font-size: 14px; }
.shop-row .sr-price { color: var(--accent); font-weight: bold; font-size: 14px; }
.shop-row .sr-sell { flex: none; padding: 4px 8px; font-size: 12px; white-space: nowrap; }

#reconnect { position: fixed; top: calc(10px + var(--sat)); left: 50%; transform: translateX(-50%); background: rgba(140, 30, 30, 0.9); padding: 8px 16px; border-radius: 10px; font-weight: bold; z-index: 50; }
#update-bar {
  position: fixed; left: 50%; bottom: calc(16px + var(--sab)); transform: translateX(-50%); z-index: 60;
  font: inherit; font-weight: bold; font-size: 14px; color: #3a2506; cursor: pointer;
  background: linear-gradient(#ffd56b, #e0a53a); border: 2px solid #fff1c4; border-radius: 12px;
  padding: 10px 16px; min-height: 44px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); max-width: calc(100% - 32px);
}

#rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  #rotate-hint { display: flex; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; background: #0d1612; font-size: 20px; text-align: center; padding: 30px; }
}

@media (max-height: 400px) {
  #player-frame { transform: scale(0.86); transform-origin: top left; }
  #right-top { transform: scale(0.86); transform-origin: top right; }
  #action-buttons { transform: scale(0.84); transform-origin: bottom right; }
  #net-status { top: calc(82px + var(--sat)); }
  #quest-tracker { top: calc(100px + var(--sat)); }
  .title-block .logo-main { font-size: 34px; }
  .menu-window { padding: 6px 8px 8px; }
}

/* ---------- Menu: ficha do herói e retoques (v0.3) ---------- */
canvas.pixel { image-rendering: pixelated; }
.tabs button.sel { box-shadow: inset 0 -3px 0 var(--accent); }
.section-title { display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-soft), transparent); }
.hero-sheet .doll-col { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.hs-name { font-size: 20px; font-weight: bold; text-align: center; color: var(--text); text-shadow: 0 2px 0 #000; }
.hs-sub { font-size: 13px; color: var(--accent); text-align: center; margin-top: -4px; }
.doll { display: flex; align-items: center; justify-content: center; gap: 8px; }
.doll-slots { display: flex; flex-direction: column; gap: 8px; }
.doll-stage { width: 120px; height: 156px; border-radius: 14px; border: 2px solid var(--gold); flex: none;
  background: radial-gradient(ellipse at 50% 90%, #6fa055 0 18%, #34552f 48%, #16241a); box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6); }
.doll-stage canvas { display: block; width: 120px; height: 156px; }
.meter { position: relative; height: 20px; border-radius: 10px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.15); overflow: hidden; margin-bottom: 6px; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 10px; }
.meter span { position: absolute; inset: 0; font-size: 12px; line-height: 19px; text-align: center; font-weight: bold; text-shadow: 0 1px 2px #000; }
.meter.hp i { background: linear-gradient(#ff97a0, var(--hp) 60%, #c43a48); }
.meter.mp i { background: linear-gradient(#9fd0ff, var(--mp) 60%, #2f6fc0); }
.meter.xp i { background: linear-gradient(#e2cdff, var(--xp) 60%, #7a4fd6); }
.hs-wallet { display: flex; justify-content: space-around; font-size: 13px; color: var(--accent); font-weight: bold; }
.stat-grid .stat { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 6px; }
.stat .st-ic { font-size: 15px; text-align: center; }
.stat .st-n { color: var(--muted); }
.npc-head canvas { image-rendering: pixelated; }
.tree .tier-label.t3 { color: #ffb43a; }
.create-panel .msg:empty { display: none; }
.stepper { min-width: 0; }
.st-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .create-panel { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 10px; }
  .cr-row { grid-template-columns: 1fr; gap: 3px; }
  .stepper .btn { padding: 2px 9px; }
  .ci-desc { font-size: 12px; }
  .class-pick { gap: 4px; }
  .class-pick button { min-width: 0; }
  .class-pick canvas { width: 36px; height: 41px; }
  .cp-name { font-size: 9px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- HUD v0.4 ---------- */
#player-frame { padding: 5px 14px 5px 5px; gap: 10px; border-radius: 44px 16px 16px 44px;
  background: linear-gradient(180deg, rgba(40, 58, 86, 0.94), rgba(18, 26, 40, 0.94)); }
.pf-medal { position: relative; flex: none; }
#portrait { width: 58px; height: 58px; border: 3px solid var(--gold);
  background: radial-gradient(circle at 50% 70%, #79a862, #2e4a2c 70%); box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 0 2px rgba(20,14,6,0.8); }
.lvl-badge { position: absolute; right: -6px; bottom: -4px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px;
  background: radial-gradient(circle at 40% 30%, #fff1b8, #e0a53a 60%, #9a6a1c); color: #3a2506; font-weight: 900; font-size: 13px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #3a2506; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.pf-name { font-size: 15px; text-shadow: 0 1px 2px #000; }
.bar { height: 14px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.7); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.bar i { border-radius: 3px; }
.bar i::after { content: ""; position: absolute; left: 0; right: 0; top: 1px; height: 35%; background: rgba(255, 255, 255, 0.28); border-radius: 3px; }
.bar span { line-height: 13px; font-size: 10px; z-index: 1; }
.pf-coins { font-weight: bold; }

#target-frame { border-radius: 10px; padding: 5px 14px 7px; border-width: 2px; border-color: var(--gold); }
#target-frame.elite { border-color: #c48cff; box-shadow: 0 0 14px rgba(196, 140, 255, 0.5); }
#target-frame.elite .tf-name::before { content: "☠ "; color: #d9a8ff; }

/* Cartão da missão rastreada */
#quest-tracker { pointer-events: auto; cursor: pointer; top: calc(84px + var(--sat)); max-width: 240px; min-width: 190px;
  background: linear-gradient(180deg, rgba(20, 28, 42, 0.82), rgba(12, 18, 28, 0.72)); border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent); border-radius: 10px; padding: 6px 10px 7px; text-shadow: 0 1px 2px #000; }
#quest-tracker:active { border-color: var(--accent); }
.qt-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.qt-kind { flex: none; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; background: var(--accent); color: #3a2506; text-shadow: none; }
.qt-kind.k-side { background: #8fc8ff; } .qt-kind.k-daily { background: #ffb43a; }
#quest-tracker .qt-name { font-size: 13px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#quest-tracker .qt-obj { font-size: 12px; padding-left: 24px; }
.qt-nav { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(232, 199, 125, 0.25);
  font-size: 12px; font-weight: bold; color: #ffe08a; }
.qt-arrow { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: #ffd34a; transition: transform 0.2s; }
.qt-arrow.here { animation: pulse 1s infinite; }
.qt-more { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Minimapa com bússola */
#minimap-box .compass { position: absolute; top: -4px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%;
  background: #8a2a20; color: #fff; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; border: 2px solid var(--gold); }
#region-name { background: linear-gradient(180deg, rgba(40, 58, 86, 0.9), rgba(18, 26, 40, 0.9)); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 1px 8px; margin: 4px auto 0; width: max-content; max-width: 160px; }
.icon-btn { border-radius: 14px; border-color: var(--gold); background: radial-gradient(circle at 40% 25%, rgba(78, 100, 134, 0.98), rgba(20, 30, 46, 0.98)); }

/* Botões de ação com aro dourado */
.act { border-color: rgba(232, 199, 125, 0.75); }
.act .ic { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.act.skill::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.12); pointer-events: none; }
.act.attack { box-shadow: 0 0 0 3px rgba(20, 14, 6, 0.7), 0 0 16px rgba(255, 120, 80, 0.35), 0 4px 12px rgba(0, 0, 0, 0.5); }

#xp-bar { width: min(56vw, 520px); height: 12px; border-radius: 6px; border-color: rgba(232, 199, 125, 0.6); }
#xp-bar i { background: linear-gradient(#efe0ff, var(--xp) 55%, #7a4fd6); }
#xp-bar span { font-size: 9px; line-height: 11px; }

/* Menu de missões */
.quest-list { display: flex; flex-direction: column; gap: 6px; }
.quest-card { display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--slot); border: 2px solid transparent; border-left: 4px solid var(--border-soft); border-radius: 10px; padding: 7px 10px; }
.quest-card.ready { border-left-color: var(--ok); }
.quest-card.available { border-left-color: var(--accent); }
.quest-card.done { opacity: 0.55; }
.quest-card.sel { border-color: var(--accent); background: linear-gradient(90deg, rgba(255, 207, 90, 0.16), rgba(8, 12, 20, 0.55)); }
.quest-card.tracked .qc-meta { color: #ffd34a; }
.qc-ic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900;
  background: var(--accent); color: #3a2506; }
.qc-ic.k-side { background: #8fc8ff; } .qc-ic.k-daily { background: #ffb43a; }
.qc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qc-name { font-weight: bold; font-size: 14px; }
.qc-meta { font-size: 11px; color: var(--muted); }
.qc-badge { color: var(--ok); font-size: 20px; font-weight: 900; }
.qc-bar { position: relative; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.5); overflow: hidden; margin-top: 2px; }
.qc-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ffd56b, #7be38b); border-radius: 3px; }
.quest-detail .qd-desc { font-size: 13px; margin: 4px 0 8px; line-height: 1.35; }
.qo { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 13px; margin-bottom: 6px; }
.qo .qc-bar { grid-column: 1 / -1; }
.qo.done { color: var(--ok); }
.qo-n { font-weight: bold; color: var(--accent); }
.qd-where { font-size: 13px; color: #ffe08a; margin: 6px 0; }
.rewards { font-size: 13px; margin-top: 6px; color: var(--text); }

@media (max-height: 400px) {
  #quest-tracker { top: calc(74px + var(--sat)); transform: scale(0.9); transform-origin: top left; }
}
#net-status { top: auto; bottom: calc(4px + var(--sab)); left: calc(10px + var(--sal)); font-size: 10px; }
@media (max-height: 400px) { #net-status { top: auto; } }

/* ---------- Abertura e logo ---------- */
#screen-intro { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(ellipse at 50% 45%, #1d3428, #070c0a 70%); transition: opacity 0.6s; }
#screen-intro.leaving { opacity: 0; pointer-events: none; }
#intro-canvas { display: block; }
.intro-title { text-align: center; line-height: 1; opacity: 0; transform: translateY(10px); transition: opacity 0.8s, transform 0.8s; margin-top: -2vh; }
.intro-title .logo-main { font-size: clamp(34px, 7vw, 60px); }
#screen-intro.ready .intro-title { opacity: 1; transform: none; }
@keyframes tapblink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.login-emblem { display: flex; justify-content: center; margin-bottom: -6px; }
.login-emblem canvas { width: 104px; height: 104px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6)); }
@media (max-height: 430px) { .login-emblem canvas { width: 64px; height: 64px; } }

/* ---------- Tema pixel art ----------
   Cantos retos, molduras de madeira em degraus de pixel (como os RPGs 2D clássicos),
   fonte pixelada e imagens sempre sem suavização. Só o joystick continua redondo. */
/* Fonte Tiny5 (licença SIL Open Font License), guardada no jogo para funcionar sem internet. */
@font-face { font-family: "Tiny5"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/tiny5.woff2") format("woff2"); }
body, button, input, select, textarea { font-family: "Tiny5", "Trebuchet MS", "Segoe UI", system-ui, sans-serif; font-synthesis: none; }
canvas { image-rendering: pixelated; }
*, *::before, *::after { border-radius: 0 !important; }
#joystick-zone * { border-radius: 50% !important; }
.window {
  background: linear-gradient(180deg, #3b2a1c, #271a10);
  border: 3px solid #e3a95a;
  box-shadow: 0 0 0 3px #4a2a10, 0 0 0 6px #b8722e, 0 0 0 9px #2a160a, 0 12px 0 9px rgba(0, 0, 0, 0.35),
    inset 0 0 0 2px #2a160a, inset 3px 3px 0 2px rgba(255, 220, 160, 0.12);
}
.window::before, .window::after { width: 10px; height: 10px; top: -8px; transform: none; background: #ffd27a; border: 2px solid #4a2a10; box-shadow: inset -2px -2px 0 #c98a3c; }
.window::before { left: -8px; }
.window::after { right: -8px; }
.btn { border: 3px solid #2a160a; box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.3), 0 3px 0 #1a0e06; }
.btn:active { box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.3), 0 1px 0 #1a0e06; }
.btn.primary { border-color: #5a3410; }
input, select { border: 3px solid #5a3a1c; background: rgba(20, 10, 4, 0.55); }
.bar { border: 2px solid #1a0e06; height: 14px; }
.bar i { background-image: none !important; box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.bar.hp i { background-color: var(--hp); }
.bar.mp i { background-color: var(--mp); }
.act { border: 3px solid #2a160a !important; box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.25), inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 3px 0 rgba(0, 0, 0, 0.45) !important; }
.act.attack { border-color: #4a2a10 !important; box-shadow: 0 0 0 3px #e3a95a, inset 0 4px 0 rgba(255, 255, 255, 0.3), inset 0 -5px 0 rgba(0, 0, 0, 0.35), 0 5px 0 rgba(0, 0, 0, 0.45) !important; }
#minimap { border: 3px solid #e3a95a; box-shadow: 0 0 0 3px #4a2a10, 0 0 0 5px #2a160a; }
#portrait { border: 3px solid #e3a95a; box-shadow: 0 0 0 2px #2a160a; }

/* ---------- Chat ---------- */
#btn-chat { position: absolute; top: calc(10px + var(--sat)); left: calc(236px + var(--sal)); }
#chat-log {
  position: absolute; left: calc(10px + var(--sal)); top: calc(170px + var(--sat)); width: min(320px, 42vw);
  max-height: 84px; overflow: hidden; display: flex; flex-direction: column; gap: 1px;
  font-size: 12px; line-height: 1.3; pointer-events: none; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
}
#chat-log .chat-line { overflow-wrap: anywhere; }
#chat-log .chat-line.faded { display: none; }
#chat-log .chat-tag { color: #9fb3c8; font-weight: normal; }
#chat-log .global .chat-tag { color: #ffd27a; }
#chat-log .system { color: #ff9b8a; }
#chat-log.open {
  top: calc(96px + var(--sat)); left: 50%; transform: translateX(-50%); width: min(560px, 76vw); max-height: 34vh;
  overflow-y: auto; pointer-events: auto; touch-action: pan-y; z-index: 41; padding: 6px 8px;
  background: rgba(30, 18, 10, 0.88); border: 3px solid #e3a95a; box-shadow: 0 0 0 3px #2a160a;
}
#chat-log.open .chat-line.faded { display: block; opacity: 0.85; }
#chat-form {
  position: absolute; top: calc(8px + var(--sat)); left: 50%; transform: translateX(-50%); width: min(560px, 76vw);
  z-index: 42; pointer-events: auto; padding: 6px; background: #3b2a1c; border: 3px solid #e3a95a; box-shadow: 0 0 0 3px #2a160a;
}
#chat-form .chat-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
#chat-form .chat-tabs button {
  font: inherit; font-size: 13px; color: var(--text); background: #271a10; border: 2px solid #5a3a1c; padding: 3px 12px; cursor: pointer;
}
#chat-form .chat-tabs button.sel { background: #e3a95a; color: #2a160a; border-color: #ffd27a; }
#chat-form #chat-close { margin-left: auto; padding: 3px 10px; }
#chat-form .chat-row { display: flex; gap: 6px; }
#chat-form input { flex: 1; min-width: 0; padding: 6px 8px; font-size: 16px; }
@media (max-height: 400px) { #chat-log { top: calc(150px + var(--sat)); max-height: 70px; } }

/* ---------- Login ---------- */
label.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 13px; color: var(--muted); cursor: pointer; }
label.check input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: #e3a95a; }
.win-title small.muted { font-size: 12px; color: var(--muted); letter-spacing: 0; text-shadow: none; }

/* ---------- Correções de interface (tema pixel) ---------- */
/* Botões no tema madeira (antes azuis, do tema antigo). */
.btn { background: linear-gradient(180deg, #8a5a32, #6b4426 55%, #573620); }
.options .btn { background: #4a3220; border-color: #2a160a; }
.options .btn:hover, .options .btn:active { background: #5e3f28; }
/* Fala do NPC em pergaminho, não em caixa branca. */
.speech { background: #f3e2bb; color: #3a2510; border: 3px solid #2a160a; box-shadow: inset 0 -3px 0 #d8c08e; }
.npc-head canvas { background: #2c4a36; border: 3px solid #e3a95a; }
/* Avisos: no topo, sem cobrir mochila e missões; no máximo 3. */
#toasts { bottom: auto; top: calc(64px + var(--sat)); max-width: 60vw; z-index: 70; }
.toast { background: #2a1a10; border: 2px solid #e3a95a; box-shadow: 0 0 0 2px #1a0e06; }
.toast.warn { border-color: #e06565; }
.toast.good { border-color: #6fd88a; }
.toast.item { border-color: #5aa8ff; }

/* ---------- Novidades v0.6 ---------- */
/* Tamanho da interface (opção): zoom nos blocos do HUD, menos no joystick. */
#player-frame, #right-top, #action-buttons, #target-frame, #quest-tracker, #btn-chat, #chat-log:not(.open) { zoom: var(--ui, 1); }
/* Botões novos: poção de mana e trocar alvo */
.act.mana { right: 276px; bottom: 28px; }
.act.cycle { right: 222px; bottom: 112px; }
.act.locked { opacity: 0.45; }
/* Relógio do jogo */
#game-clock { text-align: center; font-size: 11px; margin-top: 2px; color: #fff3c4; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000; }
/* Ping colorido */
#net-status[data-q="good"] { color: #7be38b; }
#net-status[data-q="ok"] { color: #ffd27a; }
#net-status[data-q="bad"] { color: #ff6b6b; }
/* Mochila cheia / item novo */
.icon-btn { position: relative; }
.bag-full { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font-size: 8px; background: #c0392b; color: #fff; padding: 1px 3px; border: 1px solid #2a160a; font-weight: normal; }
/* Vida baixa: borda vermelha pulsando */
#lowhp { position: absolute; inset: 0; pointer-events: none; z-index: 5; box-shadow: inset 0 0 0 6px rgba(220, 40, 40, 0.55), inset 0 0 60px rgba(220, 40, 40, 0.45); animation: lowhp 1s steps(2) infinite; }
@keyframes lowhp { 50% { box-shadow: inset 0 0 0 4px rgba(220, 40, 40, 0.3), inset 0 0 30px rgba(220, 40, 40, 0.2); } }
/* Tutorial */
#tutorial-hint { position: absolute; left: 50%; top: calc(64px + var(--sat)); transform: translateX(-50%); z-index: 35; max-width: min(520px, 70vw);
  background: #f3e2bb; color: #3a2510; border: 3px solid #2a160a; box-shadow: 0 0 0 3px #e3a95a; padding: 6px 12px; font-size: 13px; text-align: center; pointer-events: none; }
#toasts { top: calc(110px + var(--sat)); }
/* Janela de aviso (placas, perfil, novidades) */
#notice { z-index: 80; display: flex; align-items: center; justify-content: center; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); }
#notice.hidden { display: none; }
.notice-window { width: min(460px, 92vw); max-height: 86vh; overflow-y: auto; }
.notice-window .close { position: absolute; top: 8px; right: 8px; }
#notice-body p { margin: 8px 0; line-height: 1.4; }
#notice-body .profile-pic { width: 96px; height: 96px; background: #2c4a36; border: 3px solid #e3a95a; display: block; }
#notice-body .row { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.news { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; font-size: 13px; }
/* Login: mostrar senha e dicas */
.pass-row { display: flex; gap: 6px; }
.pass-row input { flex: 1; min-width: 0; }
.pass-row .eye { width: 44px; font-size: 18px; background: #271a10; border: 3px solid #5a3a1c; color: var(--text); cursor: pointer; }
.login-tip { margin: 8px auto 0; max-width: 420px; text-align: center; font-size: 12px; color: #fff3c4; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000; }
/* Chat: horário, privado, sistema, emotes, contador */
#chat-log .chat-time { color: #8a96a6; font-size: 10px; }
#chat-log .whisper { color: #ffb3e6; }
#chat-log .whisper .chat-tag { color: #ff8ad8; }
#chat-log .system { color: #ffd27a; }
.chat-emotes { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.chat-emotes button { font-size: 18px; width: 36px; height: 32px; background: #271a10; border: 2px solid #5a3a1c; cursor: pointer; padding: 0; }
.chat-count { align-self: center; font-size: 11px; color: var(--muted); min-width: 44px; text-align: right; }
/* Conquistas, estatísticas e bestiário */
.ach-list { display: flex; flex-direction: column; gap: 6px; }
.ach { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--slot); border: 2px solid #3a2a1c; opacity: 0.7; }
.ach.done { opacity: 1; border-color: #e3a95a; }
.ach-ic { font-size: 22px; }
.ach-text { flex: 1; display: flex; flex-direction: column; }
.ach-text small { color: var(--muted); font-size: 11px; }
.stat-box { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.stat-line { display: flex; justify-content: space-between; padding: 4px 8px; background: var(--slot); font-size: 13px; }
.stat-line b { color: var(--accent); }
.bestiary { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.beast { display: flex; flex-direction: column; align-items: center; padding: 4px; background: var(--slot); border: 2px solid #3a2a1c; text-align: center; }
.beast canvas { width: 64px; height: 56px; image-rendering: pixelated; background: #3a5a3a; }
.beast.unknown canvas { background: #2a2a2a; }
.beast small { color: var(--muted); font-size: 10px; }
.section-title .btn.inline { margin-left: auto; min-height: 0; padding: 2px 8px; font-size: 11px; }
.settings-row.check { cursor: pointer; }
.settings-row.check input { width: 22px; height: 22px; accent-color: #e3a95a; }

/* ---------- Tela de atualização (entre a abertura e o login) ---------- */
#screen-update { z-index: 20; }
.update-panel { width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 18px 16px; }
.update-panel .logo { margin: 0; }
.update-track { width: 100%; height: 14px; background: #2a1a0c; border: 2px solid #5a3a1c; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.5); }
.update-track b { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #ffd56b 0 6px, #e8b24a 6px 12px); transition: width 0.35s steps(8); }
.update-text { margin: 0; min-height: 1.3em; color: #fff3c4; font-size: 14px; }
.update-text.err { color: #ff9a8a; }

/* ---------- Login compacto: celular deitado cabe na tela sem arrastar ---------- */
@media (orientation: landscape) and (max-height: 600px) {
  #screen-login {
    display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 340px);
    grid-template-areas: "title panel" "tip panel";
    align-content: center; justify-content: center; column-gap: 32px; row-gap: 8px;
  }
  #screen-login .title-block { grid-area: title; align-self: end; }
  #screen-login .title-block .logo-main { font-size: clamp(30px, 5vw, 46px); }
  #screen-login .logo-sub { font-size: 13px; letter-spacing: 8px; }
  #screen-login .subtitle { font-size: 13px; margin-top: 4px; }
  #screen-login .login-panel { grid-area: panel; width: 100%; padding: 8px 14px 6px; }
  #screen-login .login-tip { grid-area: tip; align-self: start; margin: 0; }
  .login-panel label { margin: 3px 0; font-size: 12px; }
  .login-panel label input { margin-top: 2px; }
  .login-panel input { min-height: 34px; padding: 4px 10px; font-size: 15px; }
  .login-panel .pass-row .eye { width: 38px; font-size: 15px; }
  .login-panel label.check { margin: 4px 0 0; }
  .login-panel .row { margin-top: 6px; }
  .login-panel .btn { min-height: 36px; padding: 4px 10px; font-size: 15px; }
  .login-panel .server-box { margin-top: 4px; font-size: 12px; }
  .login-panel .server-box summary { padding: 2px 0; }
  .login-panel .msg { margin-top: 2px; min-height: 15px; font-size: 12px; }
}
@media (orientation: landscape) and (max-height: 360px) {
  #screen-login .subtitle, #screen-login .login-emblem { display: none; }
}

/* ================= HUD v0.7: redesenho ================= */
/* Coluna da esquerda (herói, grupo, missão, chat) empilhada, sem sobreposição. */
#left-stack { position: absolute; top: calc(6px + var(--sat)); left: calc(6px + var(--sal)); display: flex; flex-direction: column;
  align-items: flex-start; gap: 5px; pointer-events: none; max-width: min(300px, 44vw); zoom: var(--ui, 1); }
#left-stack > * { pointer-events: auto; }
#left-stack #player-frame, #left-stack #quest-tracker, #left-stack #chat-log, #left-stack #btn-chat { position: static; zoom: 1; }
#player-frame { display: flex; gap: 8px; align-items: stretch; width: 268px; padding: 6px 8px 6px 6px !important; border-radius: 0 !important;
  background: linear-gradient(180deg, #3b2a1c, #23170e) !important; border: 3px solid #e3a95a !important;
  box-shadow: 0 0 0 3px #2a160a, 0 6px 0 3px rgba(0, 0, 0, 0.3) !important; }
.pf-medal { position: relative; flex: none; align-self: center; }
#portrait { width: 56px; height: 56px; display: block; background: linear-gradient(180deg, #4f7a44, #2c4a30) !important;
  border: 3px solid #e3a95a !important; box-shadow: 0 0 0 2px #2a160a !important; image-rendering: pixelated; }
.lvl-badge { border-radius: 0 !important; right: -7px !important; bottom: -6px !important; min-width: 22px !important; height: 20px !important;
  background: #ffd27a !important; border: 2px solid #2a160a !important; box-shadow: inset 0 -3px 0 #c98a3c !important; font-size: 12px !important; }
.pf-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pf-name { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #fff3c4; text-shadow: 0 1px 0 #000; }
.pf-name #pf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-badge { flex: none; font-size: 10px; background: #6a3fb5; color: #fff; padding: 0 4px; border: 1px solid #2a160a; }
.sp-badge.ap { background: #b5503f; cursor: pointer; margin-left: 2px; }
#hud .bar { height: 13px; margin: 0; border: 2px solid #1a0e06 !important; background: #140c06; border-radius: 0 !important; box-shadow: none; }
#hud .bar i { border-radius: 0 !important; }
#hud .bar i::after { display: none; }
#hud .bar.hp i { background: repeating-linear-gradient(90deg, #e04a4a 0 9px, #c63a3a 9px 10px) !important; box-shadow: inset 0 3px 0 rgba(255, 180, 170, 0.45) !important; }
#hud .bar.mp i { background: repeating-linear-gradient(90deg, #3f8ae8 0 9px, #2f70c8 9px 10px) !important; box-shadow: inset 0 3px 0 rgba(170, 210, 255, 0.45) !important; }
#hud .bar.xp { height: 8px; position: relative; left: auto; bottom: auto; transform: none; width: auto; }
#hud .bar.xp i { background: #b07bff !important; box-shadow: inset 0 2px 0 rgba(230, 210, 255, 0.5) !important; }
#hud .bar.xp span { font-size: 7px; line-height: 5px; }
#hud .bar span { font-size: 9px; line-height: 10px; text-shadow: 1px 1px 0 #000; }
.pf-coins { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #ffd27a; margin-top: 1px; }
.pf-floor { margin-left: auto; font-size: 10px; color: #9fe4ff; }

/* Grupo */
#party-frame { display: flex; flex-direction: column; gap: 3px; width: 200px; }
.pm { display: grid; grid-template-columns: 1fr auto; gap: 1px 6px; padding: 3px 6px; background: rgba(35, 23, 14, 0.9); border: 2px solid #8a5a2a;
  box-shadow: 0 0 0 2px #2a160a; font-size: 11px; color: #f3e2bb; }
.pm.dead { opacity: 0.55; }
.pm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm small { color: #b8a888; font-size: 10px; }
.pm .bar { grid-column: 1 / 3; height: 7px !important; }
.pm .bar i { background: #6fd88a !important; box-shadow: none !important; }
.pm.leader b::before { content: '★ '; color: #ffd27a; }

/* Rastreador de missão no mesmo estilo */
#left-stack #quest-tracker { width: 268px; max-width: none; border-radius: 0 !important; background: rgba(35, 23, 14, 0.88) !important;
  border: 2px solid #8a5a2a !important; border-left: 4px solid #ffd27a !important; box-shadow: 0 0 0 2px #2a160a; top: auto !important; transform: none !important; }
.qt-kind { border-radius: 0 !important; }

/* Chat no canto */
.chat-tools { display: flex; gap: 6px; }
.chat-tools .icon-btn { width: 36px; height: 36px; font-size: 17px; }
#left-stack #chat-log { width: min(300px, 42vw); max-height: 78px; }
#chat-log.open { position: fixed !important; top: calc(96px + var(--sat)) !important; }

/* Alvo e chefe no centro do topo */
#target-frame { top: calc(8px + var(--sat)) !important; border-radius: 0 !important; background: rgba(35, 23, 14, 0.92) !important;
  border: 3px solid #e3a95a !important; box-shadow: 0 0 0 3px #2a160a !important; padding: 4px 12px 6px !important; min-width: 190px; }
#boss-bar { position: absolute; top: calc(6px + var(--sat)); left: 50%; transform: translateX(-50%); width: min(52vw, 540px); z-index: 6;
  background: rgba(30, 12, 10, 0.94); border: 3px solid #c0392b; box-shadow: 0 0 0 3px #2a0a06, 0 0 18px rgba(255, 60, 40, 0.35); padding: 4px 10px 6px; pointer-events: none; }
#boss-bar.enraged { animation: bossrage 0.6s steps(2) infinite; }
@keyframes bossrage { 50% { border-color: #ff7a30; } }
.bb-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: #ffd27a; text-shadow: 1px 1px 0 #000; }
#bb-phase { font-size: 11px; color: #ff9a8a; }
.bb-track { position: relative; height: 16px; margin-top: 3px; background: #140606; border: 2px solid #000; }
.bb-track i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, #d8302a 0 14px, #b0241f 14px 16px); box-shadow: inset 0 4px 0 rgba(255, 170, 150, 0.4); transition: width 0.2s steps(6); }
.bb-track span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 13px; color: #fff; text-shadow: 1px 1px 0 #000; }
#boss-bar:not(.hidden) ~ #target-frame { top: calc(62px + var(--sat)) !important; }

/* Minimapa quadrado com os botões numa fileira embaixo */
#right-top { flex-direction: column; align-items: flex-end; gap: 6px !important; }
#minimap-box { order: 1 !important; }
#minimap { width: clamp(96px, 13vw, 124px) !important; height: clamp(96px, 13vw, 124px) !important; border-radius: 0 !important; }
#minimap-box .compass { border-radius: 0 !important; }
#region-name { border-radius: 0 !important; background: rgba(35, 23, 14, 0.9) !important; border: 2px solid #8a5a2a !important; font-size: 10px; }
#top-buttons { order: 2 !important; display: flex !important; gap: 4px !important; }
#top-buttons .icon-btn { width: 38px; height: 38px; font-size: 18px; }
.icon-btn { border-radius: 0 !important; background: linear-gradient(180deg, #4a3220, #2e1e12) !important; border: 2px solid #e3a95a !important;
  box-shadow: 0 0 0 2px #2a160a, inset 0 2px 0 rgba(255, 220, 160, 0.2) !important; }

/* Botões de ação: pedra escura com aro dourado */
.act { background: linear-gradient(180deg, #4a3a30, #2a1e16) !important; border-radius: 0 !important; }
.act.skill.locked { background: #2a221c !important; }
.act.attack { background: linear-gradient(180deg, #c0392b, #7a1f16) !important; }
.act.attack.talk { background: linear-gradient(180deg, #3f8ae8, #1d4f8a) !important; }
#net-status { left: auto !important; right: calc(10px + var(--sar)); bottom: calc(2px + var(--sab)) !important; }

/* Histórico do chat */
#chat-history { z-index: 85; position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); }
#chat-history.hidden { display: none; }
.chath-window { width: min(620px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.chath-window .close { position: absolute; top: 8px; right: 8px; }
.chath-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.chath-tabs button { font: inherit; font-size: 12px; color: var(--text); background: #271a10; border: 2px solid #5a3a1c; padding: 3px 9px; cursor: pointer; }
.chath-tabs button.sel { background: #e3a95a; color: #2a160a; border-color: #ffd27a; }
.chath-list { flex: 1; min-height: 120px; max-height: 60vh; overflow-y: auto; background: #1e140c; border: 2px solid #5a3a1c; padding: 6px 8px;
  font-size: 12px; line-height: 1.45; touch-action: pan-y; }
.chath-list .ln { overflow-wrap: anywhere; }
.chath-list .ln .t { color: #8a96a6; font-size: 10px; margin-right: 4px; }
.chath-list .ln .c { color: #9fb3c8; margin-right: 4px; }
.chath-list .ln.global .c { color: #ffd27a; } .chath-list .ln.party .c { color: #7be38b; } .chath-list .ln.whisper { color: #ffb3e6; }
.chath-list .ln.system { color: #ffd27a; }
.chath-list .ln .n { cursor: pointer; text-decoration: underline dotted; }
.chath-tip { font-size: 11px; margin: 6px 0 0; }
#chat-log .party .chat-tag { color: #7be38b; }

/* Troca */
#trade { z-index: 86; position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.5); }
#trade.hidden { display: none; }
.trade-window { width: min(640px, 96vw); max-height: 92vh; overflow-y: auto; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trade-box { min-height: 64px; background: #1e140c; border: 2px solid #5a3a1c; padding: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.trade-box .ti, .trade-inv .ti { font: inherit; font-size: 11px; color: var(--text); background: #2e1e12; border: 2px solid #5a3a1c; padding: 3px 6px; cursor: pointer; }
.trade-coins { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: #ffd27a; }
.trade-coins input { width: 110px; min-height: 30px; padding: 2px 6px; }
.trade-ok { font-size: 12px; margin-top: 4px; min-height: 16px; }
.trade-ok.yes { color: #7be38b; }
.trade-inv { display: flex; flex-wrap: wrap; gap: 4px; max-height: 120px; overflow-y: auto; margin-bottom: 6px; }

/* Social, ranking, cronograma, oficina */
.soc-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.soc-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: var(--slot); border: 2px solid #3a2a1c; font-size: 13px; }
.soc-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-row small { color: var(--muted); }
.soc-row .on { color: #7be38b; } .soc-row .off { color: #8a8a8a; }
.rank-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.rank-tabs button { font: inherit; font-size: 12px; color: var(--text); background: #271a10; border: 2px solid #5a3a1c; padding: 3px 10px; cursor: pointer; }
.rank-tabs button.sel { background: #e3a95a; color: #2a160a; }
.rank-pos { width: 22px; text-align: right; color: #ffd27a; }
.chain { display: flex; flex-direction: column; gap: 3px; }
.chain-step { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: var(--slot); border-left: 4px solid #3a2a1c; font-size: 12px; }
.chain-step .num { width: 24px; text-align: right; color: var(--muted); }
.chain-step.done { opacity: 0.6; border-left-color: #6fd88a; }
.chain-step.now { border-left-color: #ffd27a; background: #3b2a1c; }
.chain-step.locked { opacity: 0.45; }
.craft-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--slot); border: 2px solid #3a2a1c; margin-bottom: 4px; font-size: 12px; }
.craft-row .grow { flex: 1; min-width: 0; }
.craft-row .need { color: var(--muted); font-size: 11px; }
.craft-row .need .miss { color: #ff8a7a; }
/* Coluna da esquerda acima da área do joystick (os botões do chat ficam clicáveis) e mais compacta. */
#left-stack { z-index: 4; }
#player-frame { width: 236px; }
#portrait { width: 48px !important; height: 48px !important; }
#left-stack #quest-tracker { width: 236px; padding: 4px 8px 5px !important; }
#left-stack #quest-tracker .qt-name { font-size: 12px; }
#left-stack #quest-tracker .qt-obj, #left-stack #quest-tracker .qt-nav { font-size: 11px; }
@media (max-height: 430px) { #left-stack { zoom: calc(var(--ui, 1) * 0.86); } #right-top { zoom: calc(var(--ui, 1) * 0.9); transform: none !important; } }

/* v0.8: conjuntos de armadura */
.set-name { margin-top: 6px; color: #ffd36b; font-size: 13px; }
.set-bonus { font-size: 12px; color: #9a9080; padding-left: 10px; }
.set-bonus.on { color: #8fe08f; }

/* v0.12: modo computador (teclado e mouse) — o jogo liga a classe body.pc sozinho.
   Sem joystick; botões viram uma barra de atalhos no meio, embaixo, com a tecla escrita. */
body.pc #joystick-zone { display: none; }
body.pc #action-buttons {
  left: 50%; right: auto; bottom: calc(16px + var(--sab)); transform: translateX(-50%); transform-origin: bottom center;
  width: auto; height: auto; display: flex; align-items: flex-end; gap: 5px; padding: 5px 6px;
  background: rgba(35, 23, 14, 0.82); border: 2px solid #1a0e06; box-shadow: 0 0 0 2px rgba(232, 199, 125, 0.45);
}
body.pc .act, body.pc .act.small, body.pc .act.skill, body.pc .act.attack {
  position: relative; right: auto; bottom: auto; width: 48px; height: 48px; font-size: 22px; flex: none;
}
body.pc .act.attack { width: 56px; height: 56px; font-size: 26px; }
body.pc .act::before {
  content: attr(data-key); position: absolute; left: 3px; top: 2px; z-index: 2; pointer-events: none;
  font-size: 9px; line-height: 1; color: #ffe08a; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
}
body.pc .act.potion { order: 1; } body.pc .act.mana { order: 2; } body.pc .act.dodge { order: 3; } body.pc .act.cycle { order: 4; }
body.pc .act.skill[data-slot="0"] { order: 5; } body.pc .act.skill[data-slot="1"] { order: 6; } body.pc .act.skill[data-slot="2"] { order: 7; }
body.pc .act.skill[data-slot="3"] { order: 8; } body.pc .act.skill[data-slot="4"] { order: 9; } body.pc .act.skill[data-slot="5"] { order: 10; }
body.pc .act.attack { order: 11; margin-left: 4px; }
body.pc #toasts { bottom: calc(96px + var(--sab)); }
body.pc #tutorial-hint { pointer-events: none; }
@media (max-height: 520px) { body.pc #action-buttons { transform: translateX(-50%) scale(0.84); } }

/* Barra de carregamento (voltar para a vila) */
#cast-bar { position: absolute; left: 50%; bottom: 34%; transform: translateX(-50%); width: 240px; z-index: 25; pointer-events: none; text-align: center; }
#cast-bar span { display: block; font-size: 13px; font-weight: bold; color: #ffe08a; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000; margin-bottom: 3px; }
#cast-bar .cast-track { height: 12px; background: #140c06; border: 2px solid #1a0e06; box-shadow: 0 0 0 2px rgba(232, 199, 125, 0.6); }
#cast-bar i { display: block; height: 100%; width: 0; background: #ffd35a; box-shadow: inset 0 -3px 0 #c98a2a; }

/* Lista de teclas (H) */
.keys-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.keys-table td { padding: 3px 6px; border-bottom: 1px solid rgba(232, 199, 125, 0.15); }
.keys-table td:first-child { white-space: nowrap; width: 1%; }
.keys-table kbd { display: inline-block; padding: 1px 6px; background: #2a1c10; border: 2px solid #1a0e06; box-shadow: 0 2px 0 #000; color: #ffe08a; font-family: inherit; font-size: 12px; }

/* v0.13: 5 classes na criação — botões dividem a largura e o nome quebra em vez de cortar. */
.class-pick button { flex: 1 1 0; min-width: 0; padding-left: 2px; padding-right: 2px; }
.class-pick .cp-name { font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.class-pick .cp-ic { display: none; font-size: 14px; }
@media (max-width: 1100px) { .class-pick .cp-full { display: none; } .class-pick .cp-ic { display: inline; } }
/* O boneco encolhe junto com o botão (antes passava da borda e ficava torto). */
.class-pick button { overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.class-pick canvas { width: 100% !important; max-width: 44px; height: auto !important; aspect-ratio: 64 / 72; }

/* v0.13: apagar herói (lixeira no cartão + confirmação digitando o nome) */
.char-slot { position: relative; display: flex; }
.char-slot > .char-card { flex: 1; }
.cc-del { position: absolute; top: 6px; right: 6px; z-index: 2; width: 30px; height: 30px; padding: 0; font-size: 15px; line-height: 1;
  background: rgba(20, 10, 6, 0.75); border: 2px solid #1a0e06; color: #ffb0a0; cursor: pointer; }
.cc-del:hover { border-color: var(--danger); }
.cc-confirm { cursor: default; gap: 6px; justify-content: center; border-color: var(--danger) !important; }
.cc-confirm .cc-sub { text-align: center; font-size: 12px; }
.cc-confirm input { width: 100%; min-height: 34px; padding: 4px 8px; text-align: center; }
.cc-confirm .btn { width: 100%; }
