/* ── MadXField Beginner Room Styles ─────────────────────────────────────────── */

:root {
  --bg:          #080c14;
  --bg-panel:    #131c2e;
  --bg-panel2:   #1a2540;
  --bg-darker:   #060a10;
  --border:      rgba(200,146,42,0.15);
  --border2:     rgba(200,146,42,0.22);
  --text:        #94a3b8;
  --text-bright: #e2ddd5;
  --text-dim:    #64748b;
  --gold:        #c8922a;
  --gold-dim:    rgba(200,146,42,0.45);
  --success:     #2ecc71;
  --error:       #e74c3c;
  --info:        #3498db;
  --green:       #2ecc71;
  --green-dim:   #1a6e3f;
}

/* ── Base ── */
.beginner-body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-bright);
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Login Screen ── */
#b-login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: radial-gradient(ellipse at center, #0a1a12 0%, #080c14 100%);
}

.b-login-box {
  background: var(--bg-panel);
  border: 1px solid #1e3a1e;
  border-radius: 8px;
  padding: 40px 44px;
  max-width: 520px;
  width: 100%;
  text-align: center;
}

.b-login-badge {
  display: inline-block;
  background: #1a3a1a;
  border: 1px solid #2a5a2a;
  color: var(--green);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.b-login-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.4rem;
  font-weight: bold;
  color: var(--text-bright);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.b-login-tagline {
  color: var(--green);
  font-size: 1rem;
  margin: 0 0 6px;
}

.b-login-sub {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: 0 0 24px;
}

.b-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.b-login-form input {
  padding: 12px 16px;
  background: var(--bg-darker);
  border: 1px solid var(--border2);
  border-radius: 4px;
  color: var(--text-bright);
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.b-login-form input:focus { border-color: var(--green); }

.b-btn-join {
  padding: 14px;
  background: linear-gradient(135deg, #1e5a1e, #2ecc71);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.b-btn-join:hover { opacity: 0.9; transform: translateY(-1px); }
.b-btn-join:active { transform: translateY(0); }

.b-error-msg {
  color: var(--error);
  font-size: 0.8rem;
  min-height: 1.2em;
  margin-bottom: 12px;
}

.b-login-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.b-perk {
  background: #0f1f0f;
  border: 1px solid #1e3a1e;
  color: var(--green);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 3px;
}

.b-login-instructions {
  text-align: left;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.b-login-instructions h3 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
}
.b-login-instructions ul {
  margin: 0;
  padding-left: 18px;
}
.b-login-instructions li {
  color: var(--text);
  font-size: 0.78rem;
  margin-bottom: 6px;
  line-height: 1.5;
}

.b-login-main-link {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.b-login-main-link a {
  color: var(--gold);
  text-decoration: none;
}
.b-login-main-link a:hover { color: var(--text-bright); }

/* ── Topbar ── */
#b-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 44px;
  background: var(--bg-panel);
  border-bottom: 1px solid rgba(200,146,42,0.2);
  flex-shrink: 0;
}

.b-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-bright);
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 0.2s;
}
.b-logo:hover {
  color: var(--gold);
}

.b-room-tag {
  font-size: 0.7rem;
  background: #1a3a1a;
  border: 1px solid var(--green-dim);
  color: var(--green);
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.b-topbar-link {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-decoration: none;
}
.b-topbar-link:hover { color: var(--text-bright); }

#b-topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#b-nav-user {
  color: var(--green);
  font-size: 0.78rem;
}

.b-btn-main {
  background: #1a3a1a;
  border: 1px solid var(--green-dim);
  color: var(--green);
  padding: 4px 10px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.b-btn-main:hover { background: #254a25; }

.b-btn-leave {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.b-btn-leave:hover { color: var(--text-bright); border-color: var(--text-dim); }

/* ── Status bar ── */
#b-statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text);
  flex-shrink: 0;
}
#b-statusbar span:nth-child(2), #b-statusbar span:nth-child(4) { color: var(--border2); }
#b-stat-balance { color: var(--green); font-weight: bold; }
#b-stat-moves   { color: var(--gold); }

/* ── KO banner ── */
#b-ko-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a0a0a;
  border-bottom: 1px solid #4a1a1a;
  padding: 10px 16px;
  gap: 12px;
}
.b-ko-content  { display: flex; align-items: center; gap: 12px; }
.b-ko-icon     { font-size: 1.5rem; }
.b-ko-text     { color: var(--error); font-size: 0.9rem; }
.b-ko-btn      {
  background: #2a0a0a;
  border: 1px solid var(--error);
  color: var(--error);
  padding: 6px 14px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.b-ko-btn:hover { background: #3a1010; }

/* ── Game screen ── */
#b-game-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#b-main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Grid ── */
#b-grid-wrapper {
  flex: 1;
  overflow: auto;
  background: #060a10;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#b-grid-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

#b-game-grid {
  border-collapse: collapse;
  table-layout: fixed;
}

#b-game-grid td.b-cell {
  width: 28px;
  height: 28px;
  border: 1px solid #111;
  padding: 0;
  position: relative;
  vertical-align: middle;
  text-align: center;
  overflow: visible;
  box-sizing: border-box;
}

/* Grass — green gradient */
#b-game-grid td.b-cell-grass {
  background: linear-gradient(145deg, #2d5a2d 0%, #1e3e1e 50%, #142a14 100%);
}

/* Brick — brown */
#b-game-grid td.b-cell-brick {
  background: linear-gradient(145deg, #7a4a28 0%, #5a3018 50%, #3e1e08 100%);
  border-color: #4a2a10;
}

/* My position */
#b-game-grid td.b-cell-me {
  background: linear-gradient(145deg, #1a4a1a 0%, #0d2a0d 100%);
  border-color: var(--green) !important;
  border-width: 2px !important;
  z-index: 2;
  overflow: visible;
}

/* Other player */
#b-game-grid td.b-cell-other {
  border-color: #555 !important;
}

/* Target cell (build/break) */
#b-game-grid td.b-cell-target {
  background: linear-gradient(145deg, #1a2a1a 0%, #0d1a0d 100%);
  border: 2px dashed var(--green) !important;
  cursor: pointer;
}
#b-game-grid td.b-cell-target:hover {
  background: #0f2010;
  border-color: var(--text-bright) !important;
}

.b-target-icon { font-size: 10px; }

/* Coin */
.b-coin { font-size: 12px; display: block; line-height: 28px; }

/* Player cell */
.b-player-cell {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 3;
  border: 2px solid rgba(255,255,255,0.3);
  overflow: visible;
}

.b-player-icon { font-size: 11px; line-height: 1; }

.b-player-name-tag {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: var(--text-bright);
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

/* Arrows */
.b-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--green);
  background: rgba(0,0,0,0.7);
  border-radius: 2px;
  cursor: pointer;
  z-index: 10;
  user-select: none;
  line-height: 1;
  transition: background 0.1s;
}
.b-arrow:hover { background: rgba(46,204,113,0.3); }

.b-arrow-up    { top: -16px;  left: 50%; transform: translateX(-50%); }
.b-arrow-down  { bottom: -16px; left: 50%; transform: translateX(-50%); }
.b-arrow-left  { left: -16px; top: 50%;  transform: translateY(-50%); }
.b-arrow-right { right: -16px; top: 50%; transform: translateY(-50%); }

/* Find Me button */
#b-find-me-btn {
  display: none;
  margin: 8px auto;
  padding: 8px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  width: calc(100% - 24px);
}

/* ── Sidebar ── */
#b-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

/* Panel */
.b-panel { border-bottom: 1px solid var(--border); }

.b-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  cursor: pointer;
  user-select: none;
  background: var(--bg-panel);
}
.b-panel-header:hover { background: var(--bg-panel2); }
.b-panel-arrow { color: var(--text-dim); font-size: 0.65rem; }

.b-panel-body { background: var(--bg-darker); padding: 8px 0; }

/* Pending hint */
.b-pending-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f2010;
  border: 1px solid var(--green-dim);
  border-radius: 3px;
  margin: 4px 10px 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--green);
  gap: 8px;
}
.b-pending-hint button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0;
  white-space: nowrap;
}
.b-pending-hint button:hover { color: var(--error); }

/* Action buttons */
.b-action-list { display: flex; flex-direction: column; }

.b-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.b-action-btn:hover { background: var(--bg-panel2); color: var(--text-bright); }
.b-action-btn:last-child { border-bottom: none; }

.b-action-icon { font-size: 0.95rem; width: 20px; text-align: center; flex-shrink: 0; }
.b-action-name { flex: 1; }
.b-action-cost { color: var(--green); font-size: 0.72rem; white-space: nowrap; }

/* Leaderboard */
.b-leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.b-leaderboard th {
  padding: 5px 10px;
  color: var(--text-dim);
  font-weight: normal;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}
.b-leaderboard td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.b-lb-me td { color: var(--green) !important; background: #0a1a0a; }
.b-lb-ko td { color: var(--text-dim); opacity: 0.6; }
.b-lb-divider td {
  padding: 4px 10px;
  font-size: 0.68rem;
  color: var(--text-dim);
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
}

/* Reports */
.b-reports {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}
.b-report-line {
  padding: 4px 12px;
  font-size: 0.73rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.b-report-line:hover { background: var(--bg-panel); }
.b-report-time { color: var(--text-dim); font-size: 0.67rem; margin-right: 5px; }
.b-report-empty { padding: 12px; color: var(--text-dim); font-size: 0.75rem; text-align: center; }

/* ── Toast ── */
#b-toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 9999;
  pointer-events: none;
}

.b-toast {
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: 'Courier New', monospace;
  border: 1px solid var(--border2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 360px;
  text-align: center;
}
.b-toast-show { opacity: 1; transform: translateY(0); }
.b-toast-success { background: #0a1e0a; border-color: #1e4a1e; color: var(--green); }
.b-toast-error   { background: #1e0a0a; border-color: #4a1e1e; color: var(--error); }
.b-toast-info    { background: var(--bg-panel); border-color: var(--border2); color: var(--text-bright); }

/* ── Mobile ── */
@media (max-width: 700px) {
  #b-main-layout { flex-direction: column; }
  #b-sidebar { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); }
  #b-grid-wrapper { flex: none; height: 340px; }
  #b-find-me-btn { display: block; }
  .b-login-box { padding: 28px 20px; }
}
