/* The machine sits in a dusk landscape (painted on the canvas). Chrome is cut paper and ink:
   tokens with flat offset shadows, serif italics, no app labels. Mono only for the debug panel. */
:root {
	--ink: #211a2e;
	--paper: #f3e8cf;
	--sky: #efe2c3;
	--violet: #4a3870;
	--lilac: #9a85b4;
	--ochre: #d9a03c;
	--vermilion: #d24b2a;
	--shadow: rgba(42, 28, 72, 0.5);
	--rule: rgba(33, 26, 46, 0.18);
	--serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
	--sans: 'Bricolage Grotesque', system-ui, sans-serif;
	--mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
	color-scheme: light;
}
* { box-sizing: border-box }
html, body { height: 100%; margin: 0 }
body { background: var(--sky); color: var(--ink); font: 14px/1.4 var(--sans); overflow: hidden; -webkit-font-smoothing: antialiased }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair }
body.erasing canvas { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='8' fill='%23f3e8cf' fill-opacity='.6' stroke='%23211a2e' stroke-width='1.3' stroke-dasharray='2 2'/%3E%3C/svg%3E") 12 12, cell }

/* title and seats, top left, on the sky */
.panel { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 14px); left: max(16px, env(safe-area-inset-left, 0px)); width: 15rem; max-width: calc(100% - 32px); pointer-events: none }
.panel > * { pointer-events: auto }
h1 { margin: 0 0 0.6rem; font: 400 40px/0.9 var(--serif); font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144; letter-spacing: -0.02em }
h1 em { font-style: italic; font-weight: 300; color: var(--violet) }
.seats { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px }
.seat button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 0.8rem 4.6rem 1fr; align-items: baseline; gap: 0.5rem; padding: 0.2rem 0.1rem; cursor: pointer; border-bottom: 1px solid var(--rule) }
.seat button:hover .who, .seat button:focus-visible .who { text-decoration: underline wavy var(--rule) 1px; text-underline-offset: 3px }
.seat button:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px }
.seat button:disabled { cursor: default }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 52% 48% 55% 45%; background: var(--c); border: 1px solid var(--ink); align-self: center }
.inst { font: italic 400 16px/1.2 var(--serif) }
.who { font: 400 13px/1.2 var(--sans); color: rgba(33, 26, 46, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0 }
.seat.bot .who { font-style: italic; color: var(--violet) }
.seat.empty .who { color: rgba(33, 26, 46, 0.35) }
.seat.mine .who { color: var(--ink); font-weight: 600 }
.seat.mine .who::before { content: '☞ ' ; font-weight: 400 }

.peers { position: fixed; margin: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); right: max(16px, env(safe-area-inset-right, 0px)); max-width: 15rem; text-align: right; font: italic 400 14px/1.3 var(--serif); background: var(--paper); border: 1px solid var(--ink); padding: 0.25rem 0.55rem; box-shadow: 3px 4px 0 var(--shadow) }
.peers:empty { display: none }

/* the deck */
.deck { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); margin: 0; padding: 0; list-style: none; display: flex; align-items: center; gap: 12px }
.deck li { display: flex; align-items: center }
button { font: inherit; color: var(--ink); -webkit-tap-highlight-color: transparent }
.token { width: 48px; height: 48px; flex: none; padding: 0; display: grid; place-items: center; cursor: pointer; background: var(--paper); border: 1.4px solid var(--ink); border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%; box-shadow: 3px 4px 0 var(--shadow); transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s }
.token:hover { transform: translate(-1px, -1px); box-shadow: 4px 5px 0 var(--shadow) }
.token:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--shadow) }
.token[aria-pressed='true'] { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--shadow) }
.token:focus-visible, .nib:focus-visible { outline: 1.5px dashed var(--ink); outline-offset: 4px }
svg { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible }
svg .fill { fill: var(--ink) }
.token .on { display: none }
.token[aria-pressed='true'] .on { display: inline }
.token[aria-pressed='true'] .off { display: none }
#sound[aria-pressed='true'] { background: var(--ochre) }
#erase[aria-pressed='true'] { background: #e8a7b3 }
#bots[aria-pressed='true'] { background: var(--lilac) }
#bots[aria-pressed='false'] .fill { fill: none }
#bots[aria-pressed='false'] svg { opacity: 0.45 }

.tempo { gap: 2px; background: var(--paper); border: 1.4px solid var(--ink); border-radius: 26px 22px 24px 20px; height: 48px; padding: 0 4px; box-shadow: 3px 4px 0 var(--shadow) }
.nib { width: 28px; height: 40px; padding: 0; background: none; border: 0; cursor: pointer; display: grid; place-items: center; border-radius: 50% }
.nib svg { width: 14px; height: 14px; stroke-width: 1.8 }
.nib:hover svg { stroke: var(--vermilion) }
output { width: 3.6ch; text-align: center; font: italic 400 24px/1 var(--serif); font-variant-numeric: tabular-nums lining-nums; font-variation-settings: 'WONK' 1 }
output.pending { color: var(--vermilion) }

/* lil-gui on paper; data stays mono */
.lil-gui {
	--background-color: #f3e8cf;
	--widget-color: #e6d6b4;
	--hover-color: #dccaa4;
	--focus-color: #d2bd94;
	--number-color: #b23c1e;
	--string-color: #2f7a58;
	--text-color: #211a2e;
	--title-background-color: #e6d6b4;
	--title-text-color: #211a2e;
	--font-family: var(--mono);
	--font-size: 11px;
}
.lil-gui.root { top: calc(env(safe-area-inset-top, 0px) + 8px) !important; right: max(8px, env(safe-area-inset-right, 0px)) !important; max-height: calc(100% - 120px); border: 1.2px solid var(--ink); box-shadow: 3px 4px 0 var(--shadow) }

@media (max-width: 640px) {
	.panel { width: auto; right: max(16px, env(safe-area-inset-right, 0px)) }
	h1 { font-size: 30px; margin-bottom: 0.3rem }
	.seats { grid-template-columns: 1fr 1fr; column-gap: 0.8rem }
	.seat button { grid-template-columns: 0.7rem 3.6rem 1fr; gap: 0.35rem }
	.inst { font-size: 14px }
	.peers { display: none }
	.deck { gap: 8px }
	.token, .tempo { height: 44px }
	.token { width: 44px }
	.lil-gui.root { top: auto !important; bottom: 80px }
}
