/* Local palette and game components; deliberately not part of CBL-01. */
#curse-room-game {
  --crg-paper:#fffdf8; --crg-ink:#183f48; --crg-line:#9fc4ca;
  --crg-muted:#46585c; --crg-blue:#e0edf4; --crg-green:#e7efdf;
  --crg-purple:#ece2f3; --crg-gold:#f8edcf; --crg-red:#f6e2df;
  --crg-actor-height:64px;
  color:var(--crg-ink); background:var(--crg-paper); min-width:0;
  border:1px solid var(--crg-line); border-radius:12px;
  font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
#curse-room-game * { box-sizing:border-box; }
#curse-room-game .rd-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px; margin:0; padding:16px 20px; border-bottom:1px solid var(--crg-line); }
#curse-room-game .rd-title-group { flex:1 1 440px; min-width:0; }
#curse-room-game .rd-head h2 { margin:8px 0 0; color:var(--crg-ink); font:700 clamp(1.5rem,2.3vw,2rem)/1.25 Georgia,"Times New Roman",serif; }
#curse-room-game .three-body-subtitle { max-width:115ch; margin:6px 0 0; color:var(--crg-muted); font:14px/1.45 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
#curse-room-game .game-head-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
#curse-room-game .round { font-size:15px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
#curse-room-game .three-body-reading { padding:16px; scrollbar-gutter:stable; min-width:0; }
#curse-room-game .pixel-icon { display:inline-block; width:16px; height:16px; flex:0 0 16px; vertical-align:-3px; pointer-events:none; }
#curse-room-game .pixel-icon svg { display:block; width:100%; height:100%; image-rendering:pixelated; shape-rendering:crispEdges; }
#curse-room-game .avatar .pixel-icon { width:20px; height:20px; }
#curse-room-game .token .pixel-icon { width:12px; height:12px; flex-basis:12px; }
#curse-room-game .world { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0 0 10px; align-items:stretch; }
#curse-room-game .room { min-width:0; padding:7px; border:1px solid var(--crg-line); border-radius:10px; display:flex; flex-direction:column; }
#curse-room-game .bar-room { background:#f6eddf; }
#curse-room-game .meadow-room { background:#edf0df; }
#curse-room-game .forest-room { background:#e2ede5; }
#curse-room-game .room.threat { border-color:#ab5a50; box-shadow:inset 0 0 0 1px #ab5a50; }
#curse-room-game .room-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:4px; margin:0 0 5px; font-size:13px; font-weight:700; line-height:1.3; }
#curse-room-game .actors { display:grid; grid-auto-rows:minmax(var(--crg-actor-height),auto); gap:5px; align-content:start; min-height:calc(3 * var(--crg-actor-height) + 10px); }
#curse-room-game .actor { display:flex; flex-direction:column; gap:2px; width:100%; min-width:0; margin:0; padding:5px; border:1px solid #a9bab4; border-radius:8px; background:var(--crg-paper); color:var(--crg-ink); text-align:left; font:inherit; cursor:pointer; box-shadow:none; transition:none; }
#curse-room-game .actor:hover { border-color:#216b78; background:#f5faf8; }
#curse-room-game .actor.selected { border-color:#183f48; box-shadow:inset 0 0 0 1px #183f48; background:#f2f8f6; }
#curse-room-game .actor.enemy-active { border-color:#ab5a50; background:#fff6f3; }
#curse-room-game .actor.dead { background:#edf0ed; }
#curse-room-game .actor-heading { display:flex; flex-wrap:wrap; align-items:center; gap:3px 6px; min-width:0; }
#curse-room-game .actor-identity { display:inline-flex; align-items:center; gap:4px; white-space:nowrap; }
#curse-room-game .identity-chips { display:inline-flex; align-items:center; gap:3px; }
#curse-room-game .identity-chips > .token:first-child { min-width:72px; }
#curse-room-game .avatar { display:grid; place-items:center; width:20px; height:20px; flex:0 0 20px; }
#curse-room-game .actor-title { font-size:12px; line-height:1.25; font-weight:700; overflow-wrap:anywhere; }
#curse-room-game .actor-heading .token { flex-shrink:0; white-space:nowrap; }
#curse-room-game .actor-heading .actor-title { white-space:nowrap; }
#curse-room-game .tokens { display:flex; flex-wrap:wrap; align-content:flex-start; gap:2px; margin:0; min-width:0; }
#curse-room-game .token { display:inline-flex; align-items:center; gap:2px; min-height:16px; max-width:100%; padding:1px 4px; border:0; border-radius:5px; color:var(--crg-ink); background:#eef1ed; font:11px/1.25 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; overflow-wrap:anywhere; }
#curse-room-game .mind-bartender { background:#f6e7cf; }
#curse-room-game .mind-skeleton { background:#e8e7ef; }
#curse-room-game .mind-princess { background:#f5e1e8; }
#curse-room-game .life-token { justify-content:center; min-width:66px; white-space:nowrap; background:#e3eee8; font-variant-numeric:tabular-nums; }
#curse-room-game .life-token.life-inactive { color:var(--crg-muted); background:#e6e9e6; }
#curse-room-game .awake-token { background:var(--crg-green); }
#curse-room-game .sleep-token,#curse-room-game .curse-token { background:var(--crg-purple); }
#curse-room-game .waking-token,#curse-room-game .item-token { background:var(--crg-gold); }
#curse-room-game .carry-token { background:var(--crg-blue); }
#curse-room-game .death-token { background:var(--crg-red); }
#curse-room-game .inactive-token { background:#e6e9e6; }
#curse-room-game .floor-items { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:3px; min-height:16px; margin-top:5px; }
#curse-room-game .floor-item { display:flex; }
#curse-room-game .status { display:block; width:100%; min-height:0; margin:0 0 10px; padding:8px 10px; border:1px solid var(--crg-line); border-radius:9px; background:#f3f8f7; color:var(--crg-ink); font:13px/1.4 Georgia,"Times New Roman",serif; }
#curse-room-game .status.danger { background:#fff3ee; border-color:#c28a7b; }
#curse-room-game .status.magic { background:#f3edf8; border-color:#b9a3cd; }
#curse-room-game .status.success { background:#edf5e8; border-color:#a5b99a; }
#curse-room-game .outcome { margin:0 0 10px; padding:10px; border:1px solid var(--crg-line); border-radius:9px; background:#f3f8f7; color:var(--crg-ink); }
#curse-room-game .outcome[hidden] { display:none; }
#curse-room-game .outcome.victory { border-color:#91ad80; background:#edf5e8; }
#curse-room-game .outcome.loss { border-color:#c28a7b; background:#fff3ee; }
#curse-room-game .outcome h3 { margin:0; font:700 16px/1.35 Georgia,"Times New Roman",serif; }
#curse-room-game .outcome p { margin:4px 0 8px; font:14px/1.45 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
#curse-room-game .outcome ul { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin:8px 0 0; padding:0; list-style:none; }
#curse-room-game .outcome li { display:grid; gap:2px; min-width:0; padding:6px 7px; border:1px solid color-mix(in srgb,var(--crg-line) 70%,transparent); border-radius:7px; background:var(--crg-paper); font:12px/1.35 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
#curse-room-game .outcome li span { overflow-wrap:anywhere; }
#curse-room-game .outcome-identity,#curse-room-game .outcome-mind { display:flex; flex-wrap:wrap; align-items:center; gap:4px; }
#curse-room-game .command-panel { display:grid; grid-template-columns:minmax(0,.95fr) minmax(0,1fr) minmax(0,1.2fr); gap:8px; margin:0; padding:8px; border:1px solid var(--crg-line); border-radius:10px; background:var(--crg-paper); box-shadow:none; }
#curse-room-game .panel-section { min-width:0; padding:0; }
#curse-room-game .panel-section:first-child { position:relative; }
#curse-room-game .selected-actions { position:absolute; top:0; right:0; display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:8px; }
#curse-room-game .panel-section + .panel-section { padding-left:10px; border-left:1px solid var(--crg-line); }
#curse-room-game .command-panel .panel-title { margin:0 0 6px; color:var(--crg-ink); font:700 15px/1.3 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
#curse-room-game .selected-summary { display:grid; grid-template-columns:minmax(0,1fr); align-items:start; gap:4px; }
#curse-room-game .selected-portrait .pixel-icon { width:22px; height:22px; }
#curse-room-game .selected-name { display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:13px; font-weight:700; }
#curse-room-game .selected-summary .tokens { grid-column:1 / -1; }
#curse-room-game .command-grid,#curse-room-game .direct-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; }
#curse-room-game .btn { display:inline-flex; align-items:center; justify-content:center; gap:5px; min-width:0; min-height:34px; max-width:100%; margin:0; padding:5px 7px; border:1px solid var(--crg-line); border-radius:10px; background:var(--crg-paper); color:#16525d; font:600 13px/1.35 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; text-align:center; white-space:normal; overflow-wrap:anywhere; cursor:pointer; box-shadow:none; }
#curse-room-game .btn-primary { background:#dcecee; }
#curse-room-game .btn:hover:not(:disabled) { color:var(--crg-paper); background:#183f48; border-color:#183f48; }
#curse-room-game .btn:disabled { opacity:1; color:#647478; border-color:#d4dedb; background:#f0f2ee; cursor:not-allowed; }
#curse-room-game :is(button,summary):focus-visible { outline:3px solid #216b78; outline-offset:3px; }
#curse-room-game .direct-actions .btn { justify-content:flex-start; text-align:left; }
#curse-room-game .direct-actions .btn span:last-child { min-width:0; white-space:normal; overflow-wrap:anywhere; }
#curse-room-game .action-empty { grid-column:1 / -1; color:var(--crg-muted); font-size:14px; line-height:1.5; }
#curse-room-game .rules { max-width:76ch; margin:12px auto 0; border:0; border-top:1px solid var(--crg-line); padding:8px 0 0; color:var(--crg-muted); background:transparent; font-size:13px; line-height:1.5; }
#curse-room-game .rules summary { color:#16525d; cursor:pointer; font-weight:700; }
#curse-room-game .legend { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 20px; margin-top:10px; }
#curse-room-game .legend > span { display:block; padding:8px 0; border-bottom:1px solid #d9e3dd; }
@media screen and (min-width:950px) {
  #curse-room-game .three-body-reading {
    display:grid;
    grid-template-columns:minmax(0,min(1000px,calc(57% - 8px))) minmax(0,min(750px,calc(43% - 6px)));
    grid-template-rows:max-content max-content max-content auto;
    grid-template-areas:"status status" "outcome outcome" "world controls" "rules rules";
    column-gap:14px;
    row-gap:8px;
    align-content:start;
    max-width:100%;
  }
  #curse-room-game .world { grid-area:world; max-width:1000px; margin:0; }
  #curse-room-game .status { grid-area:status; max-width:1764px; margin:0; }
  #curse-room-game .outcome { grid-area:outcome; max-width:1764px; margin:0; }
  #curse-room-game .command-panel {
    grid-area:controls;
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-self:start;
    max-width:750px;
  }
  #curse-room-game .command-panel .panel-section:first-child { grid-column:1 / -1; }
  #curse-room-game .command-panel .panel-section + .panel-section { padding-left:0; border-left:0; border-top:1px solid var(--crg-line); padding-top:8px; }
  #curse-room-game .command-panel .panel-context { grid-column:2; }
  #curse-room-game .rules { grid-area:rules; justify-self:start; width:min(100%,76ch); margin:0; }
}
@media screen and (min-width:851px) and (min-height:651px) {
  body[data-route="three-body"] :is(.app-shell,.workspace,#routeContent) { min-height:0; }
  body[data-route="three-body"] .app-shell { height:100dvh; overflow:clip; }
  body[data-route="three-body"] .workspace { height:calc(100dvh - var(--topbar-h,72px)); padding-top:16px; padding-bottom:16px; overflow:clip; }
  body[data-route="three-body"] #routeContent { display:block; height:100%; min-height:0; margin:0; padding:0; }
  #curse-room-game { height:100%; display:flex; flex-direction:column; overflow:hidden; }
  #curse-room-game > .rd-head { flex:none; }
  #curse-room-game .three-body-reading { flex:1 1 0; overflow:auto; min-height:0; }
}
@media (max-width:1050px) {
  #curse-room-game { --crg-actor-height:64px; }
  #curse-room-game .command-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #curse-room-game .panel-context { grid-column:1 / -1; border-left:0; border-top:1px solid var(--crg-line); padding:8px 0 0; }
}
@media (min-width:950px) and (max-width:1199px) {
  #curse-room-game .three-body-reading { grid-template-columns:minmax(576px,1.6fr) minmax(0,1fr); }
  #curse-room-game .command-grid,#curse-room-game .direct-actions { grid-template-columns:1fr; }
}
@media (max-width:700px) {
  #curse-room-game .three-body-reading { padding:16px; }
  #curse-room-game .world { grid-template-columns:1fr; }
  #curse-room-game .actors { min-height:0; grid-auto-rows:minmax(var(--crg-actor-height),auto); }
  #curse-room-game .legend { grid-template-columns:1fr; }
  #curse-room-game .outcome ul { grid-template-columns:1fr; }
}
@media (max-width:600px) {
  #curse-room-game .rd-head { padding:16px; }
}
@media (max-width:520px) {
  #curse-room-game .command-panel { grid-template-columns:1fr; padding:12px; }
  #curse-room-game .panel-section + .panel-section { grid-column:auto; border-left:0; border-top:1px solid var(--crg-line); padding:8px 0 0; }
  #curse-room-game .selected-actions { position:static; margin:0 0 6px; }
}
@media (pointer:coarse) {
  #curse-room-game .btn { min-height:44px; }
}
@media print {
  #curse-room-game { height:auto; overflow:visible; }
  #curse-room-game .three-body-reading { overflow:visible; }
  #curse-room-game :is(.game-head-actions,.command-panel) { display:none; }
}
