.sketch-viewer { border: 1px solid var(--game-border); background: var(--game-surface); color: var(--game-text); }
.sketch-viewer [hidden] { display: none !important; }
.sketch-viewer button, .sketch-viewer select { min-height: 44px; font: inherit; font-size: 14px; color: var(--game-heading); }
.sketch-viewer button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid transparent; border-radius: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.sketch-viewer button:hover:not(:disabled), .sketch-viewer button[aria-pressed="true"] { color: var(--game-link); background: var(--game-tint); }
.sketch-viewer button:disabled, .sketch-viewer select:disabled { opacity: .45; cursor: default; }
.sketch-viewer button:focus-visible, .sketch-viewer select:focus-visible, .sketch-viewer canvas:focus-visible { outline: 2px solid var(--game-link); outline-offset: -3px; }
.viewer-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; padding: 6px 10px; border-bottom: 1px solid var(--game-border); }
.viewer-scenes, .viewer-tools { display: flex; align-items: center; gap: 2px; }
.viewer-scenes button[aria-pressed="true"] { box-shadow: inset 0 -2px var(--game-link); }
.viewer-tools button { color: var(--game-text); }
.viewer-tools svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.viewer-weather { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.viewer-weather label { font-size: 13px; }
.viewer-weather select { min-width: 120px; padding: 6px 26px 6px 10px; border: 1px solid var(--game-border); border-radius: 0; background: var(--game-surface); }
.viewer-stage { position: relative; isolation: isolate; overflow: hidden; background: #eeeae1; }
.viewer-stage::after { content: ''; position: absolute; inset: 0; z-index: 1; background: #f4f2ed38; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.sketch-canvas { width: 100%; min-height: 440px; height: min(48vw, 580px); overflow: hidden; transition: filter .25s ease, opacity .25s ease; }
.sketch-canvas canvas, .inspection-canvas canvas { display: block; width: 100%; height: 100%; outline: none; }
.sketch-canvas canvas { touch-action: pan-y; }
.inspection-canvas { position: absolute; inset: 0; z-index: 2; background: transparent; }
.inspection-canvas canvas { background: transparent; touch-action: none; }
.is-inspecting .sketch-canvas { filter: blur(8px) brightness(.94); opacity: .62; pointer-events: none; }
.is-inspecting .viewer-stage::after { opacity: 1; }
.viewer-message { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px; text-align: center; background: #f4f1e9; color: #595959; }
.viewer-message p { margin: 0; font-size: 23px; line-height: 1.2; color: #043361; }
.viewer-message-note { font-size: 14px; }
.viewer-message button { margin-top: 4px; border-color: #043361; color: #043361; }
.viewer-loading-mark { width: 24px; height: 24px; border: 1px solid #04336135; border-top-color: #043361; border-radius: 50%; animation: viewer-loading 1.2s linear infinite; }
#viewer-progress { width: 150px; height: 3px; border: 0; accent-color: #043361; }
#viewer-progress::-webkit-progress-bar { background: #0433611a; }
#viewer-progress::-webkit-progress-value { background: #043361; }
.viewer-inspector { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--game-border); }
.viewer-inspector:not(:has(#desk-objects:not([hidden]))):not(:has(#selection-panel:not([hidden]))) { display: none; }
.desk-objects { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.desk-objects button { padding: 7px 10px; border-color: var(--game-border); font-size: 13px; }
.desk-objects button[aria-pressed="true"] { border-color: var(--game-link); }
.selection-panel { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; width: 100%; min-width: 0; }
#selected-name { font-size: 17px; font-weight: 500; color: var(--game-heading); overflow-wrap: anywhere; }
.selection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.selection-actions button { padding: 8px 12px; }
#explode-object { border-color: var(--game-border); }
.viewer-notes { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 20px; padding: 10px 16px 12px; border-top: 1px solid var(--game-border); }
.viewer-notes p { margin: 0; color: var(--game-text); font-size: 12px; line-height: 1.5; }
#viewer-status { text-align: right; color: var(--game-heading); }
.viewer-noscript { margin: 0; padding: 16px; border-top: 1px solid var(--game-border); }
.sketch-viewer:fullscreen { display: flex; flex-direction: column; width: 100%; height: 100%; border: 0; padding: max(0px, env(safe-area-inset-top)) max(0px, env(safe-area-inset-right)) max(0px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left)); }
.sketch-viewer:fullscreen .viewer-stage { flex: 1; min-height: 0; }
.sketch-viewer:fullscreen .sketch-canvas { height: 100%; min-height: 0; }
.sketch-viewer:fullscreen .viewer-toolbar, .sketch-viewer:fullscreen .viewer-inspector, .sketch-viewer:fullscreen .viewer-notes { flex-shrink: 0; }
@keyframes viewer-loading { to { transform: rotate(360deg); } }
@media (max-width: 700px) {
  .viewer-toolbar { gap: 3px 8px; padding: 5px 8px; }
  .viewer-scenes { flex: 1; }
  .viewer-scenes button { padding: 8px 10px; }
  .viewer-tools button { min-width: 44px; padding: 8px; }
  .viewer-tools #viewer-fullscreen span { display: none; }
  .viewer-weather { order: 3; flex-basis: 100%; justify-content: flex-end; margin: 2px 0 0; padding: 5px 2px 0; border-top: 1px solid var(--game-border); }
  .viewer-weather select { min-width: 112px; font-size: 13px; }
  .sketch-canvas { min-height: 280px; height: clamp(280px, 82vw, 360px); }
  .viewer-inspector { padding: 10px 12px; }
  .desk-objects { gap: 5px; }
  .desk-objects button { padding: 7px 9px; }
  .selection-panel { gap: 8px; }
  #selected-name { width: 100%; }
  .selection-actions { width: 100%; justify-content: space-between; }
  .selection-actions button { padding: 8px 10px; font-size: 13px; }
  .viewer-notes { display: block; padding: 10px 12px; }
  #viewer-status { text-align: left; margin-top: 5px; }
  .sketch-viewer:fullscreen .viewer-notes { display: none; }
}
@media (prefers-color-scheme: dark) {
  .games-auto-dark .is-inspecting .sketch-canvas { filter: blur(8px) brightness(.65); opacity: .72; }
  .games-auto-dark .viewer-stage::after { background: #15212f30; }
}
@media (prefers-reduced-motion: reduce) {
  .viewer-loading-mark { animation: none; }
  .sketch-canvas, .viewer-stage::after { transition: none; }
}
