/* Desktop-only layout: a full-height image viewer beside a fixed-width control sidebar. */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  font: 14px/1.4 system-ui, sans-serif; color: #e8e8e8; background: #1b1b1b;
}
header { display: flex; align-items: baseline; gap: 16px; padding: 8px 16px; border-bottom: 1px solid #333; }
header h1 { margin: 0; font-size: 18px; }
header h1 a { color: inherit; text-decoration: none; }
header h1 a:hover { text-decoration: underline; }
#status { margin: 0; color: #999; font-size: 12px; }
main { flex: 1; display: flex; min-height: 0; }

#viewer { position: relative; flex: 1; min-width: 0; overflow: hidden; background: rgb(30, 30, 30); }
#view { position: absolute; left: 0; top: 0; display: block; cursor: crosshair; touch-action: none; }
#view.dragging { cursor: grabbing; }
#busy {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: rgba(0, 0, 0, 0.75); border-radius: 6px; pointer-events: none;
}
#busy[hidden], #fatal[hidden], #start-choice[hidden] { display: none; }
#start-choice {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px 20px;
  background: rgba(0, 0, 0, 0.8); border: 1px solid #444; border-radius: 8px;
  pointer-events: none;
}
/* Only the buttons take the pointer, so the wheel and drags over the rest of the box still reach the image. */
#start-choice button { display: flex; flex-direction: column; gap: 4px; width: 300px; padding: 12px 14px;
  text-align: left; font-size: 15px; pointer-events: auto; }
#start-choice button span { color: #aaa; font-size: 12px; }
.spinner {
  width: 14px; height: 14px; border: 2px solid #888; border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#fatal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 32px;
  color: #ff8a80; background: rgba(0, 0, 0, 0.8); }

#sidebar { width: 360px; flex: none; overflow-y: auto; padding: 12px 16px; border-left: 1px solid #333;
  display: flex; flex-direction: column; gap: 14px; }
.controls { display: grid; grid-template-columns: 1fr; gap: 6px; }
label { display: flex; flex-direction: column; gap: 3px; }
label.checkbox { flex-direction: row; align-items: center; gap: 6px; }
select, input[type="text"], button {
  font: inherit; color: inherit; background: #2a2a2a; border: 1px solid #444; border-radius: 4px; padding: 4px 8px;
}
button { cursor: pointer; }
button:hover:not(:disabled) { background: #353535; }
:disabled { opacity: 0.5; cursor: default; }
body[data-busy="pending"] :disabled:not([data-unavailable="true"]) { opacity: 1; }
.actions { display: flex; justify-content: space-between; align-items: center; }

#panel h2 { margin: 0 0 6px; font-size: 17px; }
#panel .subtitle { margin: 0 0 4px; color: #bbb; font-size: 12px; }
#panel .entry { margin-top: 8px; font-size: 12px; color: #ccc; }
.texture-lists { display: flex; gap: 12px; margin-top: 10px; }
.texture-list { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.texture-list h3 { width: 100%; margin: 0; font-size: 13px; }
.texture canvas { width: 44px; height: 44px; image-rendering: pixelated; border: 1px solid #444; cursor: pointer; }

#info { font: 12px/1.5 ui-monospace, monospace; min-height: 6em; color: #ccc; }
#info div { white-space: pre; }
#keys h3 { margin: 0 0 4px; font-size: 13px; }
#keys p { margin: 6px 0 0; color: #999; font-size: 12px; }
#keys table { border-collapse: collapse; font-size: 12px; color: #bbb; }
#keys th, #keys td { padding: 2px 8px 2px 0; text-align: left; vertical-align: top; }
#keys th { color: #888; font-weight: normal; }
.small-print { margin: 0; color: #888; font-size: 11px; }
#panel .help { margin: 0 0 6px; color: #e8e8e8; font-size: 13px; }

/* Clip mode (?clip=1): a drawn cursor, click rings and a key badge, since screen recordings show none. */
.clip-cursor { position: fixed; left: 0; top: 0; width: 22px; height: 22px; z-index: 20; pointer-events: none; }
.clip-ring { position: fixed; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 3px solid #fff;
  border-radius: 50%; z-index: 19; pointer-events: none; }
.clip-ring.right { border-color: #ff9800; }
.clip-ring.middle { border-color: #4fc3f7; }
.clip-key { position: fixed; left: 16px; bottom: 16px; padding: 6px 14px; z-index: 20; pointer-events: none;
  font: 600 20px/1.2 system-ui, sans-serif; color: #111; background: #f5f5f5; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.clip-key[hidden] { display: none; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px;
  max-width: 420px; z-index: 10; }
.toast { padding: 8px 12px; border-radius: 4px; background: #2e3b2e; border-left: 4px solid #6c6; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.toast.error { background: #3b2626; border-left-color: #e55; }
