:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --panel: #161b22;
  --panel2: #1f2630;
  --text: #e6edf3;
  --muted: #8b96a3;
  --line: #2a313c;
  --accent: #66c0f4;
  --danger: #ff5d5d;
  --ok: #5ade7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }

.mp-shell { max-width: 880px; margin: 0 auto; padding: 16px 16px 48px; }
.mp-topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.mp-topbar a { color: var(--muted); text-decoration: none; font-size: 14px; }
.mp-topbar a:hover { color: var(--text); }
.mp-title { font-size: 20px; font-weight: 600; color: var(--text); }

.mp-lobby { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; max-width: 440px; margin: 32px auto; }
.mp-h { margin: 0 0 16px; font-size: 18px; color: var(--text); }
.mp-nick { display: block; width: 100%; padding: 10px 12px; margin-bottom: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 15px; }
.mp-code-row { display: flex; gap: 8px; margin-bottom: 16px; }
.mp-code-input { flex: 1; padding: 10px 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 18px; font-family: ui-monospace, monospace; letter-spacing: 4px; text-align: center; }
.mp-or { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0; }
.mp-btn { display: inline-block; padding: 10px 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 15px; cursor: pointer; font: inherit; }
.mp-btn:hover { background: #283040; }
.mp-btn:active { transform: translateY(1px); }
.mp-btn-primary { background: var(--accent); color: #0c0f14; border-color: var(--accent); font-weight: 600; width: 100%; }
.mp-btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.mp-btn-sm { padding: 6px 10px; font-size: 13px; }
.mp-status { min-height: 20px; margin-top: 12px; font-size: 14px; color: var(--muted); text-align: center; }

.mp-code-box { text-align: center; padding: 12px 0; }
.mp-code-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.mp-code-big { font-size: 48px; font-weight: 700; letter-spacing: 8px; color: var(--accent); font-family: ui-monospace, monospace; margin: 4px 0 12px; }
.mp-code-hint { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.mp-code-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.mp-waiting { color: var(--muted); font-size: 14px; }
.mp-waiting::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--accent); animation: mp-pulse 1.2s infinite; vertical-align: middle; }
@keyframes mp-pulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

.mp-game-area { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 auto; max-width: 720px; }
.mp-bar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mp-player { display: flex; align-items: center; gap: 8px; }
.mp-player .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.mp-player.on .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.mp-end { text-align: center; padding: 24px; }
.mp-end h3 { margin: 0 0 8px; color: var(--accent); }
.mp-end .reason { color: var(--muted); margin-bottom: 16px; font-size: 14px; }
.mp-end .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.mp-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); padding: 8px 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; opacity: 0; transition: opacity 200ms, transform 200ms; z-index: 100; font-size: 14px; pointer-events: none; }
.mp-toast.in { opacity: 1; transform: translateX(-50%) translateY(0); }
.mp-toast.error { border-color: var(--danger); color: var(--danger); }
.mp-toast.ok { border-color: var(--ok); color: var(--ok); }

.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.hub-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-decoration: none; color: inherit; transition: transform 120ms, border-color 120ms; display: block; }
.hub-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.hub-card .name { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.hub-card .hook { color: var(--muted); font-size: 13px; min-height: 38px; }
.hub-card .badge { display: inline-block; margin-top: 8px; padding: 2px 6px; background: var(--accent); color: #0c0f14; font-size: 11px; border-radius: 4px; font-weight: 600; }

@media (max-width: 480px) {
  .mp-code-big { font-size: 36px; letter-spacing: 6px; }
  .mp-lobby { padding: 16px; }
}
