:root {
  color-scheme: dark;
  --ink: #0a1614;
  --panel: #10231f;
  --panel-light: #17322b;
  --panel-line: rgba(255, 255, 255, 0.1);
  --felt: #17614b;
  --felt-bright: #25896b;
  --cream: #f3ead5;
  --cream-dim: #c9c2b1;
  --gold: #e8b949;
  --gold-dark: #a97620;
  --red: #d9544d;
  --green: #4ade9b;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.36);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #08110f; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 48% -10%, rgba(45, 130, 101, 0.22), transparent 38%),
    linear-gradient(180deg, #0d1e1a 0%, #08110f 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

button, input { font: inherit; }
button { color: inherit; }

.page-shell { min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 3vw, 48px);
  background: rgba(8, 20, 17, 0.9);
  border-bottom: 1px solid rgba(232, 185, 73, 0.25);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-family: Georgia, serif; font-size: 21px; letter-spacing: 0.08em; }
.brand-copy small { margin-top: 6px; color: var(--gold); font-size: 9px; letter-spacing: 0.19em; }

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #3d4644 0 10%, #151a19 32%, #030505 76%);
  border: 2px solid #d9d7ce;
  box-shadow: inset -5px -7px 10px #000, 0 4px 10px rgba(0, 0, 0, 0.35);
}

.brand-mark span {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f5f2e9;
  color: #161918;
  font: 700 12px/1 Georgia, serif;
}

.utility-nav { display: flex; align-items: center; gap: 20px; }
.live-pill, .online-count, .server-readout { display: inline-flex; align-items: center; gap: 8px; color: var(--cream-dim); font-size: 12px; }
.live-pill i, .online-count i, .server-readout i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.text-button { border: 0; background: transparent; color: var(--cream-dim); cursor: pointer; }
.text-button:hover { color: var(--cream); }
.account-button { display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 7px; border: 1px solid var(--panel-line); border-radius: 7px; background: var(--panel-light); cursor: pointer; }

.avatar { display: grid; place-items: center; border-radius: 50%; color: #07110e; font-weight: 800; background: linear-gradient(145deg, #f4d477, #c79128); border: 2px solid rgba(255, 255, 255, 0.28); box-shadow: inset 0 1px rgba(255, 255, 255, 0.4); }
.avatar-small { width: 28px; height: 28px; font-size: 11px; }
.avatar-large { width: 76px; height: 76px; margin: 0 auto 18px; font: 700 28px Georgia, serif; }
.avatar-chat { width: 31px; height: 31px; flex: 0 0 31px; font-size: 11px; }
.avatar-teal { background: linear-gradient(145deg, #63d9c2, #2a8675); }
.avatar-gold { background: linear-gradient(145deg, #f5d57c, #bd8124); }
.avatar-red { background: linear-gradient(145deg, #f4867d, #a9343b); }

.dashboard {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 2vw, 34px);
  display: grid;
  grid-template-columns: 248px minmax(480px, 1fr) 300px;
  gap: 18px;
  flex: 1;
}

.panel { background: linear-gradient(180deg, rgba(20, 45, 38, 0.96), rgba(13, 29, 25, 0.98)); border: 1px solid var(--panel-line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 45px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--panel-line); background: rgba(255, 255, 255, 0.025); font-size: 12px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

.profile-panel { align-self: start; }
.profile-body { padding: 28px 20px 22px; text-align: center; }
.profile-body h1 { margin: 5px 0 9px; font: 700 23px/1.1 Georgia, serif; }
.muted { color: #a9b1ab; font-size: 12px; line-height: 1.55; }
.eyebrow { margin: 0 0 7px; color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: 0.19em; }
.button { min-height: 40px; padding: 0 17px; border-radius: 5px; border: 1px solid transparent; font-size: 12px; font-weight: 800; letter-spacing: 0.025em; cursor: pointer; transition: transform 140ms ease, filter 140ms ease, border-color 140ms ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button-primary { color: #1d1708; background: linear-gradient(180deg, #f4d579, #d39b31); border-color: #ffdd82 #9f701d #8a5b16 #ffe29a; box-shadow: inset 0 1px rgba(255,255,255,.45), 0 5px 14px rgba(0,0,0,.24); }
.button-secondary { background: #1c4438; border-color: rgba(255,255,255,.16); }
.button-ghost { background: rgba(0,0,0,.16); border-color: rgba(255,255,255,.21); }
.button-full { width: 100%; }
.profile-body .button { margin-top: 13px; }

.stat-grid { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--panel-line); border-bottom: 1px solid var(--panel-line); }
.stat-grid div { padding: 14px 4px; text-align: center; }
.stat-grid div + div { border-left: 1px solid var(--panel-line); }
.stat-grid dt { color: #8e9e96; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.stat-grid dd { margin: 5px 0 0; font: 700 16px Georgia, serif; }
.panel-section { padding: 18px 16px; }
.section-label { margin: 0 0 10px; color: #94a39b; font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 5px; background: rgba(0,0,0,.24); }
.segmented-control button { min-height: 32px; padding: 0 4px; border: 0; border-radius: 3px; background: transparent; color: #87958f; font-size: 10px; cursor: pointer; }
.segmented-control button.active { color: var(--cream); background: #285b4c; box-shadow: inset 0 1px rgba(255,255,255,.1); }
.system-card { margin: 0 16px 16px; padding: 12px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(74,222,155,.2); border-radius: 6px; background: rgba(74,222,155,.06); }
.system-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(74,222,155,.16); color: var(--green); font-weight: 900; }
.system-card strong, .system-card small { display: block; }
.system-card strong { font-size: 11px; }
.system-card small { margin-top: 3px; color: #87978f; font-size: 9px; }

.lobby-column { min-width: 0; display: grid; gap: 18px; align-content: start; }
.hero-panel { min-height: 272px; display: grid; grid-template-columns: minmax(270px, .9fr) minmax(300px, 1.1fr); background: radial-gradient(circle at 85% 28%, rgba(57, 161, 126, .34), transparent 40%), linear-gradient(135deg, #173f34, #0d211c 63%); }
.hero-copy { align-self: center; padding: 34px 0 34px 34px; position: relative; z-index: 2; }
.hero-copy h2, .rooms-header h2 { margin: 0; font: 700 clamp(27px, 3vw, 41px)/1.05 Georgia, serif; }
.hero-copy > p:not(.eyebrow) { max-width: 470px; margin: 13px 0 22px; color: #b8c4be; font-size: 13px; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.table-art { min-width: 0; display: grid; place-items: center; padding: 26px 26px 26px 10px; perspective: 700px; overflow: hidden; }
.table-rail { width: min(420px, 96%); aspect-ratio: 1.85; padding: 16px; position: relative; border-radius: 13px; background: linear-gradient(145deg, #75451e, #321c0e 70%); border: 2px solid #9d6a37; box-shadow: inset 0 0 0 5px #261207, 0 26px 34px rgba(0,0,0,.42); transform: rotateX(7deg) rotateZ(-2.5deg); }
.felt { width: 100%; height: 100%; position: relative; overflow: hidden; border-radius: 3px; background: radial-gradient(circle at 50% 40%, #2b8769, #176049 64%, #0e4536); box-shadow: inset 0 0 28px rgba(0,0,0,.48); }
.pocket { width: 17px; height: 17px; position: absolute; z-index: 3; border-radius: 50%; background: #050706; box-shadow: inset 0 0 3px #000; }
.p1 { left: 8px; top: 7px; }.p2 { left: 50%; top: 5px; transform: translateX(-50%); }.p3 { right: 8px; top: 7px; }
.p4 { left: 8px; bottom: 7px; }.p5 { left: 50%; bottom: 5px; transform: translateX(-50%); }.p6 { right: 8px; bottom: 7px; }
.cue-ball { width: 18px; height: 18px; position: absolute; left: 23%; top: 48%; border-radius: 50%; background: radial-gradient(circle at 32% 28%, white, #ddd 57%, #aaa); box-shadow: 1px 4px 5px rgba(0,0,0,.35); }
.cue-stick { width: 58%; height: 5px; position: absolute; left: -28%; top: 54%; border-radius: 4px; background: linear-gradient(90deg, #593519, #dcb57b 72%, #e7d2a4); transform: rotate(-9deg); box-shadow: 0 3px 4px rgba(0,0,0,.3); }
.rack { width: 76px; height: 83px; position: absolute; right: 20%; top: 50%; transform: translateY(-50%) rotate(30deg); }
.ball { width: 16px; height: 16px; display: grid; place-items: center; position: absolute; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); box-shadow: inset 2px 2px 3px rgba(255,255,255,.35), 1px 3px 4px rgba(0,0,0,.28); background: #d6ad2f; }
.b1{left:0;top:32px}.b2{left:15px;top:23px;background:#3976b8}.b3{left:15px;top:41px;background:#c8443c}.b4{left:30px;top:14px;background:#764ca8}.b5{left:30px;top:32px;background:#f29333}.b6{left:30px;top:50px;background:#347653}.b7{left:45px;top:5px;background:#8d2730}.b8{left:45px;top:23px;background:#101313;color:#fff;font:700 8px Georgia}.b9{left:45px;top:41px;background:#e1bd38}.b10{left:45px;top:59px;background:#3976b8}

.rooms-panel { min-height: 383px; }
.rooms-header { padding: 21px 22px 17px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.rooms-header h2 { font-size: 25px; }
.room-tools { display: flex; gap: 7px; }
.search-field input { width: 164px; height: 35px; padding: 0 11px; border: 1px solid var(--panel-line); border-radius: 5px; color: var(--cream); background: rgba(0,0,0,.18); outline: none; }
.search-field input:focus { border-color: rgba(232,185,73,.6); }
.icon-button { width: 35px; height: 35px; border-radius: 5px; border: 1px solid var(--panel-line); background: var(--panel-light); cursor: pointer; }
.icon-button.spinning { animation: spin .55s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
.room-table { border-top: 1px solid var(--panel-line); }
.room-row { min-height: 58px; display: grid; grid-template-columns: minmax(180px, 1.6fr) .65fr .8fr .75fr 55px; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.06); color: #bdc7c2; font-size: 11px; }
.room-row:not(.room-table-head):hover { background: rgba(255,255,255,.025); }
.room-table-head { min-height: 32px; color: #71837a; font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; background: rgba(0,0,0,.13); }
.room-name { display: flex; align-items: center; gap: 10px; }
.room-name strong, .room-name small { display: block; }
.room-name strong { color: #e7e2d5; font-size: 11px; }
.room-name small { margin-top: 4px; color: #71837a; font-size: 9px; }
.table-status, .legend-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--green); }
.game-chip { padding: 4px 7px; border-radius: 3px; color: #c8d6cf; background: rgba(255,255,255,.07); }
.ping { display: flex; align-items: center; gap: 7px; }
.ping i { width: 12px; height: 9px; display: inline-block; border-left: 2px solid var(--green); border-bottom: 2px solid var(--green); transform: skewY(-35deg); opacity: .9; }
.join-button { min-height: 28px; padding: 0 10px; border: 1px solid rgba(232,185,73,.45); border-radius: 4px; background: rgba(232,185,73,.07); color: var(--gold); font-size: 10px; font-weight: 800; cursor: pointer; }
.join-button:hover { color: #1a1508; background: var(--gold); }
.rooms-footer { min-height: 37px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; color: #718179; font-size: 9px; }
.rooms-footer span { display: flex; align-items: center; gap: 6px; }
.empty-state { padding: 30px; text-align: center; color: #81918a; font-size: 12px; }

.chat-panel { align-self: start; min-height: 625px; display: flex; flex-direction: column; }
.chat-stream { height: 456px; padding: 14px 14px 6px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #31554a transparent; }
.system-message { margin: 7px 0 14px; display: flex; align-items: center; gap: 8px; color: #65766e; font-size: 8px; letter-spacing: .11em; text-transform: uppercase; }
.system-message::before, .system-message::after { content: ""; height: 1px; flex: 1; background: rgba(255,255,255,.07); }
.chat-message { display: flex; gap: 9px; margin-bottom: 17px; }
.chat-message > div:last-child { min-width: 0; flex: 1; }
.chat-message header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-message strong { color: #e5e0d4; font-size: 10px; }
.chat-message time { color: #607168; font-size: 8px; }
.chat-message p { margin: 5px 0 0; color: #aeb9b3; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.own-message p { color: #d8d0bd; }
.chat-notice { margin: 4px 0 12px; padding: 9px 10px; border: 1px solid rgba(232,185,73,.13); border-radius: 5px; color: #918a78; background: rgba(232,185,73,.04); font-size: 9px; line-height: 1.45; }
.chat-form { margin: auto 12px 0; display: flex; border: 1px solid var(--panel-line); border-radius: 5px; background: rgba(0,0,0,.2); }
.chat-form input { width: 100%; min-width: 0; height: 39px; padding: 0 11px; border: 0; outline: none; background: transparent; color: var(--cream); font-size: 11px; }
.chat-form button { width: 40px; border: 0; background: transparent; color: var(--gold); cursor: pointer; }
.chat-footer { min-height: 43px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; color: #607168; font-size: 8px; }
.chat-footer button { border: 0; background: none; color: #8a9a92; font-size: 8px; cursor: pointer; }

.site-footer { min-height: 48px; padding: 0 clamp(18px, 3vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid rgba(255,255,255,.06); color: #6f8178; font-size: 9px; letter-spacing: .08em; }
.site-footer strong { color: #a6b0ab; }
.footer-separator { margin: 0 6px; color: var(--gold-dark); }

.modal { width: min(440px, calc(100% - 28px)); padding: 32px; border: 1px solid rgba(232,185,73,.35); border-radius: 12px; color: var(--cream); background: linear-gradient(180deg, #18382f, #0b1d19); box-shadow: 0 30px 90px rgba(0,0,0,.75); text-align: center; }
.modal::backdrop { background: rgba(1,8,6,.78); backdrop-filter: blur(4px); }
.modal-close { width: 34px; height: 34px; position: absolute; right: 9px; top: 9px; border: 0; background: transparent; color: #87958e; font-size: 24px; cursor: pointer; }
.modal-icon { margin: 2px auto 19px; }
.modal h2 { margin: 7px 0 10px; font: 700 29px/1.1 Georgia, serif; }
.modal > p:not(.eyebrow) { margin: 0 0 21px; color: #aebbb4; font-size: 13px; line-height: 1.6; }
.room-code { margin: -5px 0 20px; padding: 13px; border: 1px dashed rgba(232,185,73,.45); border-radius: 5px; color: var(--gold); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; background: rgba(0,0,0,.18); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@media (max-width: 1120px) {
  .dashboard { grid-template-columns: 224px minmax(500px, 1fr); }
  .chat-panel { grid-column: 1 / -1; min-height: 340px; }
  .chat-stream { height: 230px; }
}

@media (max-width: 820px) {
  .site-header { position: static; }
  .live-pill, .text-button { display: none; }
  .dashboard { grid-template-columns: 1fr; padding-top: 16px; }
  .profile-panel { display: grid; grid-template-columns: 1.1fr .9fr; }
  .profile-panel .panel-heading { grid-column: 1 / -1; }
  .profile-body { grid-row: span 3; }
  .stat-grid { border-top: 0; }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-copy { padding: 28px 28px 10px; }
  .table-art { padding: 18px 28px 30px; }
}

@media (max-width: 600px) {
  .brand-copy small { display: none; }
  .account-button { font-size: 0; }
  .account-button .avatar { font-size: 11px; }
  .profile-panel { display: block; }
  .stat-grid { border-top: 1px solid var(--panel-line); }
  .rooms-header { align-items: stretch; flex-direction: column; }
  .search-field { flex: 1; }
  .search-field input { width: 100%; }
  .room-row { grid-template-columns: 1fr auto auto; padding: 9px 14px; }
  .room-row > :nth-child(3), .room-row > :nth-child(4) { display: none; }
  .room-table-head { display: none; }
  .rooms-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
  .site-footer { padding: 13px 18px; align-items: flex-start; flex-direction: column; }
}

