:root {
  --bg: #111316;
  --panel: #191d24;
  --panel-2: #202632;
  --ink: #f1efe6;
  --muted: #a8acb8;
  --line: #343b48;
  --gold: #f7b733;
  --teal: #48d1b5;
  --red: #ee5b5b;
  --green: #69d27b;
  --violet: #9b7cf0;
  --blue: #6ab7ff;
  --shadow: rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(72, 209, 181, 0.13), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(247, 183, 51, 0.11), transparent 28%),
    var(--bg);
  background-size: 8px 8px, 8px 8px, auto, auto, auto;
}

button {
  color: inherit;
  font: inherit;
}

[hidden] {
  display: none !important;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  color: var(--ink);
  background: #0d121a;
  font: inherit;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(72, 209, 181, 0.12);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  padding: 14px;
}

.entry-screen {
  min-height: calc(100vh - 28px);
  display: grid;
  align-content: center;
  gap: 16px;
}

.entry-brand {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.entry-brand h1 {
  font-size: clamp(34px, 6vw, 64px);
}

.entry-brand p,
.character-header p,
.class-card p {
  color: var(--muted);
}

.crest.large {
  width: 58px;
  height: 58px;
  font-size: 24px;
}

.auth-layout {
  width: min(880px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-card,
.creator-card,
.saved-characters {
  padding: 14px;
}

.auth-card {
  display: grid;
  gap: 12px;
}

.character-header {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.character-header h1 {
  font-size: 28px;
}

.saved-characters,
.creator-card {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.saved-character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.saved-character-card {
  min-height: 132px;
  display: grid;
  grid-template-columns: 82px 1fr;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.saved-character-card .sprite-asset {
  width: 78px;
  height: 78px;
  object-fit: contain;
  image-rendering: pixelated;
}

.saved-character-card button {
  grid-column: 1 / -1;
}

.creator-top {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.gender-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
}

.gender-option {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #111722;
  cursor: pointer;
  font-weight: 800;
}

.gender-option.active {
  color: #06110f;
  background: var(--teal);
  border-color: #0b0d10;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.class-card {
  position: relative;
  min-height: 520px;
  display: grid;
  grid-template-rows: 174px 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #121822;
  cursor: pointer;
}

.class-card.active,
.class-card:hover {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(247, 183, 51, 0.22);
}

.class-card .sprite-asset {
  align-self: end;
  justify-self: center;
  width: 164px;
  height: 164px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.28));
}

.class-select-hit {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.class-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
}

.class-body h3 {
  font-size: 17px;
}

.class-body p {
  min-height: 58px;
  font-size: 12px;
  line-height: 1.35;
}

.class-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.class-stats span,
.pros-cons span {
  display: block;
  min-height: 26px;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d121a;
  color: var(--muted);
  font-size: 11px;
}

.pros-cons {
  display: grid;
  gap: 8px;
}

.pros-cons div {
  display: grid;
  gap: 5px;
}

.pros-cons strong {
  color: var(--ink);
  font-size: 12px;
}

.create-character-btn {
  width: min(360px, 100%);
  margin-top: 14px;
}

.compact-btn {
  min-width: 92px;
  padding-inline: 12px;
}

.strong-empty {
  font-weight: 700;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(25, 29, 36, 0.92);
  box-shadow: 0 12px 28px var(--shadow);
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.crest {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #111316;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  border: 2px solid #000;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.22);
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  letter-spacing: 0;
}

.identity p,
.combat-header p,
.profile-card p {
  color: var(--muted);
  font-size: 12px;
}

.top-stats {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.threat-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: #0f1218;
  font-size: 12px;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(420px, 1fr) minmax(260px, 330px);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(25, 29, 36, 0.94);
  box-shadow: 0 12px 28px var(--shadow);
}

.side-panel,
.combat-panel,
.encounter-panel {
  padding: 12px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.combat-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.panel-head,
.combat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-head h2,
.combat-header h2 {
  font-size: 15px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.quests-head {
  margin-top: 4px;
}

.zone-list,
.quest-list,
.encounter-list,
.inventory-list,
.equipment-list {
  display: grid;
  gap: 8px;
}

.zone-card,
.quest-card,
.encounter-card,
.item-row,
.equipment-row {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 9px;
}

.zone-card,
.encounter-card {
  cursor: pointer;
}

.zone-card:hover,
.encounter-card:hover,
.zone-card.active,
.encounter-card.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(72, 209, 181, 0.18);
}

.zone-card h3,
.quest-card h3,
.encounter-card h3,
.item-row h3 {
  font-size: 13px;
  margin-bottom: 4px;
}

.tiny {
  color: var(--muted);
  font-size: 11px;
}

.bar {
  height: 9px;
  border: 1px solid #090b0e;
  background: #0a0c10;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--fill, var(--green));
  transition: width 0.25s ease;
}

.quest-card.done {
  border-color: rgba(105, 210, 123, 0.58);
}

.quest-reward,
.rarity {
  color: var(--gold);
  font-weight: 700;
}

.arena {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 72px minmax(150px, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 300px;
  padding: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(72, 209, 181, 0.06), transparent 34%),
    #111722;
  overflow: hidden;
}

.combatant {
  position: relative;
  min-height: 274px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.combatant h3 {
  font-size: 13px;
  text-align: center;
}

.sprite-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
}

.sprite-wrap .sprite-asset {
  width: clamp(92px, 13vw, 148px);
  height: clamp(92px, 13vw, 148px);
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.24));
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.pet {
  position: absolute;
  bottom: 14px;
  right: 12%;
  width: clamp(42px, 5vw, 58px);
  height: clamp(42px, 5vw, 58px);
  z-index: 2;
}

.hp-readout {
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.turn-lane {
  display: grid;
  place-items: center;
}

.turn-track {
  width: 4px;
  height: 78%;
  background: repeating-linear-gradient(to bottom, var(--line), var(--line) 10px, transparent 10px, transparent 18px);
}

.damage-float {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--gold);
  font-weight: 900;
  text-shadow: 0 2px #000;
  animation: float-damage 0.9s ease forwards;
  pointer-events: none;
}

.hero-side.strike .sprite-wrap {
  animation: strike-right 0.32s ease;
}

.enemy-side.strike .sprite-wrap {
  animation: strike-left 0.32s ease;
}

.hit .sprite-wrap {
  animation: hurt-flash 0.35s ease;
}

.ability-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.game-btn,
.icon-btn {
  min-height: 38px;
  border: 1px solid #0b0d10;
  background: var(--gold);
  color: #16140c;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.18);
  font-weight: 800;
  cursor: pointer;
}

.game-btn.secondary {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--line);
}

.game-btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.game-btn.auto-active {
  background: var(--teal);
  color: #06110f;
}

.combat-log {
  height: 132px;
  margin-top: 10px;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #0c0f14;
  color: #d7d2c2;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.log-line {
  margin-bottom: 4px;
}

.encounter-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.encounter-card {
  min-height: 128px;
  display: grid;
  gap: 5px;
}

.encounter-card .mini-sprite {
  width: 48px;
  height: 48px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.avatar-frame {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid #0b0d10;
  background: #10151f;
}

.avatar-frame img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  image-rendering: pixelated;
}

.sprite-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  background: #111722;
}

.sprite-swatch {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 6px 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d121a;
}

.sprite-swatch img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}

.sprite-swatch span {
  max-width: 100%;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-tile {
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #111722;
}

.stat-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-tile strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.equipment-row,
.item-row {
  display: grid;
  gap: 6px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #111722;
  color: var(--ink);
  cursor: pointer;
}

.empty {
  color: var(--muted);
  padding: 10px;
  border: 1px dashed var(--line);
  font-size: 12px;
}

.toast-stack {
  position: fixed;
  top: 92px;
  left: 50%;
  width: min(420px, calc(100vw - 28px));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 30;
  pointer-events: none;
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #090b0f;
  box-shadow: 0 12px 28px var(--shadow);
  animation: toast-in 2.5s ease forwards;
  font-weight: 700;
}

@keyframes float-damage {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.82);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -14px) scale(1.18);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -56px) scale(1);
  }
}

@keyframes strike-right {
  50% {
    transform: translateX(26px) scale(1.04);
  }
}

@keyframes strike-left {
  50% {
    transform: translateX(-26px) scale(1.04);
  }
}

@keyframes hurt-flash {
  30% {
    filter: brightness(2.4) saturate(0.4);
  }
}

@keyframes toast-in {
  0% {
    opacity: 0;
    transform: translateY(-12px);
  }
  12%,
  82% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 1180px) {
  .game-grid {
    grid-template-columns: minmax(220px, 280px) minmax(420px, 1fr);
  }

  .class-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-grid > .side-panel:last-child {
    grid-column: 1 / -1;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 8px;
  }

  .auth-layout,
  .creator-top,
  .saved-character-grid,
  .class-grid {
    grid-template-columns: 1fr;
  }

  .character-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .class-card {
    min-height: 0;
    grid-template-columns: 132px 1fr;
    grid-template-rows: auto;
  }

  .class-card .sprite-asset {
    width: 126px;
    height: 126px;
  }

  .class-body p {
    min-height: 0;
  }

  .topbar,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-stats {
    justify-content: flex-start;
  }

  .game-grid {
    display: grid;
  }

  .arena {
    grid-template-columns: 1fr;
  }

  .turn-lane {
    display: none;
  }

  .ability-bar,
  .encounter-list,
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .ability-bar,
  .encounter-list,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .gender-toggle,
  .class-stats {
    grid-template-columns: 1fr;
  }

  .class-card {
    grid-template-columns: 1fr;
  }

  .identity {
    min-width: 0;
  }
}

/* Medieval premium skin */
:root {
  --bg: #090705;
  --panel: rgba(28, 22, 16, 0.92);
  --panel-2: rgba(41, 31, 21, 0.95);
  --ink: #f7ead3;
  --muted: #b9a789;
  --line: rgba(221, 169, 91, 0.28);
  --gold: #f2b84d;
  --teal: #65d883;
  --red: #d44a4a;
  --green: #65d883;
  --violet: #9b66ff;
  --blue: #67d7ff;
  --shadow: rgba(0, 0, 0, 0.48);
  --radius: 18px;
  --line-strong: rgba(255, 201, 103, 0.58);
  --gold-2: #ffdc86;
}

body {
  background:
    radial-gradient(circle at 50% -10%, rgba(242, 184, 77, 0.18), transparent 32rem),
    radial-gradient(circle at 82% 22%, rgba(101, 216, 131, 0.08), transparent 30rem),
    radial-gradient(circle at 20% 75%, rgba(103, 215, 255, 0.06), transparent 28rem),
    linear-gradient(180deg, #11100f 0%, #090705 60%, #040302 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.app-shell {
  width: min(1760px, calc(100% - 28px));
  margin: 14px auto 36px;
  padding: 0;
}

.panel,
.topbar,
.auth-card,
.creator-card,
.saved-characters {
  border-color: var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 230, 164, 0.055), transparent 120px),
    linear-gradient(180deg, var(--panel), rgba(13, 10, 8, 0.94));
  box-shadow: 0 18px 50px var(--shadow), inset 0 0 0 1px rgba(255, 226, 158, 0.08);
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  min-height: 80px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  padding: 14px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 223, 143, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(38, 29, 20, 0.96), rgba(17, 13, 10, 0.96));
  backdrop-filter: blur(14px);
}

.identity {
  min-width: 0;
}

.crest {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: #141007;
  background:
    radial-gradient(circle at 34% 28%, #fff4bf, transparent 20%),
    linear-gradient(145deg, #e8b349, #95ce60 48%, #334a25);
  border: 1px solid rgba(255, 231, 161, 0.8);
  box-shadow: 0 0 28px rgba(242, 184, 77, 0.28);
}

.crest.large {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

h1,
.entry-brand h1,
.character-header h1,
.panel-head h2,
.combat-header h2,
.profile-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

.entry-brand {
  padding-top: 20px;
}

.entry-brand h1 {
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}

.auth-card,
.creator-card,
.saved-characters {
  padding: 18px;
}

input {
  border-color: rgba(255, 215, 143, 0.18);
  border-radius: 12px;
  background: rgba(2, 2, 2, 0.34);
}

input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(242, 184, 77, 0.12);
}

.game-btn,
.icon-btn,
.btn,
.row-actions button {
  min-height: 42px;
  border: 1px solid rgba(255, 228, 154, 0.48);
  border-radius: 12px;
  color: #1b1005;
  background: linear-gradient(180deg, #ffdf83, #d6912e);
  box-shadow: 0 8px 22px rgba(242, 184, 77, 0.16), inset 0 -4px rgba(0, 0, 0, 0.16);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.game-btn:hover,
.row-actions button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.game-btn.secondary,
.row-actions button,
.gender-option {
  color: var(--ink);
  border-color: rgba(255, 215, 143, 0.22);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

.game-btn.auto-active,
.gender-option.active {
  color: #1b1005;
  border-color: rgba(255, 228, 154, 0.76);
  background: linear-gradient(180deg, #ffdf83, #d6912e);
}

.chip,
.threat-pill,
.panel-head span {
  border-color: rgba(255, 215, 143, 0.22);
  border-radius: 12px;
  background: rgba(2, 2, 2, 0.36);
  color: var(--gold-2);
  font-weight: 900;
}

.game-grid {
  grid-template-columns: 290px minmax(0, 1fr) 330px;
}

.side-panel,
.combat-panel,
.encounter-panel {
  padding: 0;
}

.panel-head,
.combat-header {
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 215, 143, 0.12);
}

.zone-list,
.quest-list,
.equipment-list,
.inventory-list,
.sprite-gallery,
.stat-grid,
.profile-card {
  margin: 12px;
}

.zone-card,
.quest-card,
.encounter-card,
.item-row,
.equipment-row,
.stat-tile,
.sprite-swatch,
.profile-card,
.saved-character-card,
.class-card {
  border-color: rgba(255, 215, 143, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.zone-card,
.quest-card,
.encounter-card,
.item-row,
.equipment-row {
  padding: 12px;
}

.zone-card {
  position: relative;
  overflow: hidden;
}

.zone-card::before,
.class-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 90% 0%, rgba(242, 184, 77, 0.18), transparent 46%);
  transition: opacity 0.18s ease;
}

.zone-card:hover,
.zone-card.active,
.encounter-card:hover,
.encounter-card.active,
.class-card:hover,
.class-card.active {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(242, 184, 77, 0.12);
}

.zone-card.active::before,
.class-card.active::before {
  opacity: 1;
}

.bar {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
}

.bar span {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.combat-header {
  display: grid;
  grid-template-columns: 1fr auto;
  background:
    radial-gradient(circle at 20% 0%, rgba(242, 184, 77, 0.15), transparent 25rem),
    rgba(255, 255, 255, 0.025);
}

.arena {
  margin: 14px;
  min-height: 380px;
  padding: clamp(14px, 2vw, 28px);
  border-color: rgba(255, 215, 143, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.72)),
    radial-gradient(ellipse at center 74%, rgba(242, 184, 77, 0.16), transparent 38%),
    radial-gradient(circle at 20% 28%, rgba(82, 166, 255, 0.16), transparent 9rem),
    radial-gradient(circle at 80% 28%, rgba(82, 166, 255, 0.13), transparent 9rem),
    linear-gradient(180deg, #151820 0%, #10100f 46%, #080706 100%);
}

.arena::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 88%, rgba(242, 184, 77, 0.14), transparent 7rem),
    radial-gradient(circle at 88% 88%, rgba(212, 74, 74, 0.12), transparent 8rem),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.4));
}

.combatant {
  z-index: 1;
  background: transparent;
  border: 0;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.55));
}

.combatant h3 {
  font-size: 14px;
  text-shadow: 0 2px 0 #000;
}

.sprite-wrap {
  min-height: 190px;
}

.sprite-wrap .sprite-asset {
  width: clamp(132px, 16vw, 188px);
  height: clamp(132px, 16vw, 188px);
  filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.45));
  animation: breathe 2.7s ease-in-out infinite;
}

.pet {
  width: clamp(54px, 6vw, 74px);
  height: clamp(54px, 6vw, 74px);
}

.turn-lane {
  z-index: 2;
}

.turn-track {
  display: none;
}

.turn-lane::after {
  content: "VS";
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 231, 171, 0.85);
  border-radius: 50%;
  color: #1d1004;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 950;
  background: linear-gradient(180deg, #ffe196, #c47b22);
  box-shadow: 0 0 34px rgba(242, 184, 77, 0.3);
}

.ability-bar {
  padding: 0 14px 14px;
  margin-top: 0;
}

.combat-log {
  min-height: 155px;
  height: 155px;
  margin: 0 14px 14px;
  border-color: rgba(255, 215, 143, 0.14);
  border-radius: 16px;
  background: rgba(2, 2, 2, 0.46);
  color: #e8dcc6;
}

.encounter-panel .panel-head {
  border-bottom: 0;
}

.encounter-list {
  padding: 0 14px 14px;
}

.encounter-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  min-height: 92px;
  align-items: center;
}

.encounter-card .mini-sprite {
  width: 54px;
  height: 54px;
}

.profile-card {
  border-radius: 16px;
  background:
    radial-gradient(circle at 22% 25%, rgba(101, 216, 131, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.045);
}

.avatar-frame,
.party-slot,
.sprite-swatch {
  border-color: rgba(255, 215, 143, 0.15);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 25%, rgba(101, 216, 131, 0.2), transparent 50%),
    rgba(0, 0, 0, 0.3);
}

.avatar-frame img {
  width: 62px;
  height: 62px;
}

.sprite-gallery {
  border-radius: 16px;
  background: transparent;
  border: 0;
  padding: 0;
}

.stat-tile {
  min-height: 62px;
  padding: 10px 8px;
  background: rgba(0, 0, 0, 0.25);
}

.stat-tile span {
  font-weight: 850;
  text-transform: uppercase;
}

.class-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 4%, rgba(242, 184, 77, 0.08), transparent 38%),
    rgba(255, 255, 255, 0.04);
}

.class-card .sprite-asset {
  z-index: 1;
}

.class-stats span,
.pros-cons span {
  border-color: rgba(255, 215, 143, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.012);
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 18px, 760px);
  }

  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .arena {
    grid-template-columns: 1fr;
    min-height: 540px;
  }

  .turn-lane {
    display: grid;
  }

  .turn-lane::after {
    margin: -8px auto;
  }

  .ability-bar {
    grid-template-columns: 1fr 1fr;
  }

  .ability-bar .game-btn:last-child {
    grid-column: 1 / -1;
  }

  .encounter-list {
    grid-template-columns: 1fr;
  }
}

/* Login scene background */
#authScreen.entry-screen {
  width: 100%;
  min-height: 100vh;
  margin-left: 0;
  margin-top: 0;
  padding: clamp(270px, 32vw, 390px) 18px 42px;
  align-content: start;
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(2, 2, 3, 0.05) 0%, rgba(2, 2, 3, 0.08) 34%, rgba(2, 2, 3, 0.72) 68%, rgba(2, 2, 3, 0.92) 100%),
    url("./assets/backgrounds/login-nocthara.png") center top / cover no-repeat;
}

.app-shell:has(#authScreen:not([hidden])) {
  width: 100%;
  margin: 0;
}

#authScreen .entry-brand {
  width: min(760px, 100%);
  min-height: 0;
  padding: 0;
}

#authScreen .entry-brand .crest,
#authScreen .entry-brand h1,
#authScreen .entry-brand p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#authScreen .auth-layout {
  width: min(720px, calc(100vw - 28px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  align-items: stretch;
  gap: 14px;
}

#authScreen .auth-card {
  position: relative;
  min-height: 286px;
  padding: 16px;
  border: 3px solid #d7a94f;
  border-radius: 0;
  outline: 2px solid rgba(43, 21, 8, 0.95);
  background:
    linear-gradient(90deg, rgba(255, 220, 134, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(255, 220, 134, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(48, 28, 16, 0.92), rgba(8, 6, 5, 0.94));
  background-size: 8px 8px, 8px 8px, auto;
  box-shadow:
    0 0 0 2px rgba(255, 226, 158, 0.16) inset,
    0 8px 0 rgba(0, 0, 0, 0.62),
    8px 8px 0 rgba(0, 0, 0, 0.34);
  backdrop-filter: none;
  image-rendering: pixelated;
}

#authScreen .auth-card::before,
#authScreen .auth-card::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  background:
    linear-gradient(#ffdf83, #ffdf83) left top / 18px 4px no-repeat,
    linear-gradient(#ffdf83, #ffdf83) left top / 4px 18px no-repeat;
}

#authScreen .auth-card::before {
  left: 8px;
  top: 8px;
}

#authScreen .auth-card::after {
  right: 8px;
  bottom: 8px;
  transform: rotate(180deg);
}

#authScreen .auth-card .panel-head {
  min-height: 44px;
  padding: 0 0 11px;
  border-bottom: 2px solid rgba(215, 169, 79, 0.4);
}

#authScreen .auth-card .panel-head h2 {
  font-size: 18px;
  color: #ffdc86;
  text-shadow: 2px 2px 0 #1b0d05;
}

#authScreen .auth-card .panel-head span {
  min-height: 28px;
  border: 2px solid rgba(215, 169, 79, 0.34);
  border-radius: 0;
  color: #ffdc86;
  background: rgba(0, 0, 0, 0.32);
}

#authScreen .auth-card label {
  color: #d8c199;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 800;
}

#authScreen .auth-card input {
  min-height: 44px;
  border: 3px solid #5b3718;
  border-radius: 0;
  background: #080604;
  box-shadow:
    0 0 0 2px rgba(255, 220, 134, 0.12) inset,
    4px 4px 0 rgba(0, 0, 0, 0.32);
}

#authScreen .auth-card input:focus {
  border-color: #ffdc86;
  box-shadow:
    0 0 0 2px rgba(242, 184, 77, 0.2) inset,
    4px 4px 0 rgba(0, 0, 0, 0.32);
}

#authScreen .auth-card .game-btn {
  min-height: 46px;
  margin-top: 2px;
  border: 3px solid #6c3d13;
  border-radius: 0;
  color: #1b1005;
  background:
    linear-gradient(180deg, #ffe28a 0%, #f2b84d 52%, #b66d1f 100%);
  box-shadow:
    0 4px 0 #442007,
    0 0 0 2px rgba(255, 246, 191, 0.22) inset;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 1px 1px 0 rgba(255, 244, 191, 0.48);
}

#authScreen .auth-card .game-btn.secondary {
  color: #ffdc86;
  border-color: #785024;
  background:
    linear-gradient(180deg, rgba(56, 35, 18, 0.96), rgba(15, 10, 7, 0.98));
  text-shadow: 2px 2px 0 #000;
}

@media (min-width: 1500px) {
  #authScreen.entry-screen {
    padding-top: 405px;
  }
}

@media (max-width: 980px) {
  #authScreen.entry-screen {
    padding-top: clamp(230px, 38vw, 330px);
    background-position: center top;
  }
}

@media (max-width: 680px) {
  #authScreen.entry-screen {
    padding-top: 250px;
    background-size: auto 100vh;
    background-position: center top;
  }

  #authScreen .auth-layout {
    grid-template-columns: 1fr;
  }
}
