:root {
  --pink: #ffd5ff;
  --pink-line: rgba(255, 255, 255, 0.6);
  --pink-accent: #ff99ff;
  --blue: #1c5ce5;
  --ink: #2d2d2d;
  --text: #1a1a2e;
  --felt: #0b6b34;
  --ok: #0a8a37;
  --bad: #d1263c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background-color: var(--pink);
  background-image:
    linear-gradient(var(--pink-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--pink-line) 1px, transparent 1px);
  background-size: 40px 40px;
  padding: 36px 0 96px;
}

/* decorative suit doodles */
.decor span {
  position: fixed;
  font-size: 3.4rem;
  color: rgba(28, 92, 229, 0.14);
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
.decor span:nth-child(odd) { color: rgba(255, 90, 140, 0.18); }

/* ---- system bar ---- */
.system-bar {
  position: fixed;
  top: 0; left: 0; width: 100%;
  height: 36px;
  background: var(--pink);
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-weight: 700;
  z-index: 1000;
}
.system-bar-title { font-size: 1.1rem; color: #1a1a1a; letter-spacing: -0.5px; }
.system-bar-right { font-size: 0.85rem; color: var(--ink); font-weight: 500; }
.system-bar-right .sep { margin: 0 8px; }

/* ---- windows ---- */
.windows-container { position: relative; z-index: 1; display: flex; justify-content: center; padding: 40px 20px 130px; }
.room.hidden { display: none; }
.retro-window {
  position: relative;
  width: min(88vw, 820px);
  background: #fff;
  border: 16px solid var(--blue);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  animation: pop 0.16s ease-out;
}
.w-lobby { border-width: 24px; width: min(88vw, 780px); }
@keyframes pop { from { transform: scale(0.985); opacity: 0; } }
.window-header {
  position: absolute;
  top: -16px; left: 0; width: 100%; height: 16px;
  display: flex; align-items: center; gap: 6px; padding-left: 8px;
}
.w-lobby .window-header { top: -24px; height: 24px; }
.wb { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.3); }
.wb.c { background: #ff5f56; }
.wb.m { background: #ffbd2e; }
.wb.x { background: #27c93f; }
.window-content { padding: 34px 44px 40px; color: var(--text); }
.window-content.center { text-align: center; }

/* ---- lobby typography ---- */
.headline {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--blue);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: -1px;
}
.subheadline { font-size: 1.25rem; font-style: italic; font-weight: 700; margin: 0 0 20px; }
.cursive { font-family: "Brush Script MT", cursive; font-style: normal; }
.mission { font-size: 1.05rem; line-height: 1.6; color: #333; margin: 0 0 22px; }
.mission.left { text-align: left; }
.divider { display: flex; align-items: center; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-bottom: 1px solid var(--pink); }
.divider span { padding: 0 16px; color: var(--pink-accent); font-size: 1.2rem; }
.eyebrow { font-weight: 700; letter-spacing: 1px; font-size: 0.8rem; text-transform: uppercase; color: var(--blue); margin: 0 0 12px; }

/* ---- challenges list ---- */
.challenges { list-style: none; margin: 0 0 24px; padding: 0; text-align: left; }
.challenges li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  border: 2px solid var(--text); border-radius: 8px;
  background: #fff; cursor: pointer;
  transition: transform 0.08s, background 0.08s;
}
.challenges li:hover { transform: translateX(3px); background: #fff0ff; }
.challenges .num { font-weight: 800; color: var(--blue); font-size: 1.1rem; }
.challenges .ch-name { flex: 1; font-weight: 500; }
.challenges .ch-sev { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px; color: #666; border: 1px solid #ccc; border-radius: 20px; padding: 2px 8px; }
.challenges .ch-sev.crit { color: var(--bad); border-color: var(--bad); }

/* ---- wallet strip ---- */
.wallet { display: flex; gap: 18px; align-items: center; justify-content: center; font-size: 0.95rem; flex-wrap: wrap; }
.wallet .chips { color: var(--ok); }
.wallet .chips::before { content: "$"; }

/* ---- game windows ---- */
.win-title { font-size: 1.6rem; font-weight: 800; color: var(--blue); margin: 0 0 10px; letter-spacing: -0.5px; }
.controls, .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.btn {
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  background: var(--blue); color: #fff;
  border: 2px solid var(--text); border-radius: 8px;
  padding: 9px 16px; cursor: pointer;
  transition: transform 0.06s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.go { background: #ff4fb0; }
.btn.ghost { background: #fff; color: var(--blue); }
input {
  font-family: inherit; font-size: 0.95rem;
  border: 2px solid var(--text); border-radius: 8px;
  padding: 9px 11px; background: #fff; min-width: 130px;
}
.flag-input { flex: 1; min-width: 220px; }
code { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 4px; padding: 1px 6px; font-size: 0.85em; }
.tag { font-size: 0.8rem; font-weight: 700; color: #666; border: 1px dashed #999; border-radius: 20px; padding: 3px 10px; }
.muted { opacity: 0.5; }

/* ---- felt ---- */
.felt {
  background: repeating-linear-gradient(45deg, #0b6b34, #0b6b34 14px, #0a5f2e 14px, #0a5f2e 28px);
  border: 2px solid var(--text); border-radius: 10px;
  padding: 16px; color: #eafff0; margin-bottom: 14px;
  box-shadow: inset 0 0 22px rgba(0,0,0,.4);
}
.felt-label { font-size: 0.72rem; letter-spacing: 0.5px; opacity: 0.85; text-transform: uppercase; margin: 6px 0 4px; }
.hand { display: flex; flex-wrap: wrap; min-height: 78px; align-items: flex-start; }
.hand .muted { align-self: center; }

/* ---- flip cards ---- */
.card { display: inline-block; width: 52px; height: 72px; margin: 4px 4px 0 0; perspective: 600px; vertical-align: top; }
.card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.5s; transform-style: preserve-3d; }
.card.up .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0; border: 2px solid var(--text); border-radius: 6px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; box-shadow: 2px 2px 0 rgba(0,0,0,.3);
}
.card-back { background: repeating-linear-gradient(45deg, #1c5ce5, #1c5ce5 6px, #4f80f2 6px, #4f80f2 12px); }
.card-front { background: #fff; color: #1a1a2e; transform: rotateY(180deg); }
.card-front.red { color: #d1263c; }
@keyframes dealin { from { transform: translate(-70px, -90px) rotate(-18deg); opacity: 0; } to { transform: none; opacity: 1; } }
.card.dealt { animation: dealin 0.34s ease-out; }

/* ---- poker seats ---- */
.seats { display: flex; flex-wrap: wrap; gap: 10px; }
.seat { background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 8px 10px; }
.seat.you { outline: 2px solid #ffe08a; }
.seat .name { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.9; margin-bottom: 2px; }

/* ---- win/lose banner ---- */
.banner { font-weight: 800; font-size: 1.3rem; margin-top: 12px; min-height: 1.4em; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.4); }
.banner.inline { color: var(--text); text-shadow: none; margin: 0 0 14px; }
.banner.win { color: #7dffa0; } .banner.inline.win { color: var(--ok); }
.banner.lose { color: #ff9db0; } .banner.inline.lose { color: var(--bad); }
.banner.push { color: #ffe08a; }
.banner.show { animation: poptext 0.4s ease-out; }
@keyframes poptext { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- status pill ---- */
.status { font-weight: 700; font-size: 0.9rem; color: var(--text); background: #fff6cf; border: 2px solid var(--text); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; display: none; }
.status.on { display: inline-block; }

/* ---- roulette wheel ---- */
.roulette-felt { text-align: center; }
.wheel-wrap { position: relative; width: 190px; height: 190px; margin: 6px auto 2px; }
.wheel-disc {
  width: 100%; height: 100%; border-radius: 50%; border: 6px solid #1a1a2e;
  background: repeating-conic-gradient(from 0deg, #d1263c 0deg 20deg, #16101c 20deg 40deg);
  box-shadow: inset 0 0 20px rgba(0,0,0,.55);
  transition: transform 2.6s cubic-bezier(0.15, 0.72, 0.1, 1);
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 66px; height: 66px; border-radius: 50%; background: #fff; border: 3px solid #1a1a2e;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; z-index: 2;
}
.wheel-hub.red { color: #d1263c; } .wheel-hub.black { color: #16101c; } .wheel-hub.green { color: #0a8a37; }
.wheel-pointer { position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 18px solid #ffe08a; z-index: 3; }

/* ---- slot machine ---- */
.slot-machine {
  display: flex; gap: 12px; justify-content: center;
  background: var(--blue); border: 4px solid #1a1a2e; border-radius: 14px;
  padding: 16px; margin-bottom: 14px; box-shadow: inset 0 0 0 4px #fff;
}
.reel {
  flex: 1; max-width: 110px; height: 92px; background: #fff; border: 3px solid #1a1a2e;
  border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 7px 10px rgba(0,0,0,.15), inset 0 -7px 10px rgba(0,0,0,.15);
}
.reel .sym { font-weight: 800; font-size: 1.4rem; color: #16101c; letter-spacing: 0.5px; }
.reel.spinning .sym { filter: blur(2px); opacity: 0.8; }
.slot-machine.win { animation: flash 0.32s steps(2) 5; }
@keyframes flash { 50% { background: #ffe08a; } }

/* ---- admin mainframe ---- */
.mainframe {
  border: 2px solid var(--text); border-radius: 10px; background: #0b1020; color: #7dffa0;
  padding: 14px; margin-bottom: 14px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; min-height: 130px;
}
.mainframe-lock { text-align: center; color: #9fb0d0; padding: 18px 0; }
.mainframe-lock .lock-glyph { font-size: 2rem; }
.mainframe-lock p { font-weight: 800; letter-spacing: 1px; margin: 8px 0 2px; color: #cfe0ff; font-family: "DM Sans", sans-serif; }
.mainframe .granted { color: #7dffa0; font-weight: 800; margin-bottom: 10px; font-family: "DM Sans", sans-serif; }
.mainframe table { width: 100%; border-collapse: collapse; font-size: 0.82rem; color: #cfe0ff; }
.mainframe th, .mainframe td { border: 1px solid #24304f; padding: 6px 8px; text-align: left; }
.mainframe th { background: #12203f; }

/* ---- flag box ---- */
.flagbox { border: 2px solid var(--blue); border-radius: 10px; padding: 14px; background: #f7faff; }
.fb-h { font-weight: 800; color: var(--blue); margin-bottom: 10px; letter-spacing: 0.3px; }
.flag-result { margin-top: 10px; font-weight: 700; font-size: 0.95rem; min-height: 20px; }
.flag-result.ok { color: var(--ok); }
.flag-result.bad { color: var(--bad); }

/* ---- dock ---- */
.dock {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(0,0,0,0.12);
  padding: 8px 12px; border-radius: 16px; display: flex; gap: 8px; align-items: center;
  backdrop-filter: blur(6px); z-index: 1000; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  max-width: 94vw; flex-wrap: wrap; justify-content: center;
}
.dock-item {
  font-family: inherit; font-weight: 700; font-size: 0.85rem; text-decoration: none;
  color: var(--text); background: #fff; border: 2px solid var(--text);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; transition: transform 0.12s;
}
.dock-item:hover { transform: translateY(-3px); }
.dock-item.active { background: var(--blue); color: #fff; }
.dock-item.docs { background: #eef2ff; color: var(--blue); }
.dock-score {
  font-weight: 800; font-size: 0.8rem; color: var(--blue);
  background: #fff6cf; border: 2px solid var(--text); border-radius: 10px; padding: 8px 12px;
}

@media (max-width: 640px) {
  .window-content { padding: 24px 20px 30px; }
  .dock-item { padding: 7px 9px; font-size: 0.78rem; }
}
