
  :root{
    --bg: #0a1522;
    --panel: #0f1e30;
    --grid-line: #1c3550;
    --water: #0d2540;
    --water-hover: #143355;
    --neon-light: #d9455f;
    --accent: #4fd6c4;
    --text: #eaf2f8;
    --text-dim: #7d97ad;
    --danger: #e05a4e;
    --font-display: 'Courier New', ui-monospace, monospace;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  }
  *{ box-sizing:border-box; }
  body{
    margin:0;
    min-height:100vh;
    background: var(--bg) url(img/lobby-bg.webp) center center / cover no-repeat fixed;
    color:var(--text);
    font-family:var(--font-body);
    padding:0 0 60px;
  }
  h2{
    font-family:var(--font-display);
    font-size:15px;
    letter-spacing:1.5px;
    color:var(--text-dim);
    text-transform:uppercase;
    margin:0 0 14px;
  }
  .hidden{ display:none !important; }

  input[type="text"]{
    display:block;
    width:100%;
    max-width:320px;
    margin:0 auto;
    background:var(--water);
    border:1px solid var(--grid-line);
    border-radius:8px;
    color:var(--text);
    font-family:var(--font-display);
    font-size:16px;
    padding:10px 14px;
    text-align:center;
  }
  input[type="text"]:focus{ outline:1px solid #ff4d6d; }

  select{
    background:var(--water);
    border:1px solid var(--grid-line);
    border-radius:8px;
    color:var(--text);
    font-family:var(--font-display);
    font-size:14px;
    padding:8px 12px;
  }

  button{
    font-family:var(--font-display);
    font-weight:bold;
    letter-spacing:0.5px;
    padding:9px 20px;
    border-radius:8px;
    cursor:pointer;
    border:1px solid var(--grid-line);
    background:var(--panel);
    color:var(--text);
  }
  button.primary{
    background:var(--accent);
    color:#04211d;
    border-color:var(--accent);
  }
  button.ghost{
    background:transparent;
  }
  button.danger{
    background:var(--danger);
    color:#fff;
    border-color:var(--danger);
  }
  button:disabled{
    opacity:0.4;
    cursor:not-allowed;
  }

  .btn-row{
    display:flex;
    gap:10px;
    justify-content:center;
    flex-wrap:wrap;
  }

  .error{
    color:var(--danger);
    font-size:13px;
    text-align:center;
    min-height:18px;
    margin-top:8px;
  }


  #lobby-main{
    max-width:760px;
    margin:0 auto;
    padding:0 16px;
    display:flex;
    flex-direction:column;
    gap:22px;
  }

  .lobby-card{
    background:var(--panel);
    border:1px solid var(--grid-line);
    border-radius:12px;
    padding:20px;
  }

  #create-form-row, #vs-computer-row{
    display:flex;
    gap:12px;
    align-items:center;
    justify-content:center;
    flex-wrap:wrap;
  }

  #vs-computer-diff-row{
    display:flex;
    gap:10px;
    justify-content:center;
    flex-wrap:wrap;
    margin-top:12px;
  }

  #games-list{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:10px;
  }
  #games-list li{
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:var(--water);
    border:1px solid var(--grid-line);
    border-radius:8px;
    padding:10px 14px;
    gap:12px;
  }
  #games-list .game-label{
    font-size:14px;
  }
  #games-list .game-label .sub{
    display:block;
    color:var(--text-dim);
    font-size:12px;
    margin-top:2px;
  }
  #games-empty{
    text-align:center;
    color:var(--text-dim);
    font-size:13px;
    padding:8px 0;
  }

  #waiting-room{
    text-align:center;
  }
  #waiting-room .players-row{
    display:flex;
    justify-content:center;
    gap:24px;
    margin:14px 0;
    font-family:var(--font-display);
    font-size:16px;
  }
  #waiting-room .players-row .vs{ color:var(--text-dim); }
  #waiting-room .board-size-note{
    color:var(--text-dim);
    font-size:13px;
    margin-bottom:10px;
  }
  #waiting-room .countdown{
    font-family:var(--font-display);
    font-size:15px;
    color:var(--accent);
    margin:16px 0;
  }
  #waiting-room .countdown .num{
    font-size:28px;
    display:block;
  }
  #opponent-left-msg{
    color:var(--danger);
    font-family:var(--font-display);
    font-size:14px;
    margin-bottom:14px;
  }

  .spinner{
    width:26px; height:26px;
    border:3px solid var(--grid-line);
    border-top-color:var(--accent);
    border-radius:50%;
    margin:0 auto 14px;
    animation:spin 0.9s linear infinite;
  }
  @keyframes spin{ to{ transform:rotate(360deg); } }

/* The five board buttons of "Create New Game" (the same look as the home page's bar: six pixels apart, the picked one deeper red with a white LED) */
.board-pick{ display:flex; gap:6px; height:2.25cm; margin:0 0 14px; }
.board-pick button{
  flex:1 1 0; min-width:0; height:100%; padding:0; margin:0; border-radius:8px; letter-spacing:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center; font-weight:bold;
}
.board-pick button:hover{ filter:brightness(1.12); }
.board-pick button.active{ background:linear-gradient(180deg,#5a2630,#2a1218 60%,#3a1a22); color:#fff; border-color:#ff4d6d; box-shadow:0 0 14px rgba(255,77,109,0.7), inset 0 0 10px rgba(255,90,120,0.2); z-index:1; }
.board-pick button.active::after{ background:#fff; box-shadow:0 0 10px 3px #ff4d6d; }
.board-pick .sz-top, .board-pick .sz-bot{ display:flex; align-items:center; justify-content:center; width:100%; }
.board-pick .sz-top{ height:0.9cm; font-size:21px; }
.board-pick .sz-bot{ height:1.35cm; font-size:13px; line-height:1.25; text-align:center; flex-direction:column; font-family:var(--font-body); }

/* ===== One header bar, one title and one button size for every page (the same text is in lobby.css and game.css) ===== */
html{ overflow-y:scroll; }   /* the scrollbar space is always reserved, so a page with a scrollbar and one without centre their content identically */
button{
  font-family:var(--font-display); font-size:13.3333px; font-weight:bold; letter-spacing:0.5px;
  padding:9px 20px; border-radius:8px; cursor:pointer;
}
button:disabled{ opacity:0.4; cursor:not-allowed; }
#top-banner{
  display:grid; grid-template-columns:1fr auto 1fr; align-items:center;
  max-width:760px; margin:0 auto 10px; padding:10px 20px;
  background:var(--panel); border-bottom:1px solid var(--grid-line);
}
#top-banner .player-tag{
  font-family:var(--font-body); font-size:17px; letter-spacing:0.3px; color:#ffe6ec;
  text-shadow:0 0 10px #ff4d6d, 0 0 3px rgba(255,255,255,0.7);
}
#top-banner .player-tag b{ color:#ff4d6d; filter:brightness(0.7); text-shadow:0 0 10px rgba(255,77,109,0.9), 0 0 3px rgba(255,77,109,0.8); }
#top-banner #rules-btn{ justify-self:end; }
h1{
  text-align:center; font-family:var(--font-display); letter-spacing:0; word-spacing:-0.4em;
  font-size:32px; margin:10px 0 10px; text-transform:uppercase;
}

/* ===== Chrome + red LED buttons (approved look; the same block is in lobby.css and game.css) ===== */
button, button.primary, button.ghost, button.danger,
.size-btn, .opponent-btn, .diff-btn, .dice-roll-btn,
.dice-btn-row button, .dice-btn-row button.primary, .dice-btn-row button.ghost{
  position:relative;
  background:repeating-linear-gradient(90deg,rgba(255,255,255,0.03) 0 2px,rgba(0,0,0,0.05) 2px 4px), linear-gradient(180deg,#3a4048,#14181d 55%,#1d2228);
  color:#ffe6ec;
  border:1px solid rgba(255,77,109,0.6);
  box-shadow:0 0 8px rgba(255,60,100,0.3), 0 4px 8px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.25), inset 0 0 8px rgba(255,60,100,0.10);
  text-shadow:0 0 8px #ff4d6d;
}
button::after, .size-btn::after, .opponent-btn::after, .diff-btn::after, .dice-roll-btn::after{
  content:''; position:absolute; left:14%; right:14%; bottom:3px; height:3px; border-radius:2px;
  background:#ff4d6d; box-shadow:0 0 8px 1px #ff4d6d; pointer-events:none;
}
button:hover, .size-btn:hover, .opponent-btn:hover, .diff-btn:hover, .dice-roll-btn:hover{
  background:repeating-linear-gradient(90deg,rgba(255,255,255,0.03) 0 2px,rgba(0,0,0,0.05) 2px 4px), linear-gradient(180deg,#464d57,#1b2026 55%,#252b33);
  border-color:#ff4d6d; filter:none;
}
button.primary, button.primary:hover, .dice-btn-row button.primary, .diff-btn.selected, .dice-roll-btn{
  background:linear-gradient(180deg,#5a2630,#2a1218 60%,#3a1a22); border-color:#ff4d6d; color:#fff;
}
button.primary::after, .diff-btn.selected::after, .dice-roll-btn::after{ background:#fff; box-shadow:0 0 10px 3px #ff4d6d; }
button.ghost, .dice-btn-row button.ghost{ color:#ffe6ec; }
/* the tiny flip button in the tally panel: red glow, no LED strip (too small) */
.tally-flip-btn::after{ display:none; }
.tally-flip-btn, .tally-flip-btn:hover{ border-color:#ff4d6d; color:#ffe6ec; }

/* ===== Page title "WAR OF THE ARMADAS" and the welcome tag: same neon look as the home page (sizes stay as each page had them) ===== */
h1{ color:#ffe6ec; text-shadow:0 0 10px #ff4d6d, 0 0 3px rgba(255,255,255,0.7); }
h1 span{ display:inline-block; padding:0 0.12em 0 0.1em; border:2px solid #ff4d6d; border-radius:6px; color:#ff4d6d; filter:brightness(0.7);
  text-shadow:0 0 12px rgba(255,77,109,0.9), 0 0 4px rgba(255,77,109,0.8);
  box-shadow:0 0 16px rgba(255,77,109,0.7), 0 0 5px rgba(255,77,109,0.8), inset 0 0 12px rgba(255,77,109,0.35); margin-left:0.08em; }
h1 i{ font-style:normal; margin:0 -0.14em 0 -0.14em; }   /* the dot of .IO sits close to the S and the I, as on the home page */

/* ===== Invitations ("Create and WAIT" / "Create and INVITE" and the link box in the waiting room) ===== */
/* the second word of each button sits on its own row */
button.two-row{ line-height:1.25; padding:8px 22px; text-align:center; }
/* the link to send, with its Copy button */
#invite-box{ margin:14px 0 4px; }
#invite-box .invite-note{ font-size:14px; margin-bottom:8px; }
#invite-box .invite-row{ display:flex; gap:8px; justify-content:center; align-items:stretch; max-width:660px; margin:0 auto; }
#invite-box #invite-link{ flex:1 1 auto; min-width:0; width:auto; max-width:none; margin:0; text-align:left; padding:8px 10px; font-size:13px; background:rgba(6,14,24,0.92); }
#invite-box .invite-copied{ min-height:18px; font-size:13px; margin-top:6px; opacity:0.85; }

/* ===== Phones (narrow screens only; desktop and laptop screens never see any of this) ===== */
#lobby-art{ display:none; }
@media (max-width: 640px){
  /* the middle of the lobby picture (no penguins), mirrored top to bottom so it repeats without a seam */
  body{ background:#0a1522 url(img/lobby-bg-phone.webp) top center / 100% auto repeat-y; padding:0 10px 14px;
        display:flex; flex-direction:column; min-height:100vh; min-height:100dvh; }
  #top-banner{ margin:0 -10px 10px; }   /* the header spans the full screen width exactly like the game page (this page's body has 10px side padding on phones) */
  h1{ font-size:6vw; margin:8px 0; }
  #lobby-main{ width:100%; max-width:none; padding:0; }
  .lobby-card{ padding:14px; background:rgba(15,30,48,0.82); }
  .board-pick .sz-bot{ font-size:12px; }
  #games-list .game-label{ font-size:13px; }
  /* the invitation link gets the full width (Copy button underneath) so the whole link is visible */
  #invite-box .invite-row{ flex-direction:column; align-items:stretch; gap:8px; }
  #invite-box #invite-link{ font-size:12px; text-align:center; padding:8px 4px; }
  #invite-box #invite-copy-btn{ align-self:center; }
  #lobby-art{ display:block; margin-top:auto; padding-top:18px; pointer-events:none; }
  /* the height comes from padding (320 / 393 = 81.4% of the width) instead of the newer aspect-ratio property, which older tablet browsers do not know */
  #lobby-art .stage{ position:relative; width:100%; height:0; padding-bottom:81.4%; }
  #lobby-art .lab{ position:absolute; width:31%; height:auto; }
  #lobby-art .pens{ position:absolute; left:0; right:0; bottom:0; display:flex; justify-content:center; align-items:flex-end; }
  #lobby-art .pens img{ width:34%; height:auto; margin:0 -1%; }
}

/* Waiting games in the lobby list: slimmer rows and a smaller Join button (desktop and phone) */
#games-list{ gap:6px; }
#games-list li{ padding:5px 12px; gap:10px; }
#games-list li button{ padding:4px 14px; font-size:12px; }

/* small screens: same header as the game page - "Player AIO-XXXXX" may wrap onto two rows but never gets taller than the HOME / RULES buttons beside it */
@media (max-width:600px){
  #top-banner .player-tag{ font-size:13px; line-height:1.1; }
}
