/* The original Underworld stone artwork ties the browser shell to the game. */
:root {
  --bg: #101216;
  --panel: #242830;
  --text: #f5ead2;
  --muted: #bdbaa9;
  --line: #626169;
  --accent: #b5ed65;
  --gold: #efbd69;
  --stone: linear-gradient(#353744b8, #141820ed), url('assets/bitmaps/data-908.png') center top / 640px 480px;
  --bevel: inset 0 2px #d4c7b155, inset 2px 0 #bcb6b333, inset 0 -3px #080a10aa, 0 3px 5px #0008;
}

body {
  background: linear-gradient(#080b10a8, #080b10e8), url('assets/bitmaps/data-908.png') center top / cover fixed;
  font-size: 14px;
}

button, input, select { min-height: 44px; }
button {
  background: var(--stone);
  border: 1px solid #79757b;
  border-radius: 4px;
  box-shadow: var(--bevel);
  color: var(--text);
  font-weight: 700;
  text-shadow: 1px 2px 1px #000;
  transition: border-color .15s, color .15s;
}
button:hover { background: var(--stone); border-color: var(--gold); color: #ffe2a0; }
button:active:not(:disabled) { box-shadow: inset 0 2px 5px #000a; }
button:disabled { opacity: .5; }

.topbar {
  max-width: 1164px;
  min-height: 112px;
  height: auto;
  padding: 20px 30px;
  margin: 20px auto 0;
  background: var(--stone);
  border: 3px ridge #87818a;
  border-radius: 8px 8px 3px 3px;
  box-shadow: var(--bevel), 0 12px 30px #0007;
}
.brand { gap: 12px; font: 900 27px Georgia, 'Times New Roman', serif; letter-spacing: 1px; color: var(--gold); text-shadow: 2px 3px #211006, 0 1px #ffe9b5; }
.brand img { width: 54px; height: 54px; filter: drop-shadow(2px 4px 1px #000); }
.brand small { font: 700 10px Georgia, serif; letter-spacing: 3px; color: #ded1ac; text-shadow: 1px 2px #000; }
nav { gap: 10px; }
.nav { min-width: 72px; border: 1px solid #79757b; color: #e0d3b9; font: 700 14px Georgia, serif; padding: 12px 18px; }
.nav.active, .filters button.active, .guide-tabs .active {
  background: var(--stone);
  color: var(--accent);
  border-color: #a8ba76;
  text-shadow: 1px 2px #000;
  box-shadow: var(--bevel), inset 0 -3px #85a44c;
}
.edition { color: #d2c5ab; line-height: 1.8; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 38px 36px;
  background: linear-gradient(#11151aef, #101418f5);
  border-left: 3px ridge #68646c;
  border-right: 3px ridge #68646c;
  box-shadow: 0 15px 50px #0008;
}
h1, .overlay-card h2, .world-info h2, .control-card h2, .port-note h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 2px 3px 1px #000;
}
h1 { letter-spacing: -.5px; }
.eyebrow { color: var(--accent); font-weight: bold; text-shadow: 1px 2px #000; }
.game-heading { margin-bottom: 22px; }
.game-tools button { font: 700 12px Georgia, serif; }
.multiplayer-bar { padding: 15px; background: var(--stone); border: 2px ridge #78737b; border-radius: 4px; gap: 12px; box-shadow: var(--bevel); }
.multiplayer-bar>div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.multiplayer-bar button { font: 700 12px Georgia, serif; }
.primary { background: linear-gradient(#759747, #33491f); color: #e7ffd0; border-color: #a7be7b; }
.primary:hover { background: linear-gradient(#87a953, #405b27); color: #fff4c5; }
.cabinet {
  border: 6px ridge #8c8790;
  border-radius: 6px;
  padding: 8px;
  background: var(--stone);
  box-shadow: 0 0 0 2px #0a0c10, 0 14px 35px #000b;
}
#loading { background: #11151b; color: var(--gold); }
.overlay { background: #0a1016ed; backdrop-filter: blur(2px); }
.overlay-card { background: var(--stone); border: 4px ridge #8c8790; padding: 24px; border-radius: 4px; box-shadow: 0 12px 35px #000b; }
.overlay-card p { color: #e0d9c9; }
.under-game { color: #ccc5b0; gap: 12px; }
.under-game button { border: 1px solid #79757b; padding: 8px 14px; }
kbd { color: #f1dfb8; background: #292d35; border-color: #8a8183; box-shadow: inset 0 1px #b4ac9255; }
.intro-strip { padding: 18px; background: var(--stone); border: 2px ridge #68646c; border-radius: 4px; }
.intro-strip strong { color: var(--gold); font-family: Georgia, serif; font-size: 16px; }
.intro-strip p { color: #d1cbbd; }
.local-badge { color: #d1cbbd; }
footer { padding: 24px 30px; background: var(--stone); border: 3px ridge #78737b; border-radius: 3px 3px 8px 8px; color: #e0d0aa; margin-bottom: 24px; }

.section-heading { padding-bottom: 24px; border-bottom: 3px ridge #68646c; }
.world-card, .extra-levels, .control-card, .online-panel, dialog {
  background: var(--stone);
  border: 3px ridge #78737b;
  border-radius: 4px;
  box-shadow: var(--bevel);
}
.world-preview { border-bottom: 3px ridge #78737b; }
.world-info h2 { font-size: 19px; }
.rounds button { font-size: 12px; }
.asset-stats { border-block: 3px ridge #68646c; }
.asset-stats strong { font-family: Georgia, serif; color: var(--gold); text-shadow: 2px 2px #000; }
.filters, .guide-tabs { gap: 8px; }
.filters button, .guide-tabs button { border: 1px solid #79757b; font-size: 12px; }
input, select { background: #12171e; border: 2px inset #79757b; border-radius: 3px; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.asset-card { background: #242830; border: 2px ridge #78737b; border-radius: 3px; }
.asset-image { background: repeating-conic-gradient(#252a32 0% 25%, #1c2027 0% 50%) 50% / 16px 16px; }
.asset-card .meta strong { color: var(--gold); }
.guide-image { border: 4px ridge #78737b; border-radius: 3px; }
.touch-controls button { background: var(--stone); font-weight: 900; }
.toast { background: #d6c391; color: #1d2114; border: 3px ridge #f0d598; border-radius: 3px; }
.cabinet:fullscreen { padding: 0; border: 0; background: #000; box-shadow: none; }

.lobby-panel {
  max-width: 850px;
  margin: -6px auto 18px;
  background: var(--stone);
  border: 2px ridge #78737b;
  border-radius: 4px;
  box-shadow: var(--bevel);
}
.host-options { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; padding: 18px; font-size: 12px; }
.host-options[hidden] { display: none; }
.host-options>label:first-child { display: grid; gap: 8px; min-width: 0; color: var(--gold); font-weight: bold; }
.host-options #room-name { min-width: 0; max-width: none; width: 100%; font: 13px Georgia, serif; padding: 10px 12px; color: var(--text); }
.listing-choice { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; color: var(--text); }
.listing-choice input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: #a7c76c; flex-shrink: 0; }
.hosted-servers { padding: 0 18px; }
.host-options:not([hidden]) + .hosted-servers { border-top: 1px solid #78737b; }
.hosted-servers summary { padding: 16px 0; color: var(--gold); font: bold 15px Georgia, serif; cursor: pointer; }
.hosted-servers summary::marker { color: var(--accent); }
.lobby-hint { margin-left: 12px; color: var(--muted); font: 12px Georgia, serif; }
.hosted-servers[open] { padding-bottom: 18px; }
.server-list-heading, .server-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.server-list-heading { margin-top: 0; padding-top: 12px; border-top: 1px solid #ffffff15; }
.server-list-heading p { margin: 0; font-size: 12px; line-height: 1.6; }
.server-list-heading button, .server-list button, .room-code-row button { flex-shrink: 0; font-size: 11px; }
.server-list { list-style: none; margin: 12px 0 0; padding: 0; }
.server-list li { padding: 14px 12px; border: 1px solid #78737b; border-radius: 3px; background: #10141999; margin-top: 8px; }
.server-list li>div { min-width: 0; overflow-wrap: anywhere; }
.server-list strong { display: block; font-size: 14px; }
.server-list span { display: block; color: var(--muted); font: 11px monospace; margin-top: 6px; }
.room-code-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0; }
.room-code-row>span { font-size: 12px; }
#room-code { color: var(--gold); font: bold 28px monospace; letter-spacing: 5px; }
#join-room-form label { display: block; margin-bottom: 12px; font-size: 13px; }
#join-code { font: bold 24px monospace; letter-spacing: 5px; text-align: center; width: 180px; max-width: 100%; }
#join-error { color: #ffd395; }

@media (max-width: 1000px) {
  .topbar { margin: 12px 18px 0; padding: 18px; gap: 16px; }
  .edition { display: none; }
  main { margin: 0 30px; padding: 28px; }
  footer { margin: 0 18px 18px; }
}
@media (max-width: 760px) {
  .host-options { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .hosted-servers { padding-inline: 14px; }
  .lobby-hint { display: none; }
  .topbar { flex-direction: column; gap: 16px; padding: 18px 12px; }
  .brand { font-size: 29px; }
  .brand img { width: 48px; height: 48px; }
  .brand small { font-size: 9px; }
  nav { width: 100%; justify-content: center; gap: 8px; }
  .nav { min-width: 0; flex: 1; font-size: 13px; padding: 10px 8px; }
  main { padding: 24px 16px; margin: 0 24px; }
  .game-heading { flex-direction: column; align-items: flex-start; gap: 16px; }
  .game-heading h1 { font-size: 29px; }
  .game-tools { width: 100%; }
  .game-tools button { flex: 1; font-size: 12px; padding: 8px; }
  .multiplayer-bar>div { grid-template-columns: repeat(2, 1fr); }
  .multiplayer-bar button { font-size: 12px; padding: 8px; }
  .cabinet { padding: 3px; border-width: 4px; }
  .overlay { inset: 3px; padding: 8px; }
  .overlay-card { padding: 12px; }
  .overlay-card h2 { font-size: 23px; }
  .overlay-card button { min-height: 36px; }
  .intro-strip { padding: 12px; }
  footer { padding: 18px 14px; gap: 14px; flex-wrap: wrap; font-size: 9px; line-height: 1.6; }
  .asset-toolbar .filters { gap: 6px; }
}
@media (max-width: 430px) {
  .topbar { margin: 8px 8px 0; }
  .brand img { display: block; }
  main { margin: 0 12px; padding: 22px 10px; }
  footer { margin: 0 8px 12px; }
  .nav { font-size: 12px; padding-inline: 5px; }
  .multiplayer-bar { padding: 10px; }
  .intro-strip p { font-size: 11px; }
  .under-game { flex-wrap: wrap; }
}
