/* Rube's look: a Rube Goldberg newspaper cartoon. Cream newsprint, black pen
   linework, and one red spot colour for the things that are live. No gloss,
   no gradients, no drop shadows. (The plugin's Source/ui/Theme.h.) */

:root {
  --paper: #f2ead8;   /* newsprint */
  --paper2: #e6dbc2;  /* pressed / sunken */
  --tone: #cfc4ab;    /* light halftone grey */
  --tone2: #a89d86;   /* mid halftone grey */
  --ink: #1c1a17;     /* pen lines, text */
  --ink2: #625a4c;    /* captions, secondary text */
  --red: #d4351c;     /* the spot colour */
  --label: "American Typewriter", "Courier Prime", Georgia, serif;
  --mono: "Courier New", Courier, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--label); }
body { min-height: 100vh; padding: 10px; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left)); }
[hidden] { display: none !important; }

.frame { border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); padding: 10px 12px; min-width: 0; }
.page { display: flex; flex-direction: column; gap: 10px; max-width: 1500px; margin: 0 auto; }

/* ---- top bar ---------------------------------------------------------------- */
.top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 14px; }
.top .spacer { flex: 1; }
.tagline { font-size: 13px; color: var(--ink2); }
.scenebox { display: flex; flex-direction: column; gap: 6px; }
.scenerow { display: flex; gap: 6px; align-items: center; }
.topbtns { display: flex; gap: 10px; flex-wrap: wrap; }
.topbtns .btn { min-width: 92px; height: 34px; }
canvas.word { display: block; }

/* ---- buttons, inputs ------------------------------------------------------ */
.btn {
  font: bold 12px var(--label); text-transform: uppercase; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 3px;
  padding: 0 12px; height: 30px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; white-space: nowrap; touch-action: manipulation;
}
.btn:hover { background: var(--paper2); }
.btn:active { transform: translateY(1px); }
.btn.on { background: var(--ink); color: var(--paper); }
.btn.red, .btn.recording { color: var(--red); }
.btn.recording.on { background: var(--red); color: var(--paper); border-color: var(--ink); }
.btn.sq { width: 30px; padding: 0; }
select, input:not([type=range]) {
  font: 13px var(--label); color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); border-radius: 3px;
  height: 30px; padding: 0 8px; min-width: 0;
}
select { appearance: none; padding-right: 26px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 15px) 12px, calc(100% - 10px) 12px; background-size: 5px 5px; background-repeat: no-repeat; }
#scene { width: 172px; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

/* a pen line with ticks at the quarters; the thumb is a red marble */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 2px 0 8px; cursor: pointer;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 50% / var(--fill, 0%) 2.5px no-repeat,
    linear-gradient(var(--ink2), var(--ink2)) 0 50% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--ink2) 0 1px, transparent 1px 25%) 0 50% / calc(100% - 0px) 7px no-repeat; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, var(--paper) 0 18%, var(--red) 19%); border: 1.5px solid var(--ink); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, var(--paper) 0 18%, var(--red) 19%); border: 1.5px solid var(--ink); }

.val { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; font-weight: bold; text-transform: uppercase; color: var(--ink2); margin-top: 8px; }
.val b { font: bold 12px var(--mono); color: var(--ink); text-transform: none; }
.val select { width: 150px; height: 28px; font-size: 12px; text-transform: none; color: var(--ink); font-weight: normal; }
.seg { display: flex; gap: 6px; margin: 4px 0; }
.seg .btn { flex: 1; }
.cap { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: bold; text-transform: uppercase; color: var(--ink2); margin: 8px 0; }
.cap input, .cap select { text-transform: none; font-weight: normal; }
.mono { font: bold 12px var(--mono); }
.small { font-size: 12px; color: var(--ink2); }
.err { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 4px; }
.hint { font-size: 12.5px; color: var(--ink2); line-height: 1.45; margin: 12px 0; }
canvas.head { margin: 4px 0 10px; }

/* ---- the room ---------------------------------------------------------------- */
.room-main { display: grid; grid-template-columns: 200px minmax(0, 1fr) 250px; gap: 10px; align-items: stretch; }
.parts { display: flex; flex-direction: column; gap: 6px; }
.partrow { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border: 1.5px solid var(--ink); border-radius: 3px;
  cursor: pointer; background: var(--paper); font: bold 13px var(--label); color: var(--ink); text-align: left; }
.partrow:hover { background: var(--paper2); }
.partrow .sw { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }
.partrow .k { margin-left: auto; font: bold 11px var(--mono); color: var(--ink2); }
.partrow.on { background: var(--ink); color: var(--paper); }
.partrow.on .sw { border-color: var(--paper); }
.partrow.on .k { color: var(--tone); }
.partrow.dashed { border-style: dashed; }
.roomname { font-size: 15px; margin-bottom: 6px; overflow-wrap: anywhere; }
.people { display: flex; flex-direction: column; gap: 3px; font-size: 13px; margin-bottom: 10px; }
.people .me { color: var(--red); }

.boardwrap { display: flex; flex-direction: column; min-height: 0; }
.boardinfo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.modetag { font: bold 12px var(--label); padding: 6px 10px; border: 1.5px solid var(--ink); border-radius: 3px; white-space: nowrap; }
.modetag.build { background: var(--red); color: var(--paper); }
.boardbox { position: relative; flex: 1; min-height: 360px; aspect-ratio: 16 / 10.5; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#board.build { cursor: crosshair; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels span { position: absolute; transform: translate(-50%, -100%); font: bold 11px var(--label); color: var(--red); white-space: nowrap; }
.wait { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: bold 13px var(--label); background: var(--paper); border: 1.5px solid var(--ink); border-radius: 3px; padding: 8px 14px; }

.lasthit { font-size: 13px; line-height: 1.5; white-space: pre-line; }
.pname { font-size: 16px; margin-bottom: 4px; }
#remove { width: 100%; margin-top: 8px; }

.log { display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 48px; }
.chips { flex: 1; display: flex; justify-content: flex-end; gap: 6px; overflow: hidden; min-width: 0; }
.chip { font: bold 12px var(--mono); padding: 6px 9px; border: 1.5px solid var(--ink); border-radius: 3px; white-space: nowrap; }
.chip.new { background: var(--ink); color: var(--paper); }
.recstatus { color: var(--ink2); white-space: nowrap; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink2); padding: 0 2px 6px; }
.credits { font-size: 11px; }
.credits a { color: var(--ink2); }

/* ---- narrow screens: stack it ------------------------------------------------ */
@media (max-width: 1060px) {
  .room-main { grid-template-columns: 1fr 1fr; }
  .boardwrap { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 700px) {
  body { padding: 6px; }
  .room-main { grid-template-columns: minmax(0, 1fr); }
  .top { gap: 10px; }
  .top .brand, .tagline { display: none; }
  .topbtns .btn { min-width: 0; }
  .boardbox { min-height: 0; aspect-ratio: 4 / 3.4; }
  .log { flex-wrap: wrap; }
}
