:root {
  --gold: #f0a63c;
  --gold-2: #ffd479;
  --gold-deep: #b9781a;
  --ink: #08090b;
  --ink-2: #101218;
  --felt: #0b3a2e;        /* casino felt green */
  --felt-glow: #0d4636;   /* lit felt under the table light */
  --panel: #15161d;
  --panel-2: #1d1f28;
  --text: #f4efe3;
  --muted: #8c8c98;
  --line: #2a2c36;
  --red: #c12030;         /* roulette / hearts */
  --chad: #3a4a5a;        /* steel — Chad's out-of-place corporate blue-grey */
  --chad-2: #25303b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--ink); color: var(--text); overscroll-behavior: none;
}
.screen { height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
input, textarea, button { font: inherit; }

/* casino-felt table glow used behind the dark screens */
.felt-bg {
  background:
    radial-gradient(140% 90% at 50% -10%, rgba(240,166,60,.10) 0%, transparent 45%),
    radial-gradient(120% 120% at 50% 60%, var(--felt-glow) 0%, #06120e 55%, #050608 100%);
}

/* ---------- Gate (login / register) ---------- */
#login {
  align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(120% 80% at 50% -5%, rgba(240,166,60,.16) 0%, transparent 50%),
    radial-gradient(130% 130% at 50% 55%, #0d4636 0%, #07140f 55%, #050608 100%);
}
.login-card {
  position: relative; width: 100%; max-width: 380px; text-align: center;
  background: linear-gradient(180deg, #181a22 0%, #111219 100%);
  border: 1px solid #34372f; border-radius: 22px; padding: 30px 24px 26px;
  box-shadow: 0 26px 70px rgba(0,0,0,.65), 0 0 0 1px rgba(240,166,60,.12),
              inset 0 1px 0 rgba(255,255,255,.04);
}
.login-card::before {  /* gold table rim */
  content: ""; position: absolute; inset: 7px; border-radius: 16px;
  border: 1px dashed rgba(240,166,60,.25); pointer-events: none;
}
.brand-logo { width: 84px; height: 84px; margin: 0 auto 12px; display: block;
  filter: drop-shadow(0 4px 14px rgba(240,166,60,.35)); }
.wordmark {
  margin: 0 0 6px; font-size: 27px; font-weight: 900; line-height: 1.02;
  letter-spacing: .07em;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.sub { color: var(--gold); margin: 8px 0 6px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; font-weight: 800; }
.sub::after {
  content: "⚀  ⚁  ⚂  ⚃  ⚄  ⚅"; display: block; margin-top: 12px; margin-bottom: 6px;
  color: rgba(240,166,60,.5); font-size: 15px; letter-spacing: .15em;
}
#register-form, #login-form { display: flex; flex-direction: column; gap: 11px; }
input {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px;
  font-size: 16px; outline: none; background: #0c0d12; color: var(--text);
}
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,166,60,.2); }
#r-btn, #l-btn {
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  color: #2a1b06; border: none; border-radius: 13px; padding: 14px; font-size: 16px;
  font-weight: 900; cursor: pointer; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(240,166,60,.3);
}
#r-btn:active, #l-btn:active { transform: translateY(1px); }
.error { color: #ff9b8e; font-size: 14px; margin: 6px 0 0; }
.switch { color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.linkish { background: none; border: none; color: var(--gold); font-weight: 800; cursor: pointer; font-size: 14px; padding: 0; }

/* ---------- Gamblor grants entry ---------- */
#entry {
  align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(120% 80% at 50% -5%, rgba(240,166,60,.22) 0%, transparent 50%),
    radial-gradient(130% 130% at 50% 55%, #0d4636 0%, #07140f 55%, #050608 100%);
}
.entry-card {
  position: relative; width: 100%; max-width: 420px; text-align: center;
  background: linear-gradient(180deg, #181a22 0%, #0f1016 100%);
  border: 1px solid #5a4420; border-radius: 22px; padding: 30px 24px 26px;
  box-shadow: 0 26px 80px rgba(0,0,0,.7), 0 0 60px rgba(240,166,60,.12);
}
.entry-dice { font-size: 46px; line-height: 1; margin-bottom: 8px;
  animation: tumble 1.1s cubic-bezier(.2,.7,.3,1) 1; filter: drop-shadow(0 6px 16px rgba(240,166,60,.4)); }
@keyframes tumble {
  0% { transform: rotate(-220deg) scale(.4); opacity: 0; }
  70% { transform: rotate(12deg) scale(1.12); opacity: 1; }
  100% { transform: rotate(0) scale(1); opacity: 1; }
}
.entry-kicker { color: var(--gold); font-size: 12px; letter-spacing: .26em; text-transform: uppercase; font-weight: 800; margin: 0 0 4px; }
.entry-title {
  margin: 0 0 14px; font-size: 24px; font-weight: 900; letter-spacing: .05em;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.entry-decree {
  color: #f3e7cf; font-size: 16px; line-height: 1.6; white-space: pre-wrap;
  margin: 0 0 22px; text-align: left;
}
.entry-btn {
  width: 100%; background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  color: #2a1b06; border: none; border-radius: 13px; padding: 15px; font-size: 16px;
  font-weight: 900; cursor: pointer; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 6px 22px rgba(240,166,60,.32);
}
.entry-btn:active { transform: translateY(1px); }

/* ---------- The table ---------- */
#chat {
  background:
    radial-gradient(130% 70% at 50% 0%, rgba(240,166,60,.07) 0%, transparent 45%),
    radial-gradient(120% 120% at 50% 50%, #0c4032 0%, #08160f 60%, #060708 100%);
}
.bar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #14161d 0%, #0d0f14 100%); color: var(--text);
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.bar .bar-icon { height: 28px; width: 28px; filter: drop-shadow(0 2px 6px rgba(240,166,60,.4)); }
.bar .bar-name {
  font-weight: 900; font-size: 16px; letter-spacing: .16em;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.who { display: flex; align-items: center; gap: 9px; }
.bar-actions { display: flex; align-items: center; gap: 12px; }
.role-chip {
  font-size: 11px; letter-spacing: .04em;
  background: radial-gradient(circle at 50% 30%, var(--gold-2), var(--gold-deep));
  color: #2a1b06; padding: 3px 11px; border-radius: 999px; font-weight: 900;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid rgba(255,255,255,.25);
}
.link { background: none; border: none; color: var(--gold); font-size: 14px; cursor: pointer; font-weight: 800; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-direction: column; max-width: 88%; }
.row.me { align-self: flex-end; align-items: flex-end; }
.row.them, .row.jfbfj, .row.chad { align-self: flex-start; align-items: flex-start; }
.row.jfbfj { max-width: 92%; }
.who-label { font-size: 11px; font-weight: 900; color: var(--muted); margin: 0 0 3px 12px; letter-spacing: .04em; }
.row.jfbfj .who-label {
  margin-left: 14px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.row.chad .who-label { color: #7fa0bd; margin-left: 14px; }
.bubble {
  padding: 11px 14px; border-radius: 17px; font-size: 15px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
}
.row.me .bubble {
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 60%, var(--gold-deep) 100%);
  color: #2a1b06; border-bottom-right-radius: 5px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(240,166,60,.22);
}
.row.them .bubble {
  background: linear-gradient(180deg, #1a1c24 0%, #15171e 100%);
  border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 5px;
}
/* The JFBFJ — the dealer / the house */
.row.jfbfj .bubble {
  background: linear-gradient(180deg, #241d10 0%, #1a1409 100%);
  border: 1px solid #5a4420; color: #f6e6c8; border-bottom-left-radius: 5px;
  box-shadow: 0 0 0 1px rgba(240,166,60,.08) inset, 0 4px 16px rgba(0,0,0,.4);
}
.row.jfbfj .bubble strong { color: var(--gold-2); }
/* Chad — the corporate AI who wandered into a casino */
.row.chad .bubble {
  background: linear-gradient(180deg, var(--chad) 0%, var(--chad-2) 100%);
  border: 1px solid #4a5d6e; color: #d7e3ee; border-bottom-left-radius: 5px;
  font-size: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
/* EPIC MOMENT — the jackpot */
.bubble.declare {
  background: linear-gradient(180deg, #2a200d 0%, #1d1608 100%) !important;
  border: 1px solid var(--gold) !important;
  box-shadow: 0 0 22px rgba(240,166,60,.3), 0 0 0 1px rgba(255,212,121,.25) inset !important;
}
.bubble img { display: block; max-width: 100%; border-radius: 10px; margin-top: 6px; }
.at { font-size: 10px; color: var(--muted); margin: 3px 12px 0; opacity: .65; }
.hint { align-self: center; color: var(--muted); font-size: 13px; text-align: center; max-width: 90%; }
.typing { align-self: flex-start; color: var(--gold); font-size: 13px; font-style: italic; margin-left: 14px; opacity: .9; }

/* ---------- Composer ---------- */
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #101219 0%, #0a0c11 100%); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; max-height: 120px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 18px; font-size: 16px; outline: none;
  background: #0c0d12; color: var(--text);
}
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,166,60,.16); }
.round {
  width: 44px; height: 44px; border-radius: 50%; padding: 0; flex: none;
  border: none; font-size: 18px; cursor: pointer; display: grid; place-items: center;
}
.round.gold {
  background: radial-gradient(circle at 50% 30%, var(--gold-2), var(--gold) 60%, var(--gold-deep));
  color: #2a1b06; font-weight: 900; box-shadow: 0 4px 14px rgba(240,166,60,.3);
}
.round.ghost {
  background: #15171e; color: var(--gold); border: 1px solid var(--line); font-size: 24px; font-weight: 700;
}
.round:disabled { opacity: .45; }

/* ---------- The Record ---------- */
#moments {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(240,166,60,.06) 0%, transparent 50%),
    radial-gradient(120% 120% at 50% 50%, #0c4032 0%, #08160f 60%, #060708 100%);
}
.moments-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.moment {
  background: linear-gradient(180deg, #1a1c24 0%, #14161d 100%);
  border: 1px solid #4a3a1c; border-left: 3px solid var(--gold);
  border-radius: 13px; padding: 13px 15px;
  box-shadow: 0 0 18px rgba(240,166,60,.08);
}
.moment-title {
  font-weight: 900; font-size: 15px; letter-spacing: .02em;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.moment-title::before { content: "🎰 "; -webkit-text-fill-color: initial; }
.moment-body { color: var(--text); font-size: 14px; line-height: 1.5; margin-top: 5px; white-space: pre-wrap; }
.moment-meta { color: var(--muted); font-size: 11px; margin-top: 7px; }
.moment img { display: block; max-width: 100%; border-radius: 10px; margin-top: 8px; }
.persp-list { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 7px; }
.persp { font-size: 13px; line-height: 1.45; color: var(--text); padding-left: 10px; border-left: 2px solid var(--felt-glow); }
.persp-who { font-weight: 800; color: var(--gold-2); }
.persp-add { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.persp-add textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 100px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 12px; font-size: 14px; outline: none;
  background: var(--ink-2); color: var(--text);
}
.persp-add textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,166,60,.16); }
.persp-add button {
  flex: none; border: none; border-radius: 11px; padding: 9px 13px; font-size: 13px;
  font-weight: 800; cursor: pointer; color: #2a1b06;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
}
.persp-add button:disabled { opacity: .5; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; font-size: 14px; line-height: 1.6; }
