/* Mobile first: the door, reply and composer share one visual viewport. */
html,body { height:var(--app-height,100dvh);overscroll-behavior:none; }body { background:var(--bg); }
.app-header { height:56px;padding:0 20px;gap:16px;border-bottom:1px solid var(--border);background:var(--bg); }
.brand { font-size:25px;letter-spacing:-1.3px;gap:7px; }.brand>span { display:inline; }.brand .guardian-glyph { width:27px;height:27px; }
.keeper-case { fill:var(--text);stroke:var(--text);stroke-width:2; }.keeper-door { fill:var(--text);stroke:none; }.keeper-eyes { stroke:var(--bg);stroke-width:5;animation:none; }.keeper-mouth,.keeper-hinge { display:none; }
.header-start { gap:20px; }.header-actions { gap:3px;flex-shrink:0; }.header-actions .icon-button { width:40px;height:42px; }.header-actions .toolbar-button { min-height:42px; }
#account-button { white-space:nowrap;font-size:12px;color:var(--text);padding:8px 13px;border:1px solid var(--border);border-radius:8px;min-height:36px; }
:root[data-access='public-practice'] #treasury-button { display:none; }
.workspace { height:calc(var(--app-height,100dvh) - 56px);overflow:hidden; }.chat-main { min-height:0; }.session-bar { height:38px;padding:0 22px;gap:8px; }.session-status { gap:7px;font-size:12px; }
.session-bar .text-button { min-height:36px;font-size:12px; }
.conversation-area,.chat-main[data-empty='true'] .conversation-area { display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;align-content:stretch;justify-content:stretch;gap:12px;min-height:0;width:min(1040px,100%);margin:0 auto;padding:6px 20px 0;overflow:hidden; }
.guardian-stage { display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;width:100%;height:100%;min-height:0; }

.guardian-scene { display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;align-items:center;gap:14px;min-height:0;height:100%;width:min(460px,100%);margin:0 auto; }
.guardian-character { position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:0;container-type:size; }
.guardian-poke { position:relative;padding:0;width:min(290px,94cqw,96cqh);height:min(290px,94cqw,96cqh);flex-shrink:0;border-radius:11%;perspective:1100px;-webkit-tap-highlight-color:transparent; }
.guardian-poke:active:not(:disabled) { transform:none; }.guardian-poke:focus-visible { outline-offset:8px; }.guardian-poke:focus:not(:focus-visible) { outline:none; }
.guardian-bubble { position:relative;width:100%;min-width:0;border:0;border-top:1px solid var(--border);background:none;border-radius:0;padding:13px 0 0; }
.guardian-byline { display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:12px;margin-bottom:7px;font-size:12px;line-height:1.4;color:var(--subtle); }
#guardian-source { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }#guardian-expression { display:none; }
#guardian-line { height:69px;margin:0;font-size:16px;line-height:23px;letter-spacing:-.15px;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap; }
.guardian-stage[data-state='thinking'] #guardian-line { color:var(--muted); }
.guardian-bubble-actions { display:flex;align-items:center;gap:16px;padding-top:4px; }.guardian-bubble-actions button { min-height:32px;font-size:12px;padding:4px 0; }.guardian-bubble-actions .share-button { margin-left:auto;color:var(--accent); }
.last-prompt { display:none; }
.guardian-controls { display:flex;justify-content:center;align-items:center;gap:18px;min-height:34px; }.guardian-controls .text-button { min-height:34px;font-size:12px; }#transcript-count { font:12px var(--mono);color:var(--text);padding:2px 5px;border-radius:4px;background:var(--soft); }
.composer-wrap { width:min(640px,100%);margin:0 auto; }.composer { margin:0;border:1px solid var(--border);border-radius:12px;background:var(--surface);padding:13px 13px 10px;box-shadow:none; }.composer:focus-within { border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 9%,transparent); }
.composer textarea { height:48px;min-height:48px;max-height:48px;width:100%;font-size:16px;line-height:24px;resize:none;padding:0;border:0;background:transparent;outline:none;scrollbar-width:thin; }.composer textarea:focus-visible { outline:none; }.composer textarea::placeholder { color:var(--subtle); }
.composer-actions { display:flex;align-items:center;justify-content:space-between;gap:10px;height:42px;margin-top:5px; }.model-button { display:flex;align-items:center;gap:6px;min-width:0;max-width:calc(100% - 86px);min-height:40px;padding:5px 8px;border:0;border-radius:4px;background:transparent;font-size:12px;text-align:left; }.model-mark { display:grid;place-items:center;width:18px;height:20px;padding:0;font-size:12px;border-radius:4px;background:none;color:var(--muted); }.model-button svg { width:14px;height:14px; }.send-area { display:flex;align-items:center;gap:12px;flex-shrink:0; }.composer-context { font-size:12px;color:var(--muted);white-space:nowrap; }.send-button { width:42px;height:42px;border-radius:50%;background:var(--button);color:var(--button-text); }.send-button:disabled { background:var(--soft);color:var(--subtle); }.send-button svg { width:20px;height:20px; }.send-button:hover:not(:disabled) { transform:translateY(-1px); }
.suggestions { display:none; }.composer-footnote { display:flex;flex-wrap:nowrap;align-items:center;justify-content:center;min-height:24px;padding:4px 0 0;gap:5px;font-size:12px; }.composer-footnote .text-button { font-size:12px;padding:0;min-height:20px; }#connection-label { min-width:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap; }.keyboard-hint { display:none; }
#notice { position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }.end-actions { margin:7px 0 0;align-items:center;gap:10px; }.end-actions .download-button { padding:8px 12px;font-size:12px; }.end-actions span { font-size:12px; }

.settings-panel { box-shadow:none;top:56px; }.transcript-dialog { width:780px; }.transcript-dialog .chat-thread { display:block;max-height:61dvh;padding:12px 8px;scroll-behavior:auto; }.transcript-dialog .scroll-latest { position:sticky;bottom:0;left:50%; }#transcript-status:empty { display:none; }
dialog { max-height:calc(var(--app-height,100dvh) - 24px);box-shadow:var(--shadow-2); }dialog::backdrop { background:color-mix(in srgb,var(--ink) 70%,transparent);backdrop-filter:blur(5px); }.models-dialog { width:540px; }.model-option { min-height:60px; }
@media(min-width:761px) {
 .app-header { padding:0 36px;height:68px; }.workspace { height:calc(var(--app-height,100dvh) - 68px); }.session-bar { height:46px;padding:0 36px; }.session-status { font-size:12px; }.header-actions { gap:7px; }
 .conversation-area,.chat-main[data-empty='true'] .conversation-area { padding:12px 40px 6px;gap:16px; }.guardian-stage { gap:18px; }
 .guardian-scene { width:100%;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:48px; }.guardian-poke { width:min(330px,92cqw,94cqh);height:min(330px,92cqw,94cqh); }.guardian-bubble { padding:24px 0 0; }.guardian-byline { font-size:12px;margin-bottom:14px; }#guardian-line { height:124px;font-size:22px;line-height:31px; }.guardian-bubble-actions { margin-top:12px; }.guardian-bubble-actions button { min-height:36px;font-size:12px; }.guardian-controls { gap:24px; }.composer textarea { height:48px;max-height:48px; }.model-button { font-size:12px; }.settings-panel { top:68px; }
}
@media(max-width:760px) {
 #models-dialog { margin:auto 8px max(8px,env(safe-area-inset-bottom));width:calc(100% - 16px);max-width:none;border-radius:20px 20px 12px 12px;padding:22px 18px; }.models-list { max-height:min(46dvh,340px); }.dialog-heading p { font-size:12px; }.model-option { padding:14px 10px; }.model-price { font-size:12px; }
 .settings-panel { height:calc(var(--app-height,100dvh) - 56px); }.toolbar-button span { display:none; }.composer-context { display:none; }
 .model-search,.treasury-dialog input,.treasury-dialog select { font-size:16px; }
}
@media(max-width:370px) { .app-header { padding-inline:14px; }.conversation-area,.chat-main[data-empty='true'] .conversation-area { padding-inline:15px; }.session-bar { padding-inline:16px; }.header-actions .icon-button { width:36px; }.model-button { max-width:calc(100% - 56px); } }
@media(max-height:740px) and (max-width:760px) {
 .guardian-stage { gap:6px; }.guardian-scene { gap:9px; }.guardian-bubble { padding-top:9px; }#guardian-line { height:60px;font-size:16px;line-height:20px; }.guardian-bubble-actions { padding-top:2px; }.guardian-bubble-actions button { min-height:30px; }.conversation-area,.chat-main[data-empty='true'] .conversation-area { gap:7px; }.composer { padding:10px 12px 8px; }.composer textarea { height:40px;min-height:40px;max-height:40px;line-height:20px; }
}
@media(max-height:640px) and (min-width:761px) {
.guardian-stage { gap:8px; }#guardian-line { height:90px;font-size:19px;line-height:30px; }.guardian-bubble { padding-top:12px; }.guardian-bubble-actions { margin-top:4px; }
}
@media(max-height:680px) and (max-width:760px) {

 .chat-main[data-empty='false'] .guardian-stage { grid-template-rows:minmax(0,1fr) auto; }
 .guardian-bubble { display:grid;grid-template-columns:1fr auto;column-gap:12px; }
 .guardian-byline,#guardian-line { grid-column:1 / -1; }
 .guardian-bubble-actions { grid-column:1;grid-row:3; }
 .guardian-bubble-actions #guardian-copy,.guardian-bubble-actions #guardian-share { display:none; }


 .guardian-bubble-actions button { min-height:36px; }
}

:root[data-compact='true'] .guardian-stage { grid-template-rows:minmax(0,1fr) auto;gap:0; }
:root[data-compact='true'] .guardian-scene { grid-template-columns:minmax(68px,.3fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:15px; }
:root[data-compact='true'] .guardian-bubble { border:0;padding:0; }
:root[data-compact='true'] #guardian-line { font-size:14px;height:60px;line-height:20px; }
:root[data-compact='true'] .guardian-bubble-actions { gap:12px;margin:0;padding:0; }
:root[data-compact='true'] .guardian-bubble-actions button { min-height:30px;font-size:12px; }
:root[data-compact='true'] .guardian-byline { margin-bottom:4px;font-size:12px; }
:root[data-compact='true'] .conversation-area { gap:5px;padding-top:0; }
:root[data-compact='true'] .guardian-controls { min-height:30px; }
:root[data-compact='true'] .composer textarea { height:32px;min-height:32px;max-height:32px; }
:root[data-compact='true'] .session-bar { height:30px; }

:root[data-compact='true'] .composer-footnote { min-height:20px;padding-top:2px; }
@media(max-height:420px) { :root[data-compact='true'] #guardian-line { height:40px; }.door-engraving { display:none; } }
@media(prefers-reduced-motion:reduce) { .door-leaf,.vault-face { transition:none!important;animation:none!important; } }

/* Keep connection failures actionable; healthy status needs no badge. */
.attempt-price { margin:6px 0 0;text-align:center;font-size:12px;line-height:1.4;color:var(--muted); }
.composer-footnote:has(#connection-label:empty):not(:has(button:not([hidden]))) { visibility:hidden; }
.guardian-controls { justify-content:flex-end; }

.app-header { border-bottom-color:transparent; }
#guardian-source { text-transform:none; }
.chat-main[data-empty='true'] .guardian-controls { display:none; }
.chat-main[data-empty='true'] .guardian-stage { grid-template-rows:auto minmax(0,1fr); }
.chat-main[data-empty='true'] #guardian-line { height:62px; }
@media(max-width:760px) { .chat-main[data-empty='true'] #guardian-line { height:46px; } }
:root[data-compact='true'] .chat-main[data-empty='true'] .guardian-stage { grid-template-rows:minmax(0,1fr); }

/* Once play starts, give the space back to the character and its reply. */

.chat-main[data-empty='false'] .guardian-stage { grid-template-rows:minmax(0,1fr) auto; }
.guardian-bubble { border:1px solid var(--border);background:var(--surface);border-radius:20px;padding:14px 16px;box-shadow:var(--shadow-1); }
.guardian-bubble:before { content:'';position:absolute;width:14px;height:14px;top:-8px;left:calc(50% - 7px);background:var(--surface);border-top:1px solid var(--border);border-left:1px solid var(--border);transform:rotate(45deg); }
.guardian-byline { margin-bottom:9px;padding-right:82px; }
#guardian-line { height:clamp(80px,15dvh,132px);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--border) transparent;scroll-behavior:auto;padding-right:5px; }
.chat-main[data-empty='true'] #guardian-line { height:46px; }
.guardian-bubble-actions { border-top:1px solid var(--border);margin-top:9px;padding-top:4px; }
#reply-reveal { position:absolute;top:8px;right:12px;font-size:12px;min-height:30px;color:var(--muted); }
.guardian-stage[data-delivering='true'] #guardian-line:after { content:'';display:inline-block;width:5px;height:1em;margin-left:3px;border-radius:4px;background:var(--muted);vertical-align:-2px;animation:pulse .7s infinite; }


@media(min-width:900px) {
 .guardian-bubble { padding:23px 24px;border-radius:20px; }
 .guardian-bubble:before { top:calc(50% - 7px);left:-8px;transform:rotate(-45deg); }
 #guardian-line { height:clamp(120px,23dvh,220px);font-size:20px;line-height:1.5; }
 .chat-main[data-empty='true'] #guardian-line { height:70px; }
}
@media(max-height:680px) and (max-width:760px) {
 .guardian-bubble { display:block;padding:10px 12px; }
 #guardian-line { height:70px;font-size:14px;line-height:20px; }
 .guardian-bubble-actions { margin-top:5px; }
}
:root[data-compact='true'] .guardian-bubble { padding:9px 12px;border:1px solid var(--border); }
:root[data-compact='true'] .guardian-bubble:before { top:25px;left:-8px;transform:rotate(-45deg); }
:root[data-compact='true'] .guardian-byline { padding-right:70px; }
@media(prefers-reduced-motion:reduce) { .guardian-stage[data-delivering='true'] #guardian-line:after { animation:none; } }


/* Let the vault and the example flow set the page height. Short viewports scroll. */
html,body { height:auto;min-height:100%;overscroll-behavior-y:auto; }
body { min-height:100dvh;overflow-x:hidden;overflow-y:auto; }
.workspace { height:auto;min-height:calc(100dvh - 56px);overflow:visible; }
.chat-main { min-height:calc(100dvh - 56px); }
.arena-bar,:root[data-compact='true'] .arena-bar { height:auto;min-height:88px;padding-block:12px; }
#live-bounty-value,:root[data-compact='true'] #live-bounty-value { font-size:clamp(30px,3.5vw,48px);letter-spacing:-.045em; }
.activity-rail { display:none; }
.conversation-area,.chat-main[data-empty='true'] .conversation-area,
:root[data-compact='true'] .conversation-area {
  display:flex;flex-direction:column;align-items:center;justify-content:flex-start;
  flex:1 0 auto;min-height:0;width:min(1180px,100%);margin:0 auto;
  padding:clamp(12px,2vh,28px) clamp(16px,4vw,48px) 24px;
  gap:clamp(18px,2.5vh,30px);overflow:visible;
}
.guardian-stage,.chat-main[data-empty='true'] .guardian-stage,
.chat-main[data-empty='false'] .guardian-stage,
:root[data-compact='true'] .guardian-stage,
:root[data-compact='true'] .chat-main[data-empty='true'] .guardian-stage {
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-auto-rows:max-content;
  justify-items:center;align-content:start;width:100%;height:auto;min-height:0;
  gap:clamp(12px,2vh,24px);
}

.guardian-scene,.chat-main[data-empty='true'] .guardian-scene,
:root[data-compact='true'] .guardian-scene {
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  width:100%;height:auto;min-height:0;margin:0;gap:18px;
}
.guardian-character {
  width:min(540px,calc(100% - 28px));max-width:none;height:auto;min-height:0;
  aspect-ratio:1;container-type:normal;flex:none;
}
.guardian-poke,.chat-main[data-empty='true'] .guardian-poke,
:root[data-compact='true'] .guardian-poke {
  display:block;width:100%;height:100%;max-width:none;min-width:0;min-height:0;
}
.chat-main[data-empty='true'] .guardian-bubble:has(#guardian-line:empty) { display:none; }
.guardian-bubble { width:min(100%,620px);height:auto; }
#guardian-line,.chat-main[data-empty='true'] #guardian-line,.chat-main[data-empty='false'] #guardian-line,
:root[data-compact='true'] #guardian-line,:root[data-compact='true'] .chat-main[data-empty='false'] #guardian-line {
  height:auto;min-height:0;max-height:none;overflow:visible;
}
.guardian-controls { width:100%;min-height:0; }
.composer-wrap { width:min(680px,100%); }
.composer textarea,:root[data-compact='true'] .composer textarea {
  height:auto;min-height:48px;max-height:160px;line-height:1.5;
}

.header-actions .icon-button,#account-button { min-width:44px;min-height:44px; }
.send-button { width:44px;height:44px; }

.chat-main[data-empty='false'] .guardian-bubble-actions,
:root[data-compact='true'] .chat-main[data-empty='false'] .guardian-bubble-actions {
  display:flex;flex-wrap:wrap;
}
.chat-main[data-empty='false'] .guardian-bubble-actions button { display:inline-flex;align-items:center;min-height:44px; }
.chat-main[data-empty='false'] .guardian-bubble-actions #guardian-copy,
.chat-main[data-empty='false'] .guardian-bubble-actions #guardian-share { display:inline-flex; }
:root[data-compact='true'] .composer { padding:10px 12px 8px; }

/* Wallet reviews need readable controls below the composer at every width. */
#conversation-wallet-actions,#conversation-exit-actions {
  flex-wrap:wrap;gap:8px;padding-top:8px;font-size:12px;line-height:1.4;
}
#conversation-wallet-actions label {
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:40px;font-size:12px;white-space:nowrap;
}
#conversation-amount {
  width:88px;min-height:40px;padding:7px 9px;border:1px solid var(--border);
  border-radius:8px;background:var(--surface);font-size:16px;
}
#conversation-wallet-actions .text-button,#conversation-exit-actions .text-button,#conversation-recover {
  justify-content:center;min-height:40px;padding:7px 10px;border:1px solid var(--border);
  border-radius:8px;background:var(--surface);color:var(--text);font-size:12px;
  line-height:1.3;text-align:center;text-decoration:none;white-space:normal;
}
#conversation-wallet-actions .text-button:hover:not(:disabled),
#conversation-exit-actions .text-button:hover:not(:disabled),#conversation-recover:hover:not(:disabled) {
  background:var(--soft);
}
#conversation-wallet-balances {
  flex-basis:100%;max-width:100%;text-align:center;overflow-wrap:anywhere;
}
#end-actions #continue-button { min-height:44px;font-size:12px; }
#end-actions span { font-size:12px;line-height:1.4; }
@media(max-width:480px) {
  #conversation-wallet-actions label { flex-basis:100%; }
  #conversation-wallet-actions .text-button,#conversation-exit-actions .text-button {
    flex:1 1 132px;
  }
}

@media (min-width:900px) {
  .chat-main[data-empty='false'] .guardian-scene {
    display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,.85fr);
    align-items:center;justify-items:center;gap:clamp(24px,5vw,72px);
  }
  .chat-main[data-empty='false'] .guardian-character { width:min(450px,100%); }
  .chat-main[data-empty='false'] .guardian-bubble { width:100%; }
}
@media (max-width:899px) {
  .chat-main[data-empty='false'] .guardian-scene {
    display:flex;flex-direction:column;gap:18px;
  }
  .chat-main[data-empty='false'] .guardian-character { width:min(420px,calc(100% - 28px)); }
}
@media (max-width:760px) {
  .workspace,.chat-main { min-height:calc(100dvh - 56px); }
  .guardian-character { width:min(420px,calc(100% - 28px)); }
  .conversation-area,.chat-main[data-empty='true'] .conversation-area,
  :root[data-compact='true'] .conversation-area { padding-inline:clamp(16px,5vw,28px); }
  .guardian-bubble { padding:14px 16px; }

}
@media (max-height:580px) {
  .guardian-stage,.chat-main[data-empty='true'] .guardian-stage { gap:12px; }
  .conversation-area,.chat-main[data-empty='true'] .conversation-area { padding-block:10px 16px; }
  .guardian-character { width:min(420px,calc(100% - 28px)); }
}
/* Dark room, one light on the vault. */
:root[data-theme='dark'] body { background:radial-gradient(ellipse 60% 55% at 50% 42%,var(--soft) 0%,var(--surface) 45%,var(--bg) 80%) fixed; }

/* Less to read in the game: the vault, the bounty and the composer carry the screen. */
.vault-demo .vault-demo-label { font-size:0; }.vault-demo .vault-demo-label>span { font-size:12px; }
.demo-caption,.keyboard-hint,#turn-label,#guardian-aside,#guardian-expression { display:none; }

/* E1c: until the player can send, the next step (approve → deposit → open) replaces the arrow, and the three steps
   with the attempt price take the place of the (disabled) guardian picker; on phones they drop to their own row. */
.next-step { height:42px;padding:0 16px;border-radius:21px;background:var(--button);color:var(--button-text);font-size:13px;font-weight:600;white-space:nowrap; }
.next-step:disabled { background:var(--soft);color:var(--subtle); }
.next-step:hover:not(:disabled) { transform:translateY(-1px); }
.composer-actions:has(#play-steps:not([hidden])) .model-button { display:none; }
.play-steps { display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;flex:1;min-width:0;margin:0;padding:0 4px;list-style:none;font-size:12px;line-height:1.4;color:var(--subtle); }
.play-steps li[data-state='done'] { color:var(--muted); }
.play-steps li[data-state='current'] { color:var(--text);font-weight:600; }

@media (max-width:640px) {
  .composer-actions:has(#play-steps:not([hidden])) { height:auto;flex-wrap:wrap;row-gap:8px;justify-content:flex-end; }
  .play-steps { order:3;flex-basis:100%;gap:4px 10px;padding:0; }
  .next-step { padding:0 14px; }
}
/* A saved action to recover: "Recover saved action" is the one primary button until it is cleared. */
#conversation-recover[data-primary='true']:not([hidden]) { min-height:44px;padding:9px 16px;border-color:var(--button);background:var(--button);color:var(--button-text);font-size:14px;font-weight:500; }
#conversation-recover[data-primary='true']:not([hidden]):hover:not(:disabled) { background:color-mix(in srgb,var(--button) 86%,var(--signal)); }
