:root { color-scheme: dark; font-family: system-ui, -apple-system, sans-serif; color: #eee5d0; background: #10141d; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: clamp(12px, 3vw, 36px); }
main { max-width: 1120px; margin: auto; }
.intro { margin: 8px 0 0; color: #b7bac8; font-size: .9rem; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: .85rem; }
.account-actions a { display: inline-flex; align-items: center; min-height: 44px; color: #ffd281; }
.account-actions span { overflow-wrap: anywhere; }
.account-actions button { font-size: inherit; }
.account-help { margin: 4px 0 12px; color: #b7bac8; font-size: .8rem; line-height: 1.7; overflow-wrap: anywhere; }
nav, .section-heading, .play-toolbar, .card-actions, footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
nav { margin: 22px 0; }
.section-heading { justify-content: space-between; margin: 20px 0 16px; }
h2 { margin: 0; font-size: 1.1rem; }
.notice, .error { font-size: .9rem; line-height: 1.7; overflow-wrap: anywhere; }
.error { color: #ffb6a5; }
.notice:empty { display: none; }
.game-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.game-card { min-width: 0; border: 1px solid #777687; background: #171927; }
.game-card > img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; }
.card-body { padding: 18px; }
.card-body h3 { margin: 0 0 8px; font-size: 1.1rem; }
.card-body p { margin: 8px 0 16px; line-height: 1.7; font-size: .9rem; overflow-wrap: anywhere; }
.card-meta { color: #b7bac8; }
.card-actions button { font-size: .85rem; }
.download-progress { margin: 10px 0 0; font-size: .85rem; }
.download-progress progress { display: block; width: 100%; height: 12px; margin-top: 8px; accent-color: #ffd281; }
.play-toolbar { margin-bottom: 16px; }
#save-status { color: #b7bac8; font-size: .85rem; }
footer { margin-top: 24px; border-top: 1px solid #777687; padding-top: 16px; color: #b7bac8; font-size: .8rem; line-height: 1.7; }
footer p { flex-basis: 100%; margin: 0; }
#orphan-saves { margin-top: 24px; }
#orphan-saves .card-actions { margin-top: 8px; }
#apply-update { margin-top: 20px; }
header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 16px; }
h1 { margin: 0; min-width: 0; max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 600; letter-spacing: -.04em; }
.card-body h3 { overflow-wrap: anywhere; }
header span, .settings { color: #b7bac8; font-size: .82rem; line-height: 1.8; }
.game { border: 1px solid #777687; background: #171927; }
.viewport { position: relative; }
canvas { display: block; width: 100%; height: auto; cursor: crosshair; image-rendering: pixelated; touch-action: pan-y; }
.scene-label { position: absolute; top: 12px; left: 14px; margin: 0; padding: 5px 9px; background: #10141deb; color: #eee5d0; font-size: .75rem; pointer-events: none; }
button, input, summary { font: inherit; }
button { min-height: 44px; padding: 9px 14px; border: 1px solid #858598; border-radius: 2px; background: #212436; color: #eee5d0; cursor: pointer; }
button:hover { background: #36374c; }
button:active { background: #454252; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 3px solid #ffd281; outline-offset: 3px; }
button[aria-pressed="true"] { color: #171927; background: #ffd281; border-color: #ffd281; }
.speech { position: absolute; z-index: 2; max-width: min(440px, calc(100% - 24px)); width: max-content; padding: 4px; transform: translate(-50%, -100%); border: 0; color: #fff; font-size: clamp(.9rem, 1.65vw, 1.15rem); font-weight: 700; line-height: 1.6; text-align: center; cursor: pointer; overflow-wrap: anywhere; text-shadow: -1px -1px #101018, 0 -1px #101018, 1px -1px #101018, -1px 0 #101018, 1px 0 #101018, -1px 1px #101018, 0 1px #101018, 1px 1px #101018; -webkit-text-stroke: 3px #101018; paint-order: stroke fill; }
.speech, .speech:hover, .speech:active { background: transparent; }
.speech { max-height: calc(100% - 20px); overflow-y: auto; }
.speech strong { display: block; font-size: .7rem; font-weight: 600; }
.speech[hidden], .loading[hidden] { display: none; }
.loading { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; background: #10141d; line-height: 1.8; }
.command { position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); color: #ffd281; font-size: 1rem; font-weight: 600; text-align: center; overflow-wrap: anywhere; pointer-events: none; text-shadow: -1px -1px #101018, 1px -1px #101018, -1px 1px #101018, 1px 1px #101018; }
.bottom { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; padding: 8px; border-top: 1px solid #777687; }
.verbs { display: grid; grid-template-columns: repeat(3, 5rem); grid-template-rows: repeat(3, auto); gap: 1px; }
.verbs button { display: grid; align-content: center; min-width: 0; min-height: 44px; text-align: left; padding: 4px 8px; border: 0; border-radius: 0; overflow-wrap: anywhere; }
.verbs b { font: bold 1.15rem ui-monospace, monospace; }
.inventory { --slot-size: 64px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 44px; grid-template-rows: calc(var(--slot-size) * 2 + 1px); align-content: center; gap: 4px; }
#inventory { display: grid; grid-template-columns: repeat(auto-fill, var(--slot-size)); grid-auto-rows: var(--slot-size); align-content: start; gap: 1px; overflow-y: auto; scrollbar-width: none; }
#inventory::-webkit-scrollbar { display: none; }
#inventory button, #inventory .empty-slot { display: grid; place-items: center; width: var(--slot-size); height: var(--slot-size); padding: 0; border: 1px solid #858598; border-radius: 0; }
#inventory .empty-slot { background: #212436; }
#inventory button:focus-visible { outline-offset: -3px; }
#inventory img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.inventory-scroll { display: grid; grid-template-rows: repeat(2, 1fr); gap: 1px; }
.inventory-scroll button { padding: 0; border: 0; border-radius: 0; }
.inventory-scroll button:disabled { cursor: default; }
.targets { border-top: 1px solid #777687; padding: 0 18px; }
summary { cursor: pointer; min-height: 44px; padding: 11px 0; font-size: .8rem; }
#targets { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 14px; }
#targets button { font-size: .8rem; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 4px 0; }
.controls label { display: flex; align-items: center; gap: 6px; }
input { width: 80px; min-height: 44px; padding: 8px; border: 1px solid #858598; border-radius: 2px; color: #eee5d0; background: #171927; }
.settings p { margin: 8px 0; }
#size-error { color: #ffb6a5; }
@media (max-width: 680px) {
  .bottom { gap: 8px; }
  .verbs { grid-template-columns: repeat(3, 44px); }
  .verbs button { padding: 4px 2px; }
  .verbs b { font-size: .8rem; }
  .inventory { --slot-size: 48px; }
  .command { bottom: 10px; font-size: .9rem; }
  .targets { padding: 0 12px; }
  .scene-label { top: 7px; left: 7px; font-size: .65rem; }
}
@media (max-width: 400px) {
  header span { font-size: .75rem; }
  .scene-label { max-width: calc(100% - 14px); font-size: .6rem; }
  .speech { font-size: .85rem; }
}
