body.player {
  --paper: #f3f5ef;
  --surface: #fff;
  --ink: #122720;
  --muted: #55675d;
  --line: #d6ded3;
  --dark: #102924;
  --gold: #d2f578;
  --accent: #285941;
  --ca-lime: #d2f578;
  --ca-edge: clamp(14px, 3.6vw, 38px);
  --ca-width: 1196px;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.player #shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.player :focus-visible { outline: 3px solid #648339; outline-offset: 3px; }
.player .masthead {
  flex: 0 0 auto;
  background: #fff;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.android-download { display:block; background:#15392e; color:#f5faef; }
.android-download-inner {
  display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%;
  max-width:var(--ca-width); margin:auto; min-height:44px; padding:4px var(--ca-edge);
  padding-left:max(var(--ca-edge),env(safe-area-inset-left,0px)); padding-right:max(var(--ca-edge),env(safe-area-inset-right,0px));
  font-size:.88rem; line-height:1.3;
}
.android-download-inner strong { overflow-wrap:anywhere; }
.android-download-action {
  display:inline-flex; flex:none; align-items:center; gap:6px; padding:6px 12px;
  background:var(--ca-lime); color:#153124; border-radius:7px; font-weight:750;
}
.android-download:focus-visible { outline-offset:-3px; }
@media (max-height:530px) {
  .player:has(input:focus, textarea:focus) .android-download { display:none; }
}
.player .top-inner, .player #main-content {
  width: 100%;
  max-width: var(--ca-width);
  margin-inline: auto;
  padding-inline: var(--ca-edge);
  padding-left: max(var(--ca-edge), env(safe-area-inset-left, 0px));
  padding-right: max(var(--ca-edge), env(safe-area-inset-right, 0px));
}
.player .top-inner { display:flex; align-items:center; min-height:72px; gap:12px; padding-block:8px; }
.player #brand-link {
  display:inline-flex; align-items:center; gap:10px; color:var(--ink); min-height:44px;
  letter-spacing:0; font-family:inherit; text-decoration:none;
}
.player #brand-link img { flex:none; width:41px; height:41px; object-fit:cover; border-radius:11px; }
.ca-brandname strong { font-size:21px; font-weight:800; letter-spacing:.015em; }
.player #top-nav { display:none; }
.player #top-actions { margin-left:auto; display:flex; align-items:center; gap:8px; }
.player .ca-header-link {
  min-height:40px; padding:0 15px; border:1px solid #cdd8ce; border-radius:22px;
  background:white; color:#233d32; font-size:14px; line-height:1.3; font-weight:650;
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
}
.player .ca-header-support { border-color:transparent; background:transparent; }
.player .ca-header-link[aria-current="page"] { color:#183326; background:#edf5e8; }
.ca-header-link svg { width:17px; height:17px; }
.player #main-content {
  flex:1 1 0; min-height:0; min-width:0; padding-block:24px; overflow-y:auto;
  overscroll-behavior-y:contain; scrollbar-width:thin; scrollbar-color:#bbc7bb transparent;
}
.ca-lobby {
  display:grid; grid-template-columns:minmax(0,1.45fr) minmax(300px,1fr);
  grid-template-areas:"hero directory" "result directory"; gap:18px; align-items:start;
}
.ca-lobby .ca-lobby-hero { min-height:180px; }
.ca-lobby .ca-draw { padding-block:17px; }
.ca-lobby .ca-draw .ca-equation { margin-top:12px; }
.ca-room-directory {
  grid-area:directory; min-width:0; padding:22px; border-radius:18px;
  background:#fff; border:1px solid var(--line);
}
.ca-room-directory h2 { font-size:1.3rem; margin:0 0 15px; }
.ca-room-list { display:grid; gap:10px; }
.ca-room-entry {
  min-width:0; min-height:78px; padding:12px 14px; display:flex; align-items:center;
  justify-content:space-between; gap:10px; border:1px solid #cdd9c8; border-radius:12px; background:#f6f8f1;
}
.ca-entry-info { min-width:0; display:grid; justify-items:start; gap:3px; }
.ca-entry-info strong { font-weight:750; font-size:1.22rem; line-height:1.35; overflow-wrap:anywhere; }
.ca-entry-state { color:#5c695d; font-size:.84rem; }
.ca-entry-state[data-phase="open"] { color:#2e683e; }
.ca-enter-label { flex:none; display:grid; place-items:center; min-height:42px; padding:6px 14px; border-radius:9px; background:#173b2d; color:#f1fbdc; font-size:.92rem; font-weight:700; }
.ca-room-entry:hover, .ca-room-entry:focus-visible { border-color:#709572; background:#edf4e5; }
.ca-room-empty { margin:0 auto; }
.ca-hero {
  grid-area:hero; position:relative; display:flex; flex-direction:column; justify-content:flex-end;
  isolation:isolate; overflow:hidden; min-height:238px; padding:26px clamp(22px,3vw,36px);
  border-radius:18px; background:#102924; color:#f8fcf4;
}
.ca-hero::before {
  content:""; position:absolute; z-index:-1; inset:0;
  background-image:linear-gradient(90deg,rgba(8,32,25,.94) 0%,rgba(8,32,25,.72) 28%,rgba(8,32,25,.14) 61%,transparent 82%),
      url("/assets/draw-studio.webp");
  background-position:center, center 48%; background-size:cover; background-repeat:no-repeat;
}
.ca-hero h1 {
  display:flex; flex-wrap:nowrap; align-items:baseline; width:max-content; max-width:100%; margin:0;
  color:#fbfff4; font-size:clamp(38px,4.5vw,62px); font-weight:850; line-height:1.16; letter-spacing:-.07em;
}
.ca-hero h1 span {
  display:inline-block; margin-left:.09em; padding-right:.06em; color:var(--ca-lime);
  font:italic 850 1.23em/.9 "Arial", "Segoe UI", sans-serif; letter-spacing:-.065em;
}
.ca-draw {
  border-radius:18px; border:1px solid var(--line); background:var(--surface); color:var(--ink);
}
.ca-draw {
  grid-area:result; position:relative; overflow:hidden; width:100%; padding:25px 24px 29px;
  display:flex; flex-direction:column; justify-content:center; align-items:flex-start;
  text-align:left; font-family:inherit; cursor:pointer;
  background:linear-gradient(125deg,#fcfdf6,#f2f7e8);
}
.ca-draw-head { width:100%; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:5px 8px; }
.ca-draw-head strong {
  margin:0; font-size:20px; font-weight:760; letter-spacing:-.025em; color:var(--ink);
}
.ca-draw-link {
  display:inline-flex; gap:5px; align-items:center; color:#4a5f50; font-size:13px; line-height:1.2; font-weight:550;
}
.ca-draw-link svg { flex:none; width:15px; height:15px; }
.ca-draw-meta { margin-top:6px; color:#556654; font-size:14px; line-height:1.3; }
.ca-equation {
  display:inline-flex; align-items:center; gap:5px; white-space:nowrap; color:#748376;
  font-family:"Arial","Segoe UI",sans-serif; font-variant-numeric:tabular-nums;
}
.ca-equation i { font:500 13px/1 Arial,sans-serif; }
.ca-ball {
  width:26px; height:26px; display:inline-grid; place-items:center; flex:none; border-radius:50%;
  background:#f2f5ee; color:#33503c; font-size:14px; font-weight:700; line-height:1;
}
.ca-total { background:#d9efb8; color:#1d3c29; }
.ca-draw .ca-equation { align-self:flex-start; justify-content:flex-start; margin-top:28px; gap:clamp(4px,.55vw,8px); }
.ca-draw .ca-ball {
  width:clamp(37px,3.45vw,51px); height:clamp(37px,3.45vw,51px);
  border:1px solid #d4dfcc; box-shadow:inset 0 2px 3px #fff;
  background:radial-gradient(ellipse at 35% 24%,#fff 24%,#f1f6e9 70%,#e6eddc);
  font-size:clamp(20px,2vw,29px); font-weight:750; color:#243b2b;
}
.ca-draw .ca-total { border-color:#bbdc8b; background:radial-gradient(ellipse at 35% 24%,#edffbb,#cff072 70%,#c0e467); box-shadow:inset 0 2px 2px #efffc8; }
.ca-await-draw { margin-top:20px; color:var(--muted); font-size:15px; }
/* The room keeps the period strip, composer and navigation on screen.
   Only the conversation scrolls; the lobby retains its own page layout. */
.player.at-table #main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-block: 14px;
}
.ca-chat-room {
  width: 100%;
  max-width: 900px;
  min-width: 0;
  min-height: 0;
  flex: 1;
  align-self: center;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  border: 1px solid #d3ddd1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 25px #142b2110;
  background: white;
}
.ca-room-summary { display: contents; }
.ca-chat-room > *, .ca-room-summary > * { min-width: 0; }
.ca-room-summary > .ca-feed-notice { grid-row: 4; padding: 4px 18px; background: #f5edd5; color: #6a5324; font-size: .83rem; line-height: 1.4; }
.ca-chat-room > .ca-chat-stream { grid-row: 5; }
.ca-chat-room > .ca-composer { grid-row: 6; }
.ca-chat-heading, .ca-chat-stats { background: #13362c; color: #f4f9ee; }
.ca-chat-heading {
  padding: 13px 22px 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ca-chat-heading h1 { font-size: clamp(1.15rem, 3.7vw, 1.55rem); letter-spacing: -.03em; overflow-wrap: anywhere; }
.ca-room-picker {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 5px 12px; border-radius: 9px; border: 1px solid #668573;
  color: #eff9df; font-size: .9rem; font-weight: 650; text-decoration: none; flex: none;
}
.ca-room-picker:hover { background: #2b503e; }
.ca-room-picker svg { width: 17px; height: 17px; }
.ca-chat-stats {
  display: grid; grid-template-columns: minmax(0,1.7fr) minmax(0,1fr) minmax(0,1.1fr);
  align-items: stretch; padding: 6px 22px 14px; gap: 15px;
}
.ca-chat-stats > div {
  display: flex; flex-wrap: wrap; align-items: baseline; align-content: center;
  gap: 2px 8px; min-width: 0;
}
.ca-chat-stats > div + div { border-left: 1px solid #4b6658; padding-left: 15px; }
.ca-chat-stats small, .ca-chat-stats .ca-fact-label { flex-basis: 100%; color: #c4d5c7; font-size: .81rem; line-height: 1.3; }
.ca-chat-stats small svg, .ca-chat-stats .ca-fact-label svg { width: 14px; height: 14px; vertical-align: middle; }
#ca-issue, #ca-time, #ca-funds {
  font: 700 clamp(.95rem, 2.8vw, 1.21rem)/1.25 Arial, "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
#ca-time { color: #dcfaa2; }
#ca-funds a { color: #e3f7b8; font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; }
#ca-state {
  display: inline-flex; align-items: center; gap: 4px; align-self: center;
  font-size: .77rem; line-height: 1.35; color: #ffdfa1;
}
#ca-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
#ca-state[data-phase="open"] { color: #d2f578; }
.ca-room-summary > .ca-draw {
  grid-area: auto; display: grid; grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "title issue equation history"; align-items: center;
  gap: 8px 12px; padding: 10px 22px; border: 0; border-radius: 0;
  border-bottom: 1px solid #d6dfcf; background: #f6f9ef;
}
.ca-chat-room .ca-draw-head { display: contents; }
.ca-chat-room .ca-draw-head strong { grid-area: title; font-size: .95rem; }
.ca-chat-room .ca-draw-meta { grid-area: issue; margin: 0; }
.ca-chat-room .ca-draw-link { grid-area: history; justify-self: end; }
.ca-chat-room .ca-draw .ca-equation, .ca-chat-room .ca-await-draw {
  grid-area: equation; justify-self: end; align-self: center; margin: 0; gap: 3px;
}
.ca-chat-room .ca-draw .ca-ball { width: 27px; height: 27px; font-size: .94rem; }
.ca-chat-stream {
  min-height: 0; overflow-y: auto; overscroll-behavior-y: contain;
  scrollbar-width: thin; scrollbar-color: #becbbd transparent;
  padding: clamp(14px, 3.3vw, 28px); background: #f0f4ed;
}
.ca-message { display: flex; align-items: flex-start; gap: 9px; }
.ca-message + .ca-message { margin-top: 15px; }
.ca-message.is-own { flex-direction: row-reverse; }
.ca-chat-avatar {
  display: grid; place-items: center; width: 33px; height: 33px; flex: none;
  border-radius: 10px; color: #d2f578; background: #183f31; object-fit: cover;
}
.ca-chat-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.ca-chat-avatar svg { width: 17px; height: 17px; }
.is-own .ca-chat-avatar { background: #d9e7d4; color: #24442e; }
.ca-chat-body { display: grid; justify-items: start; min-width: 0; max-width: min(78%, 560px); gap: 4px; }
.is-own .ca-chat-body { justify-items: end; }
.ca-chat-sender, .ca-chat-status { color: #506456; font-size: .81rem; line-height: 1.4; overflow-wrap: anywhere; }
.ca-chat-sender { display: flex; gap: 8px; flex-wrap: wrap; }
.ca-chat-bubble {
  max-width: 100%; min-width: 0; display: grid; justify-items: start; gap: 4px;
  border: 1px solid #d7e2d2; border-radius: 3px 13px 13px 13px;
  background: #fff; color: #1d3427; padding: 9px 13px; font-size: .97rem;
  line-height: 1.55; overflow-wrap: anywhere; box-shadow: 0 1px 3px #1e382209;
}
.is-welcome .ca-chat-bubble { border-color: #c7d8b9; background: #fcfff7; }
.is-own .ca-chat-bubble { color: #fff; border-color: #244e3b; border-radius: 13px 3px 13px 13px; background: #244e3b; }
.is-own .ca-chat-status { color: #def0d7; }
.ca-chat-bubble a { color: #285b3c; text-decoration: underline; text-underline-offset: 3px; }
.ca-chat-bubble .ca-equation { margin-block: 2px; }
.ca-feed-empty { color: var(--muted); font-size: .9rem; padding-block: 14px; }
.ca-composer { padding: 9px 20px; border-top: 1px solid var(--line); background: #fff; }
.ca-compose-row { display: flex; align-items: stretch; gap: 8px; }
.ca-composer input {
  flex: 1; width: 0; min-width: 0; min-height: 44px; padding: 8px 12px;
  color: var(--ink); background: #f6f8f2; border: 1px solid #cbd6c7; border-radius: 10px; font-size: 16px; line-height: 1.4;
}
.ca-composer input::placeholder { color: #607061; }
.ca-composer button {
  flex: none; min-height: 44px; padding: 7px 18px; background: #193e30; color: #fff;
  border: 1px solid #193e30; border-radius: 10px; font-size: .95rem; font-weight: 650; line-height: 1.3;
}
.player #bottom-nav:not(:empty) {
  position:static; flex:0 0 auto; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px;
  padding:7px max(var(--ca-edge),calc((100% - 800px)/2)) calc(7px + env(safe-area-inset-bottom,0px));
  width:100%; border:0; border-top:1px solid var(--line); background:#fff; box-shadow:0 -2px 14px rgba(37,56,38,.035);
}
.player #bottom-nav > :is(a,button) {
  min-width:0; min-height:44px; display:flex; align-items:center; justify-content:center; gap:9px;
  padding:5px 10px; border:1px solid transparent; color:#3f5748; border-radius:10px; background:transparent;
  font-family:inherit; font-size:15px; font-weight:650; line-height:1.2; text-decoration:none;
}
.player #bottom-nav svg { flex:none; width:20px; height:20px; }
.player #bottom-nav [aria-current="page"], .player #bottom-nav [aria-expanded="true"] { color:#163c27; border-color:#d4e2c8; background:#e6f1d8; }
.player #bottom-nav [data-ca-sheet="table"] { background:#153a2b; color:#eaffcf; }
.player #bottom-nav [data-ca-sheet="quick"] { color:#244224; background:#eaf2df; }
.player #toast { bottom:calc(74px + env(safe-area-inset-bottom,0px)); background:#1d392b; color:#f7fdf0; pointer-events:none; }
.ca-composer { anchor-name: --ca-composer; }
.player.at-table #toast {
  --toast-fallback: calc(130px + 1rem + env(safe-area-inset-bottom,0px));
  bottom: var(--toast-fallback);
  bottom: anchor(--ca-composer top, var(--toast-fallback));
  margin-bottom: 6px;
}
@media (hover:hover) {
  .player .ca-header-link:hover, .player #bottom-nav > :is(button,a):not([data-ca-sheet="table"]):hover { background:#edf3e5; }
  .ca-draw:hover { border-color:#b8c8ad; }
  .ca-composer button:hover, .player #bottom-nav [data-ca-sheet="table"]:hover { background:#244e38; }
}
@media (max-width:799px) {
  .ca-lobby { grid-template-columns:minmax(0,1fr); grid-template-areas:"hero" "directory" "result"; gap:12px; }
  .ca-lobby .ca-lobby-hero { min-height:103px; }
  .ca-lobby .ca-draw .ca-equation { margin-top:0; }
  .ca-room-directory { padding:15px; border-radius:14px; }
  .ca-room-directory h2 { margin-bottom:10px; font-size:1.14rem; }
  .ca-room-entry { min-height:64px; padding:8px 12px; }
  .ca-lobby .ca-draw { padding-block:12px; }
  .player .top-inner { min-height:59px; padding-block:6px; }
  .player #brand-link img { width:36px; height:36px; border-radius:9px; }
  .ca-brandname strong { font-size:19px; }
  .player .ca-header-link { min-height:41px; padding:0 10px; }
  .player #top-actions { gap:3px; }
  .ca-hero { min-height:177px; padding:18px 22px; border-radius:15px; }
  .ca-hero h1 { font-size:41px; }
  .ca-draw { border-radius:14px; }
  .ca-draw { display:grid; grid-template-columns:minmax(0,.96fr) auto; gap:4px 8px; padding:14px 15px; align-items:center; }
  .ca-draw-head { display:contents; }
  .ca-draw-head strong { grid-column:1; grid-row:1; }
  .ca-draw-head strong { font-size:18px; }
  .ca-draw-meta { grid-column:1; grid-row:2; font-size:13px; margin:0; }
  .ca-draw-link { grid-column:2; grid-row:2; justify-self:end; font-size:12px; }
  .ca-draw-link svg { width:14px; height:14px; }
  .ca-draw .ca-equation, .ca-await-draw { grid-column:2; grid-row:1; margin:0; justify-self:end; gap:4px; }
  .ca-draw .ca-ball { width:29px; height:29px; font-size:17px; }
  .player #bottom-nav:not(:empty) { padding:5px var(--ca-edge) calc(6px + env(safe-area-inset-bottom,0px)); gap:5px; }
  .player #bottom-nav > :is(a,button) { flex-direction:column; gap:3px; min-height:46px; font-size:13px; padding:4px; }
  .player #bottom-nav svg { width:19px; height:19px; }
  .player.at-table #main-content {
    padding: 0 env(safe-area-inset-right,0px) 0 env(safe-area-inset-left,0px);
  }
  .ca-chat-room { border: 0; border-radius: 0; box-shadow: none; }
  .ca-chat-heading { padding: 7px 15px 2px; }
  .ca-chat-stats { gap: 9px; padding: 5px 15px 10px; }
  .ca-chat-stats > div + div { padding-left: 9px; }
  .ca-room-summary > .ca-draw { gap: 2px 9px; padding: 7px 15px; }
  .ca-chat-stream { padding: 14px 13px; }
  .ca-chat-body { max-width: 83%; }
  .ca-composer { padding: 7px 12px; }
}
@media (max-width:550px) {
  .ca-room-summary > .ca-draw { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "title equation" "issue history"; }
}
@media (max-width:355px) {
  .ca-hero { padding-inline:17px; min-height:166px; }
  .ca-hero h1 { font-size:37px; }
  .ca-draw { padding-inline:11px; }
  .ca-draw .ca-ball, .ca-chat-room .ca-draw .ca-ball { width:25px; height:25px; font-size:15px; }
  .ca-equation i { font-size:11px; }
  .ca-brandname strong { font-size:17px; }
  .ca-chat-body { max-width: 84%; }
  .ca-chat-stats { gap: 6px; }
  .ca-chat-stats > div + div { padding-left: 6px; }
}
@media (max-height:460px) and (min-width:600px) {
  .player .top-inner { min-height:48px; padding-block:2px; }
  .player #brand-link img { width:31px; height:31px; }
  .ca-hero { min-height:168px; padding-block:15px; }
  .ca-hero h1 { font-size:37px; }
  .player #bottom-nav:not(:empty) { padding-block:3px calc(3px + env(safe-area-inset-bottom,0px)); }
  .player #bottom-nav > :is(a,button) { min-height:38px; }
}
@media (max-height:530px) {
  .ca-chat-room { grid-template-rows: fit-content(58%) minmax(0,1fr) auto; }
  .ca-room-summary { display: block; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; }
  .ca-chat-room > .ca-chat-stream { grid-row: 2; }
  .ca-chat-room > .ca-composer { grid-row: 3; }
  .player.at-table #toast { --toast-fallback: calc(100px + 1rem + env(safe-area-inset-bottom,0px)); }
  .player.at-table #main-content { padding-block: 0; }
  .player.at-table .top-inner { min-height: 40px; padding-block: 0; }
  .player.at-table #brand-link, .player.at-table .ca-header-link { min-height: 36px; }
  .player.at-table #brand-link img { width: 30px; height: 30px; }
  .ca-chat-heading { padding-block: 3px; }
  .ca-chat-heading h1 { font-size: 1.05rem; }
  .ca-room-picker { min-height: 32px; padding-block: 3px; }
  .ca-chat-stats { padding-block: 2px 6px; }
  .ca-room-summary > .ca-draw { width: 100%; padding-block: 4px; }
  .ca-chat-room .ca-draw .ca-ball { width: 22px; height: 22px; }
  .ca-chat-stream { padding-block: 8px; }
  .ca-composer { padding-block: 4px; }
  .ca-composer input, .ca-composer button { min-height: 38px; padding-block: 5px; }
  .player.at-table #bottom-nav:not(:empty) { padding-top: 2px; padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px)); }
  .player.at-table #bottom-nav > :is(a,button) { min-height: 36px; flex-direction: row; gap: 4px; }
}
@media (max-height: 420px) and (max-width: 649px) {
  /* Leave space for conversation while a phone keyboard is open. Blurring the
     composer or restoring the viewport brings the last draw back immediately. */
  .ca-chat-room:has(#ca-command:focus) .ca-room-summary > .ca-draw { display: none; }
  .player.at-table:has(#ca-command:focus) .masthead:has(#android-download:not([hidden])) { display:none; }
}
