:root {
  --bg: #111318;
  --panel: #20242c;
  --panel-2: #2a3039;
  --line: #444b56;
  --text: #f3f4f6;
  --muted: #aab2bf;
  --accent: #f97316;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --shadow: rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  min-height: 100vh;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(32, 36, 44, 0.97);
  box-shadow: 10px 0 30px var(--shadow);
}

.hidden {
  display: none !important;
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 2px solid #6b7280;
  background:
    linear-gradient(90deg, #3b2f2f 0 50%, #7c4a2d 50% 100%) 0 0 / 100% 50% no-repeat,
    linear-gradient(90deg, #f97316 0 50%, #22c55e 50% 100%) 0 100% / 100% 50% no-repeat;
  image-rendering: pixelated;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  color: #d7dee8;
  font-size: 0.78rem;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand p,
.message {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

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

.stat,
.local-player-card,
.controls,
.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181c22;
}

.stat {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 12px;
}

.mage-stat {
  gap: 7px;
}

.health-stat strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.health-stat .bar {
  height: 11px;
}

.local-player-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.local-player-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.local-player-identity {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  flex-wrap: wrap;
}

.local-player-wallet {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.coin-count {
  color: #facc15;
}

.skill-count {
  color: #d8ad55;
}

.player-card-bars {
  display: grid;
  gap: 8px;
}

.player-card-bars span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.local-player-heading strong {
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.local-player-wallet strong {
  color: inherit;
  font-size: inherit;
}

.local-player-heading small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.player-card-bars label {
  display: grid;
  gap: 5px;
}

.player-card-bars label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.player-card-bars label > span > strong {
  color: var(--text);
  font-size: 0.86rem;
  white-space: nowrap;
}

.player-card-bars .bar {
  height: 8px;
}

.local-player-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.local-player-detail strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  text-align: right;
}

.local-player-detail strong.ready {
  color: #86efac;
}

.local-player-detail strong.cooldown {
  color: #d8ad55;
}

.local-player-detail strong.active {
  color: #38bdf8;
}

.bar {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #090b10;
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: #38bdf8;
}

.health-bar span {
  background: var(--accent-2);
}

.stat span,
.control-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  font-size: 1.15rem;
}

.controls {
  position: relative;
  display: grid;
  gap: 0;
  padding: 12px 14px;
}

.controls-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controls-summary strong {
  color: var(--text);
  font-size: 0.88rem;
}

.controls-popover {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-row strong {
  font-size: 0.88rem;
  text-align: right;
}

.skill-tree-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181c22;
  color: var(--text);
  font-weight: 900;
  text-transform: uppercase;
}

.skill-tree-toggle strong {
  color: #d7dee8;
  font-size: 0.78rem;
  line-height: 1;
}

.skill-tree-toggle span {
  color: var(--text);
  font-size: 0.88rem;
  text-transform: none;
}

.skill-tree-overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(8, 10, 13, 0.82);
}

.skill-tree-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(230px, 0.75fr);
  gap: 16px;
  width: min(1040px, 100%);
  max-height: min(720px, calc(100vh - 52px));
}

.skill-tree-main,
.skill-tree-detail {
  min-height: 440px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #181c22;
  box-shadow: 0 20px 50px var(--shadow);
}

.skill-tree-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.skill-tree-main header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.skill-tree-main h2 {
  color: var(--text);
  font-size: 0.95rem;
}

.skill-tree-main p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.skill-tree-main header button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #11151b;
  color: var(--text);
  font-weight: 900;
}

.skill-tree-grid {
  display: grid;
  align-content: start;
  gap: 24px;
  overflow: auto;
  padding: 22px;
}

.skill-level {
  display: grid;
  gap: 12px;
}

.skill-level h3 {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.skill-level-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding-left: 8px;
}

.skill-node {
  display: grid;
  place-items: center;
  gap: 2px;
  width: 54px;
  height: 54px;
  padding: 5px;
  border: 2px solid #56606d;
  border-radius: 7px;
  background: #202631;
  color: var(--text);
  text-align: center;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.22);
}

.skill-node strong {
  font-size: 0.82rem;
  line-height: 1;
}

.skill-node span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
}

.skill-node.locked {
  border-color: #303744;
  background: #12161d;
  color: #6b7280;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.16);
}

.skill-node.locked span {
  color: #5f6876;
}

.skill-node.unlocked {
  border-color: #86efac;
  background: #173123;
  color: #86efac;
}

.skill-node.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.skill-tree-detail {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 16px;
}

.skill-tree-detail > span,
.skill-cost-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.skill-tree-detail h3 {
  color: var(--text);
  font-size: 1.05rem;
}

.skill-tree-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}

.skill-cost-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.skill-cost-row strong {
  color: #d8ad55;
}

.skill-tree-detail button {
  min-height: 44px;
  border: 2px solid #1b0f08;
  border-radius: 6px;
  background: var(--accent);
  color: #1b0f08;
  font-weight: 900;
}

.skill-tree-detail button:disabled {
  cursor: not-allowed;
  border-color: #303744;
  background: #252a32;
  color: #7d8795;
}

.empty-tree {
  margin: 0;
  padding: 18px;
  border: 1px solid #303744;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-row button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
}

.button-row button:hover,
.button-row button:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.player-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181c22;
}

.party-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.party-crown {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

.party-player-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.player-list {
  display: grid;
  gap: 10px;
}

.player-row {
  display: grid;
  gap: 6px;
}

.player-row header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.player-row small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.party-slot.empty {
  opacity: 0.55;
}

.party-slot.empty header span {
  color: var(--muted);
}

.party-slot.empty .player-health {
  background: #11151b;
}

.player-health {
  height: 7px;
  overflow: hidden;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #090b10;
}

.player-health span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: auto;
  height: min(360px, 42vh);
  min-height: 260px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181c22;
}

.chat-view {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  padding: 9px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #090b10;
}

.chat-line {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-line strong {
  color: var(--accent);
  font-size: 0.74rem;
}

.chat-system {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chat-form input {
  min-width: 0;
  height: 38px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #090b10;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
}

.chat-form button {
  min-width: 64px;
  height: 38px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #1b0f08;
  font-size: 0.78rem;
  font-weight: 900;
}

.message {
  min-height: 62px;
  padding: 13px;
  font-weight: 650;
}

.play-area {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 26px;
  overflow: hidden;
}

#game {
  width: min(calc(100vw - 390px), calc((100vh - 90px) * 1.6667));
  max-width: 100%;
  height: auto;
  aspect-ratio: 320 / 192;
  border: 2px solid #667085;
  border-radius: 8px;
  background: #0b0e12;
  box-shadow: 0 18px 45px var(--shadow);
  image-rendering: pixelated;
  touch-action: none;
}

#game:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.hud {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  pointer-events: none;
}

.game-over-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  gap: 14px;
  min-width: 210px;
  padding: 18px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: rgba(13, 16, 22, 0.94);
  box-shadow: 0 18px 40px var(--shadow);
  text-align: center;
  transform: translate(-50%, -50%);
}

.game-over-panel strong {
  color: var(--text);
  font-size: 1.15rem;
  text-transform: uppercase;
}

.game-over-panel button {
  border: 2px solid #1b0f08;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--accent);
  color: #1b0f08;
  font-weight: 900;
}

.site-footer-mark {
  position: fixed;
  bottom: 8px;
  z-index: 20;
  color: rgba(243, 244, 246, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}

.site-footer-left {
  left: 12px;
}

.site-footer-right {
  right: 12px;
}

.start-screen,
.character-select,
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
}

.character-select,
.auth-screen {
  background: rgba(8, 10, 13, 0.9);
}

.start-screen.hidden,
.character-select.hidden,
.auth-screen.hidden {
  display: none;
}

.account-button {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 3;
  min-height: 44px;
  border: 3px solid #15092f;
  border-radius: 0;
  background: #fff9db;
  color: #20103f;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 5px 5px 0 #15092f;
}

.public-rooms-panel {
  position: fixed;
  left: 22px;
  top: 22px;
  z-index: 3;
  display: grid;
  gap: 12px;
  width: min(280px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  padding: 14px;
  border: 3px solid #15092f;
  background: rgba(255, 249, 219, 0.95);
  color: #20103f;
  box-shadow: 6px 6px 0 #15092f;
}

.public-rooms-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.public-rooms-panel h2 {
  color: #20103f;
  font-size: 0.82rem;
}

.public-rooms-panel button,
.room-visibility button {
  min-height: 34px;
  border: 2px solid #15092f;
  border-radius: 0;
  background: #facc15;
  color: #20103f;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 #15092f;
}

.public-rooms-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.public-rooms-list p {
  color: #4b3b63;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

.public-room-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  width: 100%;
  text-align: left;
}

.public-room-card span {
  font-size: 0.75rem;
  font-weight: 800;
}

.room-setup-panel {
  width: min(500px, 100%);
}

.room-visibility {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.room-visibility button {
  min-height: 46px;
  background: #8fffe4;
}

.room-visibility button.active {
  background: #facc15;
  box-shadow: inset 0 0 0 3px rgba(249, 115, 22, 0.35), 3px 3px 0 #15092f;
}

.max-players-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  color: var(--text);
  font-weight: 800;
  text-transform: uppercase;
}

.max-players-control input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
}

.account-button:hover,
.account-button:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 #15092f;
  outline: 0;
}

.start-panel {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(620px, 100%);
  padding: clamp(18px, 4vw, 34px);
  text-align: center;
}

.logo-lockup {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 30px;
  text-align: center;
}

.logo-mark {
  width: min(520px, 82vw);
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.start-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.start-actions button,
.join-room button {
  min-height: 58px;
  border: 3px solid #15092f;
  border-radius: 0;
  background: #facc15;
  color: #20103f;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 6px 6px 0 #15092f;
}

.start-actions button:last-child {
  border-color: #15092f;
  background: #8fffe4;
  color: #20103f;
}

.start-actions button:hover,
.start-actions button:focus-visible,
.join-room button:hover,
.join-room button:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 #15092f;
  outline: 0;
}

.join-room {
  display: grid;
  gap: 9px;
  width: min(520px, 100%);
  margin: 22px auto 0;
}

.join-room label {
  color: #8fffe4;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.join-room div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.join-room input {
  min-height: 58px;
  min-width: 0;
  border: 3px solid #15092f;
  border-radius: 0;
  background: #fff9db;
  color: #20103f;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 6px 6px 0 #15092f;
}

.join-room input:focus {
  border-color: #8fffe4;
  outline: 4px solid rgba(143, 255, 228, 0.28);
}

.start-screen {
  overflow: hidden;
  isolation: isolate;
  background: #080a0d;
}

.start-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    rgba(8, 10, 13, 0.16);
  background-size: 28px 28px, 28px 28px, auto;
}

.start-screen::after {
  content: none;
}

.menu-dungeon-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background: #080a0d;
  pointer-events: none;
  image-rendering: pixelated;
}

.pixel-cloud {
  width: 124px;
  height: 52px;
  background: #fff9db;
  box-shadow:
    28px -20px 0 #fff9db,
    56px -20px 0 #fff9db,
    84px 0 0 #fff9db,
    28px 28px 0 rgba(0, 0, 0, 0.16),
    56px 28px 0 rgba(0, 0, 0, 0.16);
  opacity: 0.86;
}

.cloud-one {
  top: 12%;
  left: 9%;
  animation: drift 7s steps(6) infinite;
}

.cloud-two {
  right: 10%;
  bottom: 24%;
  transform: scale(0.72);
  animation: drift 8s steps(6) infinite reverse;
}

.pixel-spark {
  width: 18px;
  height: 18px;
  background: #facc15;
  box-shadow:
    18px 0 #facc15,
    0 18px #facc15,
    18px 18px #fff3a3;
  animation: blink 1.8s steps(2) infinite;
}

.spark-one {
  top: 24%;
  right: 20%;
}

.spark-two {
  bottom: 22%;
  left: 18%;
  background: #2dd4bf;
  box-shadow:
    18px 0 #2dd4bf,
    0 18px #2dd4bf,
    18px 18px #8fffe4;
  animation-delay: 0.45s;
}

@keyframes drift {
  0%, 100% {
    translate: 0 0;
  }

  50% {
    translate: 20px -8px;
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
    scale: 1;
  }

  50% {
    opacity: 0.35;
    scale: 0.82;
  }
}

.select-panel {
  width: min(820px, 100%);
  padding: 22px;
  border: 2px solid #667085;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px var(--shadow);
}

.auth-panel {
  position: relative;
  width: min(460px, 100%);
  padding: 22px;
  border: 2px solid #667085;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px var(--shadow);
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #181c22;
  color: var(--text);
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-tabs button,
.auth-form button,
.signout-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181c22;
  color: var(--text);
  font-weight: 800;
}

.auth-tabs button.active,
.auth-form button {
  border-color: var(--accent);
  background: var(--accent);
  color: #1b0f08;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form.hidden,
.signout-button.hidden {
  display: none;
}

.auth-form label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-form input {
  min-height: 44px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff9db;
  color: #20103f;
  font: inherit;
  font-weight: 800;
  padding: 0 11px;
}

.auth-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(249, 115, 22, 0.24);
}

.account-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

.account-status.success {
  color: #86efac;
}

.account-status.error {
  color: #fca5a5;
}

.signout-button {
  width: 100%;
  margin-top: 10px;
}

.select-heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.select-heading h2 {
  color: var(--text);
  font-size: 1.55rem;
  text-transform: none;
}

.select-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 650;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.class-choice {
  position: relative;
  min-width: 0;
}

.class-card {
  display: grid;
  gap: 9px;
  width: 100%;
  min-height: 178px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181c22;
  color: var(--text);
  text-align: left;
}

#character-select .class-card {
  min-height: 124px;
  align-content: center;
  justify-items: start;
  padding-right: 42px;
}

.class-info-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #252a32;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
}

.class-info-btn:hover,
.class-info-btn:focus-visible {
  border-color: var(--accent);
  background: #2e241d;
  outline: 0;
}

.class-card:hover,
.class-card:focus-visible,
.class-card.active {
  border-color: var(--accent);
  outline: 0;
}

.class-card.active {
  background: #2e241d;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.35);
}

.class-card strong {
  font-size: 1rem;
}

.class-card span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

#character-select .class-card span:last-child {
  color: inherit;
  font-size: inherit;
  line-height: normal;
}

.skill-details {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11151b;
  text-align: left;
}

.skill-details.hidden {
  display: none;
}

.skill-details-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.skill-details-header h3 {
  color: var(--text);
  font-size: 1rem;
}

.skill-details-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}

.skill-details-header button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #181c22;
  color: var(--text);
  font-weight: 900;
}

.skill-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.skill-card {
  min-height: 88px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: #181c22;
}

.skill-card strong {
  display: block;
  color: var(--text);
  font-size: 0.84rem;
}

.skill-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.class-icon {
  width: 34px;
  height: 34px;
  border: 1px solid #667085;
  image-rendering: pixelated;
}

.mage-icon {
  background:
    linear-gradient(90deg, transparent 0 30%, #38bdf8 30% 70%, transparent 70%) 0 0 / 100% 35% no-repeat,
    linear-gradient(90deg, #f5bf80 0 35%, #181a21 35% 65%, #f5bf80 65%) 0 38% / 100% 25% no-repeat,
    linear-gradient(90deg, transparent 0 20%, #48b5a3 20% 80%, transparent 80%) 0 100% / 100% 40% no-repeat;
}

.knight-icon {
  background:
    linear-gradient(90deg, transparent 0 20%, #cbd5e1 20% 80%, transparent 80%) 0 0 / 100% 55% no-repeat,
    linear-gradient(90deg, #64748b 0 50%, #94a3b8 50%) 0 100% / 100% 45% no-repeat;
}

.ranger-icon {
  background:
    linear-gradient(90deg, transparent 0 20%, #84cc16 20% 80%, transparent 80%) 0 0 / 100% 50% no-repeat,
    linear-gradient(90deg, #7c4a2d 0 35%, #f5bf80 35% 65%, #7c4a2d 65%) 0 100% / 100% 50% no-repeat;
}

.rogue-icon {
  background:
    linear-gradient(90deg, transparent 0 25%, #181a21 25% 75%, transparent 75%) 0 0 / 100% 50% no-repeat,
    linear-gradient(90deg, #a78bfa 0 35%, #181a21 35% 65%, #a78bfa 65%) 0 100% / 100% 50% no-repeat;
}

.healer-icon {
  background:
    linear-gradient(90deg, transparent 0 25%, #f0abfc 25% 75%, transparent 75%) 0 0 / 100% 45% no-repeat,
    linear-gradient(90deg, #fef3c7 0 30%, #86efac 30% 70%, #fef3c7 70%) 0 100% / 100% 55% no-repeat;
}

.crawler-icon {
  background:
    linear-gradient(90deg, #646b76 0 25%, #252a32 25% 75%, #646b76 75%) 0 0 / 100% 35% no-repeat,
    linear-gradient(90deg, #252a32 0 35%, #d8ad55 35% 65%, #252a32 65%) 0 55% / 100% 35% no-repeat,
    #080a0d;
}

.endless-icon {
  background:
    linear-gradient(90deg, #646b76 0 25%, #252a32 25% 75%, #646b76 75%) 0 0 / 100% 100% no-repeat,
    linear-gradient(90deg, #ef4444 0 35%, transparent 35% 65%, #84cc16 65%) 0 50% / 100% 28% no-repeat;
}

.boss-icon {
  background:
    linear-gradient(90deg, transparent 0 15%, #ef4444 15% 85%, transparent 85%) 0 0 / 100% 45% no-repeat,
    linear-gradient(90deg, #181a21 0 25%, #ef4444 25% 75%, #181a21 75%) 0 100% / 100% 55% no-repeat;
}

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

.start-button {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  border: 1px solid #fb923c;
  border-radius: 8px;
  background: var(--accent);
  color: #1b0f08;
  font-weight: 800;
}

@media (max-width: 820px) {
  .game-shell {
    grid-template-columns: 1fr;
  }

  .skill-tree-shell {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .skill-tree-main,
  .skill-tree-detail {
    min-height: 0;
  }

  .side-panel {
    height: auto;
    min-height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat-panel {
    margin-top: 0;
  }

  .play-area {
    min-height: calc(100vh - 360px);
    padding: 16px;
  }

  #game {
    width: min(100%, calc((100vh - 420px) * 1.6667));
    min-width: min(100%, 330px);
  }

  .hud {
    position: static;
    width: min(100%, 640px);
    margin-top: 12px;
  }

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

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

  .public-rooms-panel {
    position: relative;
    left: auto;
    top: auto;
    width: min(620px, 100%);
    margin-bottom: 14px;
  }
}

@media (max-width: 520px) {
  .side-panel {
    padding: 16px;
    gap: 14px;
  }

  .brand {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  h1 {
    font-size: 1.15rem;
  }

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

  .stat {
    min-height: 58px;
    padding: 8px;
  }

  .stat span {
    font-size: 0.64rem;
  }

  .stat strong {
    font-size: 0.82rem;
  }

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

  .class-card {
    min-height: 112px;
  }

  .start-actions,
  .join-room div {
    grid-template-columns: 1fr;
  }

  .pixel-cloud {
    display: none;
  }
}
