* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #111;
  color: #ccc;
  font-family: monospace;
  overflow: hidden;
  height: 100vh;
}

/* --- Landing / title screen --- */

#landing-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 35%, #16181f 0%, #0b0c10 70%, #050506 100%);
}

#landing-screen.hidden {
  display: none;
}

/* GSP box wrapper: inline-flex so the label + input keep the topbar's 6px
   gap and centring (the topbar gap only applies to its direct children). */
.topbar-gsp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Hidden on hosted builds: the GSP endpoint is fixed and same-origin, so the
   manual GSP box is redundant (see isHostedOrigin in config.ts / main.ts). */
#gsp-connection.hidden {
  display: none;
}

.landing-inner {
  width: 100%;
  max-width: 560px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.landing-title {
  font-size: clamp(2.4rem, 9vw, 4.5rem);
  font-weight: bold;
  letter-spacing: 2px;
  color: #8ec;
  text-shadow: 0 0 18px rgba(136, 238, 204, 0.25);
  line-height: 1.05;
}

.landing-tagline {
  font-size: clamp(0.85rem, 2.6vw, 1.05rem);
  color: #99a;
  max-width: 42ch;
  line-height: 1.5;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 6px;
}

.landing-btn {
  font-family: monospace;
  font-size: 1.05rem;
  padding: 12px 34px;
  border: 1px solid #445;
  border-radius: 4px;
  background: #1c1e26;
  color: #ccc;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.landing-btn:hover {
  background: #262a34;
}

.landing-play {
  border-color: #8ec;
  color: #8ec;
  background: #16261f;
}

.landing-play:hover {
  background: #1d3a2e;
}

.landing-copyright {
  margin-top: 18px;
  font-size: 0.72rem;
  color: #667;
}

.landing-copyright a {
  color: #8899aa;
  text-decoration: none;
}

.landing-copyright a:hover {
  text-decoration: underline;
}

/* --- Top bar --- */

#topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  font-size: 12px;
  height: 36px;
}

.topbar-label {
  color: #888;
}

#topbar input {
  background: #222;
  border: 1px solid #444;
  color: #ccc;
  font-family: monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}

#gsp-url { width: 220px; }
#player-name { width: 120px; }

#connect-btn {
  background: #2a4a2a;
  color: #8c8;
  border: 1px solid #4a4;
  padding: 2px 12px;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

#connect-btn:hover { background: #3a5a3a; }

#connection-status {
  font-size: 11px;
  padding: 0 8px;
}

.status-disconnected { color: #888; }
.status-connecting { color: #aa8; }
.status-connected { color: #4a4; }
.status-error { color: #c44; }

.topbar-info {
  font-size: 11px;
  padding: 0 8px;
  color: #779;
}

.topbar-spacer { flex: 1; }

.mode-btn {
  background: #222;
  color: #888;
  border: 1px solid #444;
  padding: 2px 10px;
  font-family: monospace;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
}

.mode-btn.active {
  background: #2a2a3a;
  color: #aaf;
  border-color: #66a;
}

.mode-btn:hover:not(.active) { background: #2a2a2a; }

/* World / Dungeon switcher that floats over the map view. */
#map-tab-bar {
  background: rgba(18, 18, 26, 0.92);
  padding: 6px;
  border-radius: 9px;
  border: 1px solid #3a3a4a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
#map-tab-bar button {
  padding: 9px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
}

/* --- Main layout --- */

#app {
  display: flex;
  height: calc(100vh - 36px);
}

#game-area {
  flex: 1;
  position: relative;
  background: #000;
}

#game-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  border-left: 1px solid #333;
  overflow-y: auto;
}

.panel {
  padding: 12px;
  border-bottom: 1px solid #333;
}

.panel h3 {
  color: #daa520;
  font-size: 14px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#stats-display {
  font-size: 13px;
  line-height: 1.6;
}

#inventory-display {
  font-size: 12px;
  line-height: 1.5;
}

#message-log {
  font-size: 12px;
  line-height: 1.4;
  max-height: 200px;
  overflow-y: auto;
}

.hp-bar {
  background: #333;
  height: 16px;
  border-radius: 3px;
  margin: 4px 0;
  position: relative;
}

.hp-bar-fill {
  background: #c44;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.hp-bar-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  line-height: 16px;
  color: #fff;
}

/* --- Stat rows for overworld player info --- */

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
}

.stat-label { color: #888; }
.stat-value { color: #ccc; }

.inventory-item {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
  font-size: 12px;
}

.slot-equipped { color: #daa520; }
.slot-bag { color: #888; }

/* --- Action buttons --- */

.action-btn {
  display: inline-block;
  margin: 4px 2px 0;
  padding: 4px 10px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #555;
  font-family: monospace;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
}

.action-btn:hover:not(:disabled) { background: #3a3a3a; }
.action-btn:disabled { opacity: 0.4; cursor: default; }

.action-travel { border-color: #6a6; color: #8c8; }
.action-travel:hover:not(:disabled) { background: #2a3a2a; }

.action-enter { border-color: #66a; color: #aaf; }
.action-enter:hover:not(:disabled) { background: #2a2a3a; }

.action-discover { border-color: #a86; color: #ca8; }
.action-discover:hover:not(:disabled) { background: #3a2a1a; }

.inv-btn {
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 3px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #555;
  font-family: monospace;
  cursor: pointer;
}
.inv-btn:hover:not(:disabled) { background: #3a3a3a; }
.inv-btn:disabled { opacity: 0.4; cursor: default; }

/* --- Message colors --- */

.msg-combat { color: #f55; }
.msg-pickup { color: #5f5; }
.msg-info { color: #0ff; }
.msg-warning { color: #ff0; }

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Dialogs (#modal-root) must sit ABOVE the tabbed game modal.  They share
   .modal-overlay, so with equal z-index the later sibling won, and the game
   modal is removed and re-appended on every ~1s state poll: a dialog opened
   from inside it flashed once and was then buried by the next poll. */
#modal-root { z-index: 1100; }

.modal {
  background: #181820;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 20px 24px;
  min-width: 320px;
  max-width: 520px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  color: #ddd;
  font-family: monospace;
}

.modal-error { border-color: #c44; }
.modal-info  { border-color: #4a8; }

.modal-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 12px;
}

.modal-error .modal-title { color: #f88; }
.modal-info  .modal-title { color: #8ec; }

.modal-body {
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
  color: #ccc;
  white-space: pre-wrap;
}

.modal-actions {
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-dismiss, .modal-cancel {
  background: #333;
  color: #ddd;
  border: 1px solid #555;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: monospace;
  font-size: 12px;
}

.modal-confirm { border-color: #4a8; color: #8ec; }

.modal-dismiss:hover, .modal-cancel:hover { background: #444; }
.modal-confirm:hover { background: #2a3a3a; }
.modal-dismiss:focus, .modal-confirm:focus, .modal-cancel:focus {
  outline: 1px solid #88a;
}

/* Account picker (Play -> choose or create a character) */
.account-modal { min-width: 340px; max-width: 440px; }
.account-list {
  display: flex; flex-direction: column; gap: 8px;
  margin: 8px 0 20px; max-height: 260px; overflow-y: auto;
}
.account-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: #1c1e26; border: 1px solid #333;
  border-radius: 8px; color: #e8eae2; font: inherit; font-size: 15px;
  cursor: pointer; text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.account-item:hover { background: #232733; border-color: #4a8; }
.account-name { font-weight: 600; }
.account-go { color: #4a8; font-size: 18px; line-height: 1; }
.account-current {
  color: #8ec; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
}
.account-empty { color: #888; font-size: 14px; padding: 6px 2px 10px; }
.account-new-label {
  color: #9aa; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.account-new-row { display: flex; gap: 8px; }
#account-new-name {
  flex: 1; min-width: 0; padding: 10px 12px; background: #111;
  border: 1px solid #333; border-radius: 6px; color: #eee;
  font: inherit; font-size: 15px;
}
#account-new-name:focus { outline: none; border-color: #4a8; }
#account-create { padding: 10px 16px; white-space: nowrap; }
.account-hint { color: #666; font-size: 12px; margin-top: 8px; }
.account-foot { margin-top: 16px; }

/* --- Processing overlay --- */

.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  pointer-events: auto;
}

.processing-box {
  background: #181820;
  border: 1px solid #4a8;
  border-radius: 8px;
  padding: 20px 28px;
  min-width: 280px;
  color: #ddd;
  font-family: monospace;
  text-align: center;
}

.processing-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 14px;
  border: 3px solid #333;
  border-top-color: #8ec;
  border-radius: 50%;
  animation: processing-spin 0.9s linear infinite;
}

.processing-message {
  font-size: 13px;
  color: #ccc;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

/* --- Inventory & equipment modal --- */
.panel-btn {
  float: right;
  background: #2a2a3a;
  border: 1px solid #555;
  color: #cdd;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  cursor: pointer;
}
.panel-btn:hover { background: #3a3a4a; }

.inv-modal {
  background: #15151c;
  border: 1px solid #444;
  border-radius: 8px;
  width: min(860px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  color: #ddd;
}
.inv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
}
.inv-title { font-size: 17px; font-weight: bold; }
.inv-gold { color: gold; font-weight: bold; margin-left: auto; }
.inv-close {
  background: #2a2a2a; border: 1px solid #555; color: #ccc;
  border-radius: 4px; cursor: pointer; padding: 2px 9px; font-size: 14px;
}
.inv-close:hover { background: #a22; border-color: #c44; }
.inv-note {
  background: rgba(180,140,0,0.12); color: #d9b94a;
  font-size: 12px; padding: 6px 16px; border-bottom: 1px solid #333;
}
.inv-body {
  display: flex; gap: 16px; padding: 16px; overflow-y: auto;
}
.inv-bag { flex: 3; min-width: 0; }
.inv-equip {
  flex: 2; min-width: 0; border-left: 1px solid #333; padding-left: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.inv-col-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #888; margin-bottom: 8px;
}
.inv-row, .inv-slot {
  display: flex; align-items: center; gap: 8px;
  background: rgba(40,40,48,0.6); border: 1px solid #3a3a44;
  border-radius: 5px; padding: 7px 9px; margin-bottom: 5px;
}
.inv-slot-empty { opacity: 0.5; }
.inv-item-icon, .inv-slot-icon { font-size: 18px; width: 22px; text-align: center; }
.inv-slot-label { font-size: 11px; color: #999; width: 64px; }
.inv-item-name { font-weight: 600; }
.inv-stat { font-size: 11px; color: #6c6; margin-left: 4px; }
.inv-empty { color: #666; font-style: italic; }
.inv-row-actions { margin-left: auto; display: flex; gap: 5px; }
.inv-slot .inv-btn { margin-left: auto; }
.inv-btn.equip { background: #1f2a55; border-color: #3a4ca0; }
.inv-btn.use { background: #1f4a25; border-color: #3a8a45; }
.inv-btn.discard { background: #4a1f1f; border-color: #8a3a3a; }
.inv-btn.unequip { background: #43203a; border-color: #8a4a7a; }
.inv-pending-box {
  margin-top: 12px; padding: 10px; border: 1px dashed #5a5a3a;
  border-radius: 5px; background: rgba(90,80,30,0.1);
}
.inv-pending-title { font-size: 11px; color: #c9b24a; margin-bottom: 6px; }
.inv-pending { background: rgba(90,80,30,0.12); border-color: #5a5a3a; }
/* The footer is a real button: on a long tab the header X scrolls out of
   reach, so the bar along the bottom is the close that is always in view. */
.inv-foot {
  display: block; width: 100%; flex: 0 0 auto;
  padding: 10px 16px; border: none; border-top: 1px solid #333;
  font: inherit; font-size: 11px; color: #777; text-align: center;
  background: #1a1a1a; cursor: pointer;
  border-radius: 0 0 8px 8px;
}
.inv-foot:hover { background: #262630; color: #bbb; }
.inv-foot:focus-visible { outline: 1px solid #66a; outline-offset: -2px; }

/* --- Help overlay --- */

.help-modal {
  background: #15151c;
  border: 1px solid #444;
  border-radius: 8px;
  width: min(720px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  color: #ddd;
  font-family: monospace;
}
.help-body {
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 28px; overflow-y: auto;
}
.help-section-title {
  font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: bold; color: #8ec;
  padding-bottom: 8px; margin-bottom: 14px;
  border-bottom: 1px solid #2f4a44;
}
.help-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 7px 0; font-size: 14px; line-height: 1.5; color: #ccc;
}
.help-row .help-keys {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
}
.help-row > span:last-child {
  flex: 1 1 auto; text-align: right; color: #bcc;
}
.help-row span.help-key-text {
  color: #9aa; font-size: 12px;
}
.help-row kbd {
  display: inline-block;
  background: #2a2a3a; border: 1px solid #555; border-bottom-width: 2px;
  border-radius: 4px; color: #cdd;
  font-family: monospace; font-size: 12px; line-height: 1.5;
  padding: 2px 8px; min-width: 16px; text-align: center;
}
.help-note {
  font-size: 13px; line-height: 1.6; color: #c9b24a;
  background: rgba(180, 140, 0, 0.1);
  border: 1px dashed #5a5a3a; border-radius: 5px;
  padding: 12px 14px;
}
.help-credit {
  font-size: 11px; color: #777; text-align: center;
  margin-top: 4px; line-height: 1.5;
}
.help-credit a { color: #8ec; text-decoration: none; }
.help-credit a:hover { text-decoration: underline; }

/* --- Unified tabbed game modal --- */

.game-modal-panel {
  background: #15151c;
  border: 1px solid #444;
  border-radius: 8px;
  /* Fixed OUTER dimensions (not max-*) so every tab renders at exactly the
     same size and switching tabs never resizes or jitters the panel; the
     active tab body scrolls inside it instead. */
  width: min(980px, 96vw);
  height: min(820px, 92vh);
  display: flex;
  flex-direction: column;
  color: #ddd;
  font-family: monospace;
}

/* Tab bar: a flex row of buttons under the header. */
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  border-bottom: 1px solid #333;
}
.modal-tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: #9aa;
  font-family: monospace;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}
.modal-tab:hover { color: #cdd; background: rgba(40, 40, 48, 0.6); }
.modal-tab.active {
  color: #8ec;
  background: #15151c;
  border-color: #333;
  border-bottom: 1px solid #15151c;
  margin-bottom: -1px;
  font-weight: bold;
}

/* The active tab's body scrolls; the header and tab bar stay fixed. */
.modal-tab-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* --- Players tab --- */

.players-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.players-header {
  font-size: 14px;
  font-weight: bold;
  color: #cdd;
}
.players-subtitle {
  font-size: 11px;
  color: #777;
  margin-bottom: 10px;
}
.players-section-title {
  font-size: 11px;
  color: #8ec;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 6px;
  border-bottom: 1px solid #2f4a44;
  padding-bottom: 4px;
}
.player-badge {
  color: #2b9fd0;
  font-size: 10px;
  font-weight: normal;
}
.players-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(40, 40, 48, 0.6);
  border: 1px solid #3a3a44;
  border-radius: 5px;
  padding: 8px 10px;
}
.player-row.player-you {
  border-color: #4a8;
  background: rgba(46, 58, 58, 0.6);
}
.player-name { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.player-you-tag { color: #8ec; font-weight: bold; font-size: 11px; }
.player-level { color: #9aa; font-size: 12px; flex: 0 0 auto; }
.player-loc {
  color: #bcc; font-size: 12px; flex: 0 0 auto;
  min-width: 72px; text-align: right;
}

/* --- Gold / pending / bag-capacity labels --- */

.inv-gold-pending { color: #c9b24a; font-weight: normal; font-size: 12px; }
.inv-pending-badge {
  color: #c9b24a; font-size: 10px; margin-left: 6px;
  border: 1px dashed #5a5a3a; border-radius: 4px; padding: 0 5px;
  background: rgba(90, 80, 30, 0.12); white-space: nowrap;
}
.inv-cap { color: #9aa; }
.inv-cap-full { color: #e08a3a; font-weight: bold; }
.inv-warning {
  margin: 10px 16px 0; padding: 8px 12px;
  background: rgba(200, 80, 20, 0.12); color: #e79a5a;
  border: 1px solid #8a4a2a; border-radius: 5px;
  font-size: 12px; line-height: 1.4;
}

/* --- Character tab --- */

.char-wrap {
  padding: 18px 20px; display: flex; flex-direction: column; gap: 14px;
}
.char-header {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 1px solid #333; padding-bottom: 10px;
}
.char-name { font-size: 20px; font-weight: bold; color: #cde; }
.char-level { font-size: 14px; color: #8ec; margin-left: auto; }
.char-xp { display: flex; flex-direction: column; gap: 4px; }
.char-xp-bar {
  position: relative; height: 20px; background: #1a1a24;
  border: 1px solid #333; border-radius: 4px; overflow: hidden;
}
.char-xp-fill {
  position: absolute; inset: 0 auto 0 0; height: 100%;
  background: linear-gradient(90deg, #2b5a8a, #3a7ac0);
}
.char-xp-text {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 11px; color: #dde; text-shadow: 0 1px 2px #000;
}
.char-xp-note { font-size: 11px; color: #888; }
.char-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #8ec; border-bottom: 1px solid #2f4a44;
  padding-bottom: 5px; margin-top: 4px;
}
.char-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px;
}
.char-stat {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; background: rgba(40, 40, 48, 0.5);
  border: 1px solid #3a3a44; border-radius: 5px; padding: 6px 10px;
}
.char-stat-label { font-size: 12px; color: #99a; }
.char-stat-value { font-weight: 600; color: #cde; text-align: right; }
.char-pending { color: #c9b24a; font-weight: normal; font-size: 11px; }
.char-stat-wide { grid-column: 1 / -1; flex-wrap: wrap; }
.char-stat-note {
  flex-basis: 100%; font-size: 11px; color: #7a7a88;
  font-weight: normal; text-align: left;
}
.char-hint {
  font-size: 10px; color: #c9b24a; text-transform: none;
  letter-spacing: normal; margin-left: 6px;
}

/* Multi-choice modal (showChoiceModal): actions stack so each can carry a
   second explanatory line, e.g. the gate dialog offering a solo walk, a
   co-op host and a join. */
.modal-actions-stacked {
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 6px;
}
/* Choice buttons carried no colours at all, so they rendered as native
   light-grey buttons with black text inside a dark dialog. */
.modal-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
  background: #22222c;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-family: monospace;
  font-size: 12px;
}
.modal-choice:hover:not(:disabled) { background: #2d2d3a; border-color: #778; }
.modal-choice:focus-visible { outline: 1px solid #88a; outline-offset: 1px; }
.modal-choice:disabled {
  background: #1b1b20;
  color: #666;
  border-color: #3a3a3a;
  cursor: not-allowed;
}
.modal-choice-detail {
  font-size: 11px;
  color: #999;
  font-weight: normal;
}
.modal-choice:disabled .modal-choice-detail { color: #777; }

/* Amount prompt (duel stakes): quick picks above a real number field. */
.modal-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.modal-preset {
  background: #22222c; color: #ddd; border: 1px solid #555;
  border-radius: 4px; padding: 4px 10px; cursor: pointer;
  font-family: monospace; font-size: 12px;
}
.modal-preset:hover { background: #2d2d3a; border-color: #778; }
.modal-amount {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #bbb; margin-bottom: 8px;
}
.modal-amount-input, .modal-floor-input {
  flex: 1 1 auto; min-width: 0;
  background: #101014; color: #eee; border: 1px solid #555;
  border-radius: 4px; padding: 6px 8px;
  font-family: monospace; font-size: 13px;
}
.modal-amount-input:focus, .modal-floor-input:focus { outline: 1px solid #4a8; border-color: #4a8; }
.modal-amount-max { color: #777; font-size: 11px; white-space: nowrap; }
.modal-amount-error { color: #f88; font-size: 11px; margin-bottom: 8px; }

/* A dialog about leaving or forfeiting should not wear the "go" colour. */
.modal-warn { border-color: #c86; }
.modal-warn .modal-title { color: #e9a; }

/* Co-op tab: one panel per run you can start or join from where you stand. */
.coop-panel {
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px 10px;
  margin: 6px 0;
  background: #1a1a1a;
}
.coop-dim { font-size: 11px; color: #888; margin: 2px 0 6px; }
/* A duel offer is not a co-op offer: red, so nobody clicks one for the
   other while skim-reading the panel. */
.coop-panel-duel { border-color: #633; }
.action-duel { border-color: #a55; color: #f99; }
.action-duel:hover:not(:disabled) { background: #3a2020; }
.coop-panel .action-btn + .action-btn { margin-left: 6px; }

/* --- Duel stake dialog: gold, a grid of bag items, and the host's floor --- */

.modal-stake { max-width: 560px; }
.modal-stake .modal-body { margin-bottom: 10px; }
.stake-section-title {
  color: #9aa; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  margin: 10px 0 6px;
}
.stake-section-note { color: #666; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.modal-stake-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  max-height: 15.5em;
  overflow-y: auto;
  padding: 2px;
}
.modal-stake-row {
  --tile-accent: #556;
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 6px;
  background: #1f1f2a;
  border: 1px solid #333;
  border-top: 2px solid var(--tile-accent);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, border-color 0.1s;
}
.modal-stake-row:hover { background: #262634; border-color: #556; border-top-color: var(--tile-accent); }
.modal-stake-row.picked {
  background: #1d3330;
  border-color: #4a8;
  box-shadow: inset 0 0 0 1px #4a8;
}
.modal-stake-row.picked::after {
  content: "✓"; position: absolute; top: 3px; left: 6px;
  color: #8ec; font-size: 12px; font-weight: bold;
}
/* The checkbox stays for keyboard and accessibility; the tile is the visual. */
.modal-stake-row input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.modal-stake-row:focus-within { outline: 1px solid #88a; outline-offset: 1px; }
.stake-tile-icon { font-size: 24px; line-height: 1.2; }
.stake-tile-qty {
  position: absolute; top: 3px; right: 5px;
  font-size: 10px; color: #ccc; background: #333; border-radius: 3px; padding: 0 3px;
}
.stake-tile-name {
  font-size: 10px; color: #ccc; text-align: center; line-height: 1.2;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stake-tile-worth { font-size: 10px; color: gold; }
.stake-tile-worth::before { content: "◆ "; font-size: 8px; }
.stake-empty { color: #777; font-size: 12px; font-style: italic; margin-bottom: 6px; }
.modal-stake-total { font-weight: 600; font-size: 13px; margin: 10px 0 4px; color: #ddd; }
.modal-floor-hint { color: #888; font-size: 11px; line-height: 1.4; margin-bottom: 8px; }
.modal-confirm:disabled { opacity: 0.4; cursor: default; background: #333; }
