/* ============================================
   Online mode (P2P) screens — home, lobby, online chrome, overlays.
   Design tokens follow the approved dark theme; layered above game.css
   (loaded after it in index.html). All selectors are o- prefixed.
   ============================================ */

.o-hidden { display: none !important; }
.o-mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

/* ---------- screens ---------- */
.o-screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- shared bits ---------- */
.o-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #0b1220;
  background: var(--amber, #f59e0b);
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s;
}
.o-btn:hover { filter: brightness(1.08); }
.o-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.o-btn-ghost { background: transparent; color: var(--dim, #94a3b8); border: 1px solid var(--line, #2a3a5a); }
.o-btn-ghost:hover { color: var(--text, #e8eef7); border-color: var(--dim, #94a3b8); }
.o-btn-danger { background: transparent; color: var(--red, #ef4444); border: 1px solid #7f1d1d; }
.o-btn-sm { padding: 7px 14px; font-size: 13.5px; border-radius: 9px; }
.o-block { width: 100%; }
.o-btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.o-btn-col { display: flex; flex-direction: column; gap: 10px; }
.o-btn-col .o-btn { width: 100%; }
.o-center { text-align: center; }

.o-spinner {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  border: 2.5px solid var(--line, #2a3a5a);
  border-top-color: var(--amber, #f59e0b);
  animation: o-spin 1s linear infinite;
}
@keyframes o-spin { to { transform: rotate(360deg); } }

/* ---------- home ---------- */
.o-home { width: 100%; max-width: 480px; display: flex; flex-direction: column; align-items: center; padding-top: 4vh; }
.o-logo-row { display: flex; align-items: center; gap: 12px; }
.o-crown { width: 46px; height: 46px; color: var(--amber, #f59e0b); }
.o-logo { font-size: 2.4rem; font-weight: 700; color: var(--text, #e8eef7); margin: 0; }
.o-subtitle { color: var(--dim, #94a3b8); margin: 8px 0 28px; font-size: 15px; }
.o-mode-list { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.o-mode-card {
  width: 100%;
  text-align: left;
  background: var(--card, #1a2438);
  border: 1px solid var(--line, #2a3a5a);
  border-radius: 16px;
  padding: 16px 18px;
  color: var(--text, #e8eef7);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.o-mode-card:hover { transform: translateY(-2px); border-color: var(--amber, #f59e0b); box-shadow: 0 8px 28px rgba(245, 158, 11, 0.12); }
.o-mode-card.o-primary { border-color: #6b4d10; background: linear-gradient(145deg, #2a2110, var(--card, #1a2438)); }
.o-mode-icon {
  font-size: 28px; width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  background: var(--card2, #223050); border-radius: 12px;
}
.o-mode-text { display: flex; flex-direction: column; gap: 2px; }
.o-mode-text strong { font-size: 17px; font-weight: 600; }
.o-mode-text small { color: var(--dim, #94a3b8); font-size: 12.5px; }
.o-chev { margin-left: auto; color: var(--dim2, #64748b); font-size: 20px; }

.o-ai-sub {
  width: 100%;
  background: var(--card, #1a2438);
  border: 1px solid var(--line, #2a3a5a);
  border-radius: 16px;
  padding: 14px 18px;
  margin-top: -6px;
  display: none;
}
.o-ai-sub.o-open { display: block; }
.o-ai-sub-label { font-size: 14px; color: var(--dim, #94a3b8); margin-bottom: 10px; }
.o-pill-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.o-pill {
  border: 1px solid var(--line, #2a3a5a);
  background: var(--card2, #223050);
  color: var(--text, #e8eef7);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 14.5px;
  cursor: pointer;
  font-family: inherit;
}
.o-pill.o-selected { border-color: var(--amber, #f59e0b); background: rgba(245, 158, 11, 0.15); color: #fcd34d; }

/* ---------- lobby ---------- */
.o-lobby { width: 100%; max-width: 480px; }
.o-topbar { width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.o-back-btn {
  background: none; border: 1px solid var(--line, #2a3a5a); color: var(--dim, #94a3b8);
  border-radius: 10px; width: 38px; height: 38px; font-size: 18px; flex: none; cursor: pointer;
}
.o-back-btn:hover { color: var(--text, #e8eef7); }
.o-topbar h2 { font-size: 21px; font-weight: 600; margin: 0; color: var(--text, #e8eef7); }
.o-tabs {
  width: 100%; display: flex; gap: 5px;
  background: var(--card, #1a2438); border: 1px solid var(--line, #2a3a5a);
  border-radius: 12px; padding: 5px;
}
.o-tab {
  flex: 1; border: none; background: transparent; color: var(--dim, #94a3b8);
  font-size: 15px; font-weight: 600; padding: 10px; border-radius: 9px; cursor: pointer; font-family: inherit;
}
.o-tab.o-selected { background: var(--card2, #223050); color: var(--text, #e8eef7); }
.o-panel {
  width: 100%; margin-top: 16px;
  background: var(--card, #1a2438); border: 1px solid var(--line, #2a3a5a);
  border-radius: 16px; padding: 20px 18px;
}
.o-desc { color: var(--dim, #94a3b8); font-size: 14px; margin: 0 0 16px; }
.o-desc strong { color: var(--text, #e8eef7); }
.o-code-box {
  margin: 10px auto 4px;
  font-size: 42px; font-weight: 700; letter-spacing: 10px; text-indent: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  color: #fcd34d; text-shadow: 0 0 22px rgba(245, 158, 11, 0.25);
}
.o-link-box {
  margin: 10px auto 4px; font-size: 12px; color: var(--dim, #94a3b8); word-break: break-all;
  background: #0e1626; border: 1px solid var(--line, #2a3a5a); border-radius: 10px;
  padding: 8px 12px; font-family: ui-monospace, Menlo, monospace;
}
.o-status-line { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--dim, #94a3b8); font-size: 14.5px; }
.o-hint { color: var(--dim2, #64748b); font-size: 12.5px; margin-top: 8px; }
.o-join-input {
  width: 100%; background: #0e1626; border: 1px solid var(--line, #2a3a5a); border-radius: 12px;
  color: var(--text, #e8eef7); font-size: 16px; padding: 12px 16px; text-align: center;
  letter-spacing: 2px; font-family: inherit; outline: none; margin-bottom: 14px;
}
.o-join-input:focus { border-color: var(--amber, #f59e0b); }
.o-join-input::placeholder { color: var(--dim2, #64748b); letter-spacing: 0; }
.o-error-box {
  display: none; margin-top: 14px;
  background: rgba(239, 68, 68, 0.1); border: 1px solid #7f1d1d; color: #fca5a5;
  border-radius: 12px; padding: 12px 16px; font-size: 14px;
}
.o-error-box.o-show { display: block; }

/* ---------- online topbar (game screen) ---------- */
.o-online-topbar {
  width: 100%; max-width: 480px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.o-conn-badge {
  font-size: 13px; color: var(--green, #22c55e);
  display: flex; align-items: center; gap: 6px;
  border: 1px solid #14532d; background: rgba(34, 197, 94, 0.08);
  padding: 5px 12px; border-radius: 999px;
}
.o-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green, #22c55e); box-shadow: 0 0 8px var(--green, #22c55e); }

/* ---------- overlays ---------- */
.o-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 9, 18, 0.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
}
.o-modal {
  width: 100%; max-width: 400px;
  background: linear-gradient(160deg, var(--card, #1a2438), #131c2e);
  border: 1px solid var(--line, #2a3a5a); border-radius: 18px;
  padding: 24px 22px; text-align: center;
  animation: o-pop 0.18s ease-out;
}
@keyframes o-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.o-modal-big { font-size: 42px; margin-bottom: 6px; }
.o-modal h3 { font-size: 20px; margin: 0 0 8px; color: var(--text, #e8eef7); }
.o-modal p { color: var(--dim, #94a3b8); font-size: 14px; margin: 0 0 18px; line-height: 1.55; }

/* ---------- toast ---------- */
#o-toast {
  position: fixed; top: 18px; left: 50%;
  transform: translateX(-50%) translateY(-90px);
  z-index: 90;
  background: #052e16; border: 1px solid #14532d; color: #86efac;
  padding: 10px 22px; border-radius: 999px; font-size: 14px;
  transition: transform 0.25s; white-space: nowrap;
}
#o-toast.o-show { transform: translateX(-50%) translateY(0); }
#o-toast.o-err { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }

/* ---------- remote-turn waiting hint on the status panel ---------- */
.o-remote-waiting { color: var(--amber, #f59e0b); }
