:root { color-scheme: dark; background: #020b10; }
.feeding-controls { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 8px; padding-top: 10px; pointer-events: auto; font: 13px/1.6 system-ui, sans-serif; }
.debug-menu { flex-shrink: 0; margin-top: 8px; color: #a5bab1; font-size: 12px; pointer-events: auto; }
.debug-menu summary { width: fit-content; padding: 6px 0; cursor: pointer; }
.debug-reset-hunger { min-height: 44px; padding: 8px 12px; color: inherit; font: inherit; background: #182d2b80; border: 1px solid #ffffff30; border-radius: 8px; cursor: pointer; }
.debug-reset-hunger:disabled { opacity: .5; cursor: wait; }
.debug-status { margin: 6px 0; }
#feed-button { min-height: 22px; padding: 2px 8px; border-radius: 999px; border: 1px solid #ffffff30; background: #182d2b80; color: inherit; font: inherit; font-size: 11px; line-height: 16px; cursor: pointer; }
#feed-button:hover:not(:disabled) { background: #ffffff12; border-color: #c6d9ad; }
#feed-button:focus-visible { outline: 2px solid #c6d9ad; outline-offset: 3px; }
#feed-button:disabled { opacity: .55; cursor: wait; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: #020b10; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; outline: none; }
noscript, .fallback { position: absolute; inset: 0; display: grid; place-content: center; padding: 2rem; color: #9cbfc2; font: 14px/1.9 system-ui, sans-serif; text-align: center; }
@media (pointer: coarse) { canvas { cursor: default; } }

[hidden] { display: none !important; }
.model-loading { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #020b10; color: #98e9df; font: 12px/1.5 system-ui, sans-serif; letter-spacing: .24em; cursor: wait; }
.loading-spinner { width: 36px; height: 36px; border: 2px solid #98e9df26; border-top-color: #98e9df; border-radius: 50%; animation: loading-spin 1s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation-duration: 3s; } }
.betta-chat { position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 10; color: #e2eee9; font: 14px/1.8 system-ui, -apple-system, "Yu Gothic", sans-serif; pointer-events: none; text-shadow: 0 1px 5px #000c; }
.chat-panel { width: min(360px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; background: transparent; }
.chat-conversation { min-height: 0; max-height: min(360px, 45dvh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; pointer-events: auto; }
.chat-log { display: flex; flex-direction: column; gap: 16px; padding: 8px 4px 18px; }
.chat-log:empty { display: none; }
.chat-message { max-width: 90%; align-self: flex-start; }
.chat-message.user { align-self: flex-end; color: #b8cec5; }
.chat-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; background: rgb(24 45 43 / 30%); border: 1px solid #ffffff0a; border-radius: 2px 15px 15px; padding: 10px 14px; }
.chat-message.user p { background: rgb(41 56 46 / 30%); border-radius: 15px 2px 15px 15px; }
.chat-status { margin: 0 4px 10px; font-size: 11px; color: #d7d5bf; overflow-wrap: anywhere; pointer-events: auto; }
.chat-form { pointer-events: auto; }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 0; border-bottom: 1px solid #ffffff40; background: transparent; }
.betta-chat textarea { flex: 1; min-width: 0; width: 100%; resize: none; color: inherit; font: inherit; line-height: 1.8; border: 0; border-radius: 0; background: transparent; padding: 4px; text-shadow: inherit; }
.betta-chat textarea::placeholder { color: #a5bab1; }
.betta-chat :focus-visible { outline: 1px solid #c6d9ad; outline-offset: 3px; }
.chat-send { flex-shrink: 0; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: 24px/1 system-ui, sans-serif; text-shadow: inherit; cursor: pointer; }
.chat-send:hover { background: #ffffff12; }
.chat-send:disabled { opacity: .4; cursor: wait; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 520px) {
  .betta-chat { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .chat-panel { width: calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))); max-height: calc(100dvh - 32px); }
  .betta-chat textarea { font-size: 16px; }
}

.betta-game-state { position: fixed; left: max(24px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 10; color: #e2eee9; font: 13px/1.6 system-ui, -apple-system, "Yu Gothic", sans-serif; pointer-events: none; text-shadow: 0 1px 5px #000c; }
.game-state-panel { width: min(280px, calc(100vw - 48px)); background: rgb(24 45 43 / 40%); border: 1px solid #ffffff15; border-radius: 8px; backdrop-filter: blur(8px); pointer-events: auto; }
.game-state-toggle { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; color: #98e9df; font-weight: 600; user-select: none; }
.game-state-toggle::-webkit-details-marker { display: none; }
.game-state-toggle::before { content: '▼'; font-size: 10px; transition: transform 0.2s; display: inline-block; }
.game-state-panel[open] .game-state-toggle::before { transform: rotate(-90deg); }
.game-state-content { padding: 0 12px 12px; }
.stat-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.stat-label { width: 48px; flex-shrink: 0; font-size: 12px; color: #b8cec5; }
.stat-bar { flex: 1; height: 8px; background: #ffffff10; border-radius: 4px; overflow: hidden; position: relative; }
.stat-fill { height: 100%; width: 0%; border-radius: 4px; transition: width 0.5s ease, background-color 0.3s ease; }
.stat-value { width: 36px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: #98e9df; }
@media (max-width: 520px) {
  .betta-game-state { left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .game-state-panel { width: calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))); }
}
