/* Syncytium: pale membrane, satin metal, a dark viewing chamber. Static finishes. */
:root {
  --bg-dark: #162c2b;
  --bg-panel: #d4b9b7;
  --bg-panel-subtle: #c7c3a3;
  --text-main: #332742;
  --text-muted: #564452;
  --accent-cyan: #375e53;
  --accent-emerald: #bbcf78;
  --border-subtle: #a08f94;
  --font-sans: ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #243e38; }
body {
  height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
  color: var(--text-main); font: 13px/1.45 var(--font-sans);
  padding: 14px 18px 18px 12px;
  background: radial-gradient(ellipse at 8% 4%, #8e927c, transparent 55%),
    radial-gradient(ellipse at 94% 96%, #72546d, transparent 48%), #344840;
}
button, input, select { font: inherit; }
button, select, input { touch-action: manipulation; }
:focus-visible { outline: 3px solid #7a3d67; outline-offset: 3px; }
[hidden] { display: none !important; }
.app-header {
  display: flex; align-items: center; flex-shrink: 0; gap: 24px; padding: 13px 20px 17px;
  border: 1px solid #c5c5ac; border-bottom: 0; border-radius: 38px 26px 0 0;
  background: radial-gradient(ellipse at 20% -30%, #ece0cb, transparent 65%),
    linear-gradient(110deg, #bbbfb0, #c8b6c3 55%, #afb9a5);
  box-shadow: inset 0 2px 1px #f0dfc9, inset 3px 0 5px #d9c7b3;
  position: relative; z-index: 2;
}
.brand-container { display: flex; flex-direction: column; align-items: flex-start; min-width: 242px; gap: 1px; }
.brand-title { order: 1; font: italic 800 44px/.96 Georgia, serif; letter-spacing: -3.1px; color: #3a324e; white-space: nowrap; padding: 3px 8px 6px 0; text-shadow: 0 1px #efdfcd, 0 -1px #958e91; }
.brand-title span { display: inline-block; }
.brand-title span:nth-child(2) { transform: translateY(4px) rotate(-7deg); }
.brand-title span:nth-child(3) { transform: scaleX(1.12) rotate(4deg); }
.brand-title span:nth-child(4) { transform: translateY(-2px) rotate(-8deg); }
.brand-title span:nth-child(6) { transform: translateY(-3px) scaleY(1.1); }
.brand-title span:nth-child(8) { transform: translateY(2px) rotate(6deg); }
.brand-title span:nth-child(9) { transform: rotate(-5deg) scaleX(1.09); }
.suite-badge { order: 0; font: 10px/1.5 var(--font-mono); color: #575c49; letter-spacing: .08em; padding-left: 3px; }
.brand-tagline { order: 2; color: #655268; font-size: 11px; margin: 2px 0 0 5px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 7px; flex: 1; }
.btn, select.select-input {
  min-height: 34px; border: 1px solid #8d9590; color: #352d42; cursor: pointer;
  padding: 6px 11px; border-radius: 13px 9px 15px 8px;
  background: linear-gradient(174deg, #e2dfcf, #bbb9a5 65%, #c6b2bb);
  box-shadow: inset 0 1px #f0e2cd, inset 0 -2px #a09f94, 0 2px 2px #514a5426;
}
select.select-input { max-width: 100%; padding-right: 20px; background: #dfd2ce; box-shadow: inset 0 1px 3px #81718145; }
.btn:hover { border-color: #5c6057; background: #e5d8b7; }
.btn:active { box-shadow: inset 0 2px 4px #5b515b55; transform: translateY(1px); }
.btn-primary, #processFrameBtn { background: linear-gradient(172deg, #f1d48b, #caa366 65%, #b58a72); border-color: #9b7966; color: #3e2d3e; font-weight: 650; }
.btn-toggle.active { background: #405b53; color: #e2e7b1; border-color: #b3bf88; box-shadow: inset 0 2px 4px #1b3838; }
.btn:disabled, select:disabled, input:disabled { opacity: .55; cursor: default; }
#helpBtn { border-radius: 50% 42% 48% 37%; background: #c1b2c7; }
.app-body { flex: 1; min-height: 0; display: flex; overflow: hidden; border: 1px solid #b8b9a0; border-top: 0; border-radius: 0 0 34px 24px; background: #d4b9b7; box-shadow: 0 12px 25px #192d2c66; }
.controls-sidebar { width: 326px; flex-shrink: 0; min-height: 0; overflow-y: auto; padding: 4px 20px 20px 18px;
  background: radial-gradient(ellipse at -35% 42%, #ecd2bd, transparent 58%), linear-gradient(120deg, #d4b9b7, #c8b3bd 75%, #bcb4b0);
  scrollbar-width: thin; scrollbar-color: #8e7c91 #c6b3b8;
}
.control-section { padding: 16px 0 9px; position: relative; }
.control-section + .control-section::before { content: ''; display: block; width: 75%; height: 1px; background: #a18d98; border-radius: 50%; position: absolute; top: 0; left: 5%; }
.section-title { font: italic 600 19px/1.2 Georgia, serif; color: #40534a; margin-bottom: 13px; letter-spacing: -.25px; }
.control-section:nth-child(2) .section-title { color: #604164; }
.control-section:nth-child(3) .section-title { color: #734d37; }
.control-group { margin-bottom: 14px; }
.control-label { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; font-size: 12px; color: #493e4f; }
.control-val { font: 11px/1.4 var(--font-mono); color: #314d44; padding: 1px 5px; background: #dfe0bd; border-radius: 7px 5px 9px 4px; flex-shrink: 0; }
.control-help, .export-settings p { font-size: 11px; line-height: 1.6; color: #564452; margin: 8px 0; }
input[type=range] { width: 100%; accent-color: #4b6f59; cursor: pointer; min-height: 22px; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 60% 45% 48% 54%; background: linear-gradient(#8d9c85, #b4bca2); box-shadow: inset 0 1px 2px #596a61, 0 1px #ead5c2; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 16px; height: 20px; margin-top: -7px; border: 1px solid #657957; border-radius: 48% 42% 51% 39%; background: linear-gradient(140deg, #dfe3a4, #9aaf77 57%, #729782); box-shadow: inset 0 1px #e9dfac, 0 2px 2px #65566a55; }
input[type=range]::-moz-range-track { height: 6px; border-radius: 9px; background: #9eae96; box-shadow: inset 0 1px 2px #596a61; }
input[type=range]::-moz-range-thumb { width: 16px; height: 20px; border: 1px solid #657957; border-radius: 48% 42% 51% 39%; background: #a6be88; }
#paramLag::-webkit-slider-thumb { background: linear-gradient(140deg, #e9c8c0, #b88baf 57%, #856e96); border-color: #876881; }
#paramLag::-moz-range-thumb { background: #b88baf; border-color: #876881; }
input[type=checkbox] { accent-color: #566349; width: 18px; height: 18px; }
#paramLag { accent-color: #824e70; }
#paramTurgor { accent-color: #877047; }
.export-settings { padding-top: 19px; }
.export-settings label { display: block; font-size: 12px; margin: 10px 0 4px; }
.export-settings input { width: 100%; padding: 6px 10px; color: #3b2f47; background: #e0d0c7; border: 1px solid #a08d95; border-radius: 10px 7px 12px 8px; }
.export-settings progress { width: 100%; height: 8px; accent-color: #526448; margin: 7px 0; }
#renderStatus { color: #3d334b; font-weight: 600; }
.export-settings .btn { margin: 3px 0; }
.viewport-container { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; padding: 13px 16px 16px 11px;
  background: linear-gradient(127deg, #b4b9a8, #7a9790 22%, #525e67 64%, #b1a19c);
  box-shadow: inset 2px 0 5px #76697855;
}
.file-drop-hint { font: 11px/1.4 var(--font-mono); color: #e1dcca; padding: 11px 16px; background: #354d48; border-radius: 25px 15px 0 0; }
.canvas-wrapper { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 24px;
  background: radial-gradient(ellipse at 82% 10%, #3c3a48, transparent 64%), radial-gradient(ellipse at 18% 100%, #354d3c, transparent 55%), #172f2e;
  border-radius: 0 0 38px 21px; border: 1px solid #314b44; border-top: 0;
  box-shadow: inset 0 5px 18px #102d2b, inset 0 -1px #a2b09a44;
}
canvas#mainCanvas, #renderPlayer { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 2px; box-shadow: 0 4px 16px #0c232966; }
.hud-overlay { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 18px; order: 3; font: 10px/1.4 var(--font-mono); color: #303e3e; padding: 9px 11px 0; }
.hud-stat span { color: #33364b; font-weight: 700; }
.file-drop-overlay { display: none; position: absolute; z-index: 5; inset: 20px 22px 48px 17px; align-items: center; justify-content: center; pointer-events: none;
  border: 2px solid #cddd93; border-radius: 47px 29px 58px 34px; background: #294942ee; color: #e8e1be; font: italic 24px Georgia, serif;
}
.file-drag-active .file-drop-overlay { display: flex; }
.video-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 11px; min-height: 42px; color: #343246; }
.scrub-bar, #cacheScrub { flex: 1; min-width: 80px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: #182e32d9; opacity: 0; pointer-events: none; }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-content { width: 600px; max-width: 92vw; max-height: 85dvh; overflow-y: auto; background: #dac5bd; border: 2px solid #a9b6a0; border-radius: 35px 21px 44px 26px; padding: 25px 30px; box-shadow: inset 0 2px #eadfc5, 0 12px 30px #12332e88; }
.modal-title { font: italic 600 23px/1.25 Georgia, serif; color: #59456b; margin-bottom: 18px; }
.modal-body p { font-size: 13px; line-height: 1.6; margin-bottom: 12px; color: #493d4c; }
@media (max-width: 1050px) { .app-header { gap: 15px; } .brand-container { min-width: 218px; } .brand-title { font-size: 39px; } .controls-sidebar { width: 295px; padding-left: 14px; padding-right: 15px; } }
@media (max-width: 700px) {
  body { height: auto; min-height: 100dvh; overflow: auto; padding: 8px; }
  .app-header { align-items: flex-start; flex-direction: column; gap: 13px; padding: 18px 16px; border-radius: 28px 19px 0 0; }
  .brand-container { gap: 2px; } .brand-title { font-size: 46px; }
  .toolbar { width: 100%; gap: 7px; } .toolbar select { flex: 1 1 170px; min-width: 0; } .toolbar .btn { flex: 1 1 auto; }
  .app-body { flex-direction: column-reverse; overflow: visible; }
  .controls-sidebar { width: 100%; overflow: visible; padding: 4px 22px 20px; }
  .viewport-container { min-height: 340px; padding: 10px; }
  .canvas-wrapper { min-height: 260px; padding: 16px; }
  .hud-overlay { font-size: 10px; gap: 4px 12px; }
  .file-drop-hint { font-size: 10px; } .modal-content { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }

/* Unequal compartments share a membrane; the image remains rectangular. */
.app-header { border-radius: 65px 38px 0 0; border: 3px solid #c7c99d; border-bottom: 0;
  background: radial-gradient(ellipse at 30% 0%, #f0dcc1, transparent 58%), radial-gradient(ellipse at 93% 90%, #a9c4a4, transparent 70%), #c7aabc;
  box-shadow: inset 0 3px 6px #efe5b5, inset 0 -8px 15px #a979982e;
}
.brand-container { padding: 3px 7px 5px 3px; }
.brand-tagline { color: #684866; font: italic 13px/1.4 Georgia, serif; }
.brand-title { color: #533653; text-shadow: 0 2px #efccbd, 0 -1px #ac839d; }
.app-body { border: 3px solid #a7b998; border-top: 0; border-radius: 0 0 68px 41px; background: #b4aeac; }
.controls-sidebar { padding: 9px 12px 25px 15px; background: radial-gradient(ellipse at 15% 25%, #d1aeaa, transparent 65%), #bcb3ad; }
.control-section { padding: 19px 18px 14px; margin: 0 2px 13px 0;
  border: 1px solid #b9c598; border-radius: 39px 29px 51px 27px / 32px 39px 40px 28px;
  background: radial-gradient(ellipse at 20% 0%, #efe0b9b8, transparent 65%), radial-gradient(ellipse at 100% 80%, #b68ca699, transparent 70%), #dec7bb;
  box-shadow: inset 0 3px 4px #eee2bf, inset 3px 0 7px #dddfa6b3, inset -3px -5px 10px #9f79974d, 0 3px 5px #826c7955;
}
.control-section + .control-section::before { display: none; }
.control-section:nth-child(2) { margin-left: 8px; margin-right: 0; border-radius: 28px 42px 25px 47px; background: radial-gradient(ellipse at 75% 10%, #e1d9b5, transparent 67%), #ccb2c4; }
.control-section:nth-child(3) { margin-right: 16px; padding-bottom: 20px; border-radius: 36px 48px 33px 29px; background: radial-gradient(ellipse at 20% 10%, #ece0b8, transparent 65%), #c5c7a8; }
.control-section:nth-child(4) { margin-left: 3px; border-radius: 49px 28px 44px 38px; }
.control-section:nth-child(5) { border-radius: 24px 39px 48px 31px; background: #d2c8b5; }
.section-title { font-size: 20px; margin: 0 0 14px 3px; }
.control-val { border-radius: 55% 38% 49% 43%; padding: 2px 7px; box-shadow: inset 0 1px 2px #f1e8b6, 0 1px 1px #90866c40; }
.btn { border-radius: 48% 39% 45% 33% / 42% 48% 35% 43%; padding: 7px 14px; }
select.select-input { border-radius: 20px 14px 24px 12px; }
.viewport-container { padding: 13px 17px 18px 12px; background: radial-gradient(ellipse at 5% 0%, #d1cea7, transparent 50%), radial-gradient(ellipse at 95% 100%, #bb92b6, transparent 58%), #8ea89d; }
.file-drop-hint { align-self: flex-start; max-width: 100%; margin: 0 0 9px 9px; border: 1px solid #adbfa0; border-radius: 42px 23px 35px 20px; background: #3f6154; padding: 9px 17px; }
.canvas-wrapper { border: 3px solid #a4bf8e; border-radius: 15% 10% 17% 11% / 13% 18% 12% 19%; padding: 27px;
  background: radial-gradient(ellipse at 75% 12%, #574659, transparent 65%), radial-gradient(ellipse at 10% 90%, #3b6753, transparent 66%), #193c35;
  box-shadow: inset 0 4px 8px #d9d8a45c, inset 9px 0 20px #264a3a, inset -6px -9px 16px #103f37, 0 2px 4px #5f687755;
}
.hud-overlay { padding-left: 18px; }
.modal-content { border-width: 3px; border-radius: 58px 37px 69px 31px; }
.tissue-statement { font: italic 22px/1.3 Georgia, serif !important; color: #5b3e61 !important; margin-bottom: 20px !important; }
@media (max-width: 1050px) { .control-section { padding-left: 14px; padding-right: 14px; } }
@media (max-width: 700px) {
  .app-header { border-radius: 44px 27px 0 0; }
  .controls-sidebar { padding: 12px 15px 23px; }
  .control-section { padding: 19px 20px 15px; }
  .canvas-wrapper { padding: 20px; border-radius: 14% 10% 17% 11% / 10% 15% 12% 16%; }
  .viewport-container { padding: 10px 12px 12px; }
  .file-drop-hint { margin-left: 2px; font-size: 10px; padding: 9px 12px; }
}
