html, body {
  height: 100%;
  margin: 0;
  background: #111;
  color: #eee;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}

/* Layout wrapper: vertical stack, content near top, centered horizontally */
#wrap {
  display: flex;
  flex-direction: column;
  align-items: center;      /* centre the main game area */
  justify-content: flex-start;
  min-height: 100%;
  padding: 8px;
  box-sizing: border-box;
}

/* Legacy plain-screen style (used for create/dead modes) */
pre#screen {
  margin: 0;
  line-height: 1.05;
  font-size: 16px;
  white-space: pre;
  background: #000;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  overflow: auto;
  max-width: 100%;
  max-height: 90vh;
}

/* Container inside #screen when in play mode:
   <div class="play-wrap"><div class="hud">…</div><pre class="map">…</pre></div> */
.play-wrap {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  justify-content: center;   /* centres the map+hud block on the page */
  margin-top: 8px;
}

/* HUD panel (stats etc) on the left */
.hud {
  flex: 0 0 auto;
  padding: 10px 12px;
  background: #000;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  white-space: pre;
  font-size: 14px;
  line-height: 1.1;
  max-height: 90vh;
  overflow: auto;
  min-width: 220px;
}

/* Map panel to the right of HUD.
   The viewport is server-sized (frame.map is exactly viewport.w × viewport.h)
   and the inline `width: <w>ch` style from render.js sizes this box to match.
   `overflow: hidden` is load-bearing: any DOM-scroll lets the player drag the
   viewport off `@`, then a keypress redraws back to centre and the scrollbar
   makes `@` look lost (a real bug — see prompts/viewport-and-footer-fixes.md).
   Never let scrollbars appear on this element. */
pre.map {
  flex: 0 1 auto;
  margin: 0;
  line-height: 1.05;
  font-size: 16px;
  white-space: pre;
  background: #000;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  overflow: hidden;
  max-width: 100%;
  max-height: 90vh;
}

.status {
  margin-top: 10px;
  text-align: center;
  opacity: 0.85;
}

/* Modal styling */
.modal-backdrop {
  position: fixed; inset: 0;
  display: none;
  place-items: center;
  background: rgba(0,0,0,0.6);
}
.modal-card {
  background: #1b1b1b; padding: 16px; border-radius: 12px;
  width: min(520px, 92vw); box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-card h2 { margin: 0 0 8px 0; font-size: 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab { padding: 8px 12px; border-radius: 8px; background: #222; cursor: pointer; }
.tab.active { background: #2d6cdf; }
.row { display: flex; gap: 8px; margin-top: 6px; }
input[type="text"], input[type="password"] {
  flex: 1; padding: 10px; background: #0c0c0c; color: #eee; border: 1px solid #333; border-radius: 8px;
}
button {
  padding: 10px 14px; background: #2d6cdf; color: white; border: none; border-radius: 8px; cursor: pointer;
}
button:hover { filter: brightness(1.05); }
.error { color: #f66; margin-top: 8px; min-height: 1.2em; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pill { padding: 6px 10px; background: #222; border: 1px solid #333; border-radius: 999px; cursor: pointer; }
.pill:hover { background: #2a2a2a; }
.show { display: grid !important; }

.controls {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.controls button {
  padding: 8px 12px;
  background: #444;
  color: #eee;
  border: 1px solid #666;
  border-radius: 8px;
  cursor: pointer;
}
.controls button:hover { filter: brightness(1.08); }

/* Attribution footer — small, low-contrast, always at the bottom of
   the page. The names inside are load-bearing for open-source compact. */
.page-credit {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  opacity: 0.55;
  color: #ccc;
}

#chat {
  margin-top: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chat-log {
  width: 960px;
  max-width: 100%;
  height: 140px;          /* fixed size */
  overflow-y: auto;
  scrollbar-gutter: stable;   /* the bar's room is always kept, so the text does not reflow when it comes (#294) */
  padding: 6px 8px;
  background: #000;
  border-radius: 8px;
  border: 1px solid #333;
  font-size: 12px;
  line-height: 1.25;
  white-space: pre-wrap;
}

/* Interactive panel sits directly ABOVE the scrolling chat-log so a
   shop dialog or y/n prompt lands right under the map+HUD where the
   player's attention is. Empty when panel.mode === "log". See
   prompts/interactive-log-panel.md and
   prompts/shop-dialog-not-rendering.md. */
.chat-panel {
  width: 960px;
  max-width: 100%;
  /* No min-height — when empty the box collapses so it doesn't push
     the chat-log down. */
}

.panel-prompt {
  background: #1f2a3a;
  border: 2px solid #4d6da6;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 500;
  color: #cce6ff;
  box-shadow: 0 0 12px rgba(77, 109, 166, 0.4);
}

/* Shop dialog: bigger, brighter, and explicitly prominent — this is
   the active UI, not a passive log line. */
.panel-dialog {
  margin: 0;
  padding: 10px 14px;
  background: #0e0a05;
  border: 2px solid #c08040;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.3;
  color: #eee;
  white-space: pre;
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
  box-shadow: 0 0 12px rgba(192, 128, 64, 0.4);
}

.panel-dialog-title {
  color: #ffd166;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 2px;
}

.panel-dialog-subtitle {
  color: #cca972;
  margin-bottom: 8px;
}

.panel-dialog-commands {
  margin-top: 8px;
  color: #8ab4f8;
  font-weight: 500;
}

.dialog-item {
  color: #ddd;
}

/* Provider buttons */
.auth-providers {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.provider-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;

  width: 260px;
  padding: 10px 14px;

  background: #f5f5f5;
  color: #222;
  border-radius: 999px;
  border: 1px solid #444;

  cursor: pointer;
  font-size: 14px;
  font-weight: 500;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

.provider-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.65);
}

.provider-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.provider-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.provider-icon svg {
  width: 100%;
  height: 100%;
}

.provider-text {
  flex: 1;
  text-align: left;
}
