:root {
  --void: #090807;
  --oak-950: #0e0b08;
  --oak-900: #17110c;
  --oak-800: #21170f;
  --oak-700: #342415;
  --panel: #18130d;
  --panel-2: #21180f;
  --parchment: #e6c999;
  --parchment-2: #c8a66b;
  --gold: #d5a24b;
  --gold-bright: #f2d68e;
  --brass: #9d6d32;
  --line: rgba(213, 162, 75, .28);
  --line-strong: rgba(242, 214, 142, .52);
  --ink: #f5ead0;
  --muted: #b8a583;
  --shadow: 0 20px 60px rgba(0, 0, 0, .48);
  --green: #7fc24c;
  --blue: #68a9d9;
  --red: #d65248;
  --violet: #a167d6;
  --bone: #cabca2;
  color-scheme: dark;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 38px 38px,
    linear-gradient(0deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 38px 38px,
    repeating-linear-gradient(90deg, #100b07 0 18px, #150f0a 18px 48px, #0b0907 48px 70px),
    #090807;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-rows: 82px minmax(0, 1fr);
  border: 1px solid rgba(242, 214, 142, .16);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .72);
  overflow: hidden;
}

.topbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(300px, 410px) minmax(280px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(213, 162, 75, .22);
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.24)),
    repeating-linear-gradient(90deg, #19120d 0 24px, #100c09 24px 56px, #21160d 56px 82px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .48);
  position: relative;
  z-index: 5;
}

.topbar::after,
.left-rail::after,
.right-rail::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(213, 162, 75, .18);
  pointer-events: none;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 55px;
  height: 55px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  background:
    linear-gradient(145deg, rgba(73, 42, 16, .75), rgba(10, 8, 6, .88)),
    #120d08;
  border: 2px solid var(--brass);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  box-shadow: 0 0 0 4px rgba(213, 162, 75, .08), inset 0 0 18px rgba(0,0,0,.65);
}

.brand-mark span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: .78rem;
  font-weight: 800;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-copy strong,
.library-head h1,
.panel-title,
.scene-banner h2,
.dialog-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
}

.brand-copy strong {
  color: var(--gold-bright);
  font-size: 2rem;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
}

.brand-copy span {
  color: var(--parchment-2);
  font-size: .92rem;
}

.search-box {
  min-width: 0;
  height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  border: 1px solid rgba(213, 162, 75, .48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.3)),
    #0c0907;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.65);
  overflow: hidden;
}

.search-box input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  padding: 0 16px;
}

.search-box input::placeholder {
  color: #937f62;
}

.search-box svg {
  width: 22px;
  height: 22px;
  color: var(--brass);
  justify-self: center;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.text-button,
.icon-button,
.danger-button,
.silence-button,
.category-button,
.favorite-button,
.scene-row,
.upload-button,
.card-main {
  border: 0;
  background: none;
  cursor: pointer;
}

.text-button,
.danger-button,
.silence-button,
.upload-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 6px;
  border: 1px solid rgba(213, 162, 75, .5);
  color: var(--gold-bright);
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.28)),
    #21160d;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.72), 0 8px 18px rgba(0,0,0,.28);
  font-weight: 750;
  white-space: nowrap;
}

.text-button {
  padding: 0 17px;
}

.text-button svg,
.danger-button svg {
  width: 21px;
  height: 21px;
}

.text-button:hover,
.text-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.upload-button:hover,
.upload-button:focus-visible {
  border-color: rgba(242, 214, 142, .78);
  color: #fff4ca;
  filter: brightness(1.08);
}

.text-button.compact {
  min-height: 42px;
  padding: 0 13px;
  font-size: .82rem;
  text-transform: uppercase;
}

.text-button.is-looping {
  border-color: rgba(127, 194, 76, .7);
  color: #b7ef82;
  background:
    linear-gradient(180deg, rgba(127, 194, 76, .13), rgba(0,0,0,.26)),
    #182411;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--parchment-2);
  border: 1px solid rgba(213, 162, 75, .34);
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.28)),
    #19120d;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.65);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.icon-button.small svg {
  width: 18px;
  height: 18px;
}

.dashboard {
  min-height: 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 360px;
  gap: 0;
}

.left-rail,
.right-rail {
  min-height: 0;
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.18)),
    repeating-linear-gradient(90deg, #17100a 0 20px, #100c08 20px 45px, #20150c 45px 70px);
  border-right: 1px solid rgba(213, 162, 75, .22);
  overflow: auto;
}

.right-rail {
  border-right: 0;
  border-left: 1px solid rgba(213, 162, 75, .22);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.28)),
    rgba(20, 15, 10, .88);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,.64);
}

.panel-title {
  margin: 0;
  padding: 12px 14px;
  color: var(--gold-bright);
  font-size: 1.02rem;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(213, 162, 75, .18);
}

.panel-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  border-bottom: 1px solid rgba(213, 162, 75, .18);
}

.panel-title-row .panel-title {
  border-bottom: 0;
}

.panel-tool {
  width: 30px;
  height: 30px;
  justify-self: center;
}

.panel-tool svg {
  width: 17px;
  height: 17px;
}

.category-list,
.favorite-list,
.scene-list,
.active-sound-list {
  display: grid;
}

.category-button,
.favorite-button,
.scene-row {
  min-width: 0;
  display: grid;
  align-items: center;
  color: var(--muted);
  border-bottom: 1px solid rgba(213, 162, 75, .12);
  background: rgba(0, 0, 0, .12);
}

.category-button {
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 45px;
  padding: 6px 12px;
  text-align: left;
}

.category-button:last-child,
.favorite-button:last-child,
.scene-row:last-child {
  border-bottom: 0;
}

.category-button:hover,
.category-button.active {
  color: var(--accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent), transparent 82%), transparent);
}

.category-button.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.category-icon,
.favorite-icon,
.sound-icon {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
}

.category-icon {
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 48%);
  border-radius: 6px;
  background: rgba(0, 0, 0, .24);
}

.category-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.category-button small {
  color: color-mix(in srgb, var(--accent), var(--muted) 42%);
  font-size: .75rem;
}

.favorite-button {
  grid-template-columns: 28px minmax(0, 1fr) 30px;
  gap: 6px;
  min-height: 42px;
  padding: 6px 10px;
  text-align: left;
}

.favorite-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .84rem;
  font-weight: 650;
}

.mini-play {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(213, 162, 75, .42);
  border-radius: 5px;
  color: var(--gold-bright);
  background: #1f160e;
}

.mini-play svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}

.panic-panel,
.silence-panel {
  padding: 12px;
}

.danger-button,
.silence-button {
  width: 100%;
  min-width: 0;
  color: #ffd8b5;
  border-color: rgba(214, 82, 72, .62);
  background:
    linear-gradient(180deg, rgba(214,82,72,.16), rgba(0,0,0,.32)),
    #2a0f0d;
  text-transform: uppercase;
}

.danger-button span,
.silence-button strong {
  overflow-wrap: anywhere;
}

.panic-panel p,
.silence-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.sound-library {
  min-height: 0;
  padding: 18px 22px 28px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.36)),
    radial-gradient(ellipse at center top, rgba(127, 194, 76, .08), transparent 40%),
    rgba(5, 5, 4, .5);
}

.library-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.library-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1.15;
}

.mode-switch {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(213, 162, 75, .34);
  border-radius: 8px;
  background: #11100d;
  overflow: hidden;
}

.mode-switch button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 750;
}

.mode-switch button.active {
  color: var(--gold-bright);
  background: rgba(213, 162, 75, .12);
}

.sound-sections {
  display: grid;
  gap: 28px;
}

.sound-section {
  scroll-margin-top: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 11px;
}

.section-head .sound-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 45%);
  background: color-mix(in srgb, var(--accent), transparent 90%);
}

.section-head h2 {
  margin: 0;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.32rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.section-head span:last-child {
  color: color-mix(in srgb, var(--accent), var(--muted) 45%);
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 14px;
}

.sound-card,
.upload-card {
  min-width: 0;
  min-height: 156px;
  border: 1px solid color-mix(in srgb, var(--accent), rgba(213,162,75,.34) 55%);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.38)),
    #1b130d;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.72), 0 12px 22px rgba(0,0,0,.32);
  overflow: hidden;
  position: relative;
}

.sound-card.active {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent), transparent 28%),
    0 0 22px color-mix(in srgb, var(--accent), transparent 62%),
    inset 0 0 0 1px rgba(0,0,0,.72);
}

.card-main {
  width: 100%;
  min-height: 112px;
  display: block;
  color: var(--ink);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.card-image {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.76)),
    var(--scene-art),
    linear-gradient(135deg, #2a2217, #080706);
  background-size: cover;
  background-position: center;
  filter: saturate(.98) contrast(1.05);
}

.card-main::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.4), transparent 56%),
    linear-gradient(180deg, rgba(255,255,255,.06), transparent 36%);
  pointer-events: none;
}

.play-ring {
  position: absolute;
  left: 12px;
  bottom: 11px;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  border: 2px solid color-mix(in srgb, var(--accent), var(--gold) 45%);
  border-radius: 50%;
  background: rgba(8, 6, 4, .78);
  box-shadow: 0 6px 16px rgba(0,0,0,.46);
  z-index: 1;
}

.play-ring svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
  margin-left: 2px;
}

.sound-card.active .play-ring svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

.card-copy {
  position: relative;
  z-index: 1;
  min-height: 112px;
  display: grid;
  align-content: start;
  padding: 14px 14px 52px;
  text-shadow: 0 2px 5px rgba(0,0,0,.95);
}

.card-copy strong {
  color: #fff6df;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.2;
}

.card-copy span {
  color: #f0d7a4;
  margin-top: 4px;
  font-size: .82rem;
  line-height: 1.35;
}

.card-controls {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 8px;
  background: rgba(9, 7, 5, .86);
  border-top: 1px solid rgba(213, 162, 75, .18);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent, var(--gold));
}

.loop-control.is-on {
  color: #b7ef82;
  border-color: rgba(127, 194, 76, .7);
}

.upload-card {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 156px;
  padding: 14px;
  border-style: dashed;
  color: var(--muted);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent), transparent 94%), rgba(0,0,0,.24)),
    rgba(14, 11, 8, .9);
}

.upload-card.drag-over {
  border-color: var(--accent);
  color: var(--ink);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent), transparent 82%), rgba(0,0,0,.24)),
    rgba(14, 11, 8, .9);
}

.upload-card h3 {
  margin: 0;
  color: var(--gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
}

.upload-card p {
  margin: 0;
  font-size: .82rem;
  line-height: 1.4;
}

.upload-button {
  justify-self: start;
  min-height: 36px;
  padding: 0 12px;
  font-size: .82rem;
}

.upload-card input {
  display: none;
}

.upload-hint {
  color: color-mix(in srgb, var(--accent), var(--muted) 48%);
  font-size: .75rem;
}

.active-scene-panel {
  overflow: hidden;
}

.scene-banner {
  min-height: 165px;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(7,7,7,.8), rgba(7,7,7,.2)),
    radial-gradient(circle at 86% 18%, rgba(242, 214, 142, .24) 0 8%, transparent 9%),
    linear-gradient(135deg, rgba(55, 76, 112, .42), rgba(8, 9, 14, .82) 65%),
    #0b0b0e;
  border-bottom: 1px solid rgba(213, 162, 75, .2);
  position: relative;
}

.scene-banner::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 120px;
  height: 58px;
  background:
    linear-gradient(140deg, transparent 0 24%, rgba(0,0,0,.48) 25% 28%, transparent 29%),
    linear-gradient(20deg, rgba(10, 19, 28, .9), rgba(23, 36, 45, .18));
  clip-path: polygon(0 100%, 20% 58%, 34% 100%, 48% 45%, 67% 100%, 80% 62%, 100% 100%);
  opacity: .85;
}

.scene-banner h2 {
  margin: 0;
  color: #fff2cf;
  font-size: 1.55rem;
  line-height: 1.15;
}

.scene-banner p:not(.eyebrow) {
  max-width: 220px;
  margin: 10px 0 0;
  color: #d9c194;
  font-size: .9rem;
  line-height: 1.4;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 13px;
  padding: 0 9px;
  border-radius: 5px;
  color: #b9f186;
  background: rgba(41, 115, 29, .38);
  border: 1px solid rgba(127, 194, 76, .42);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.volume-control {
  display: grid;
  gap: 11px;
  padding: 17px 18px;
  color: var(--muted);
  border-bottom: 1px solid rgba(213, 162, 75, .18);
}

.scene-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 15px;
}

.active-sound-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) minmax(58px, 74px) 28px 28px 28px;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 7px 9px;
  color: var(--ink);
  border-bottom: 1px solid rgba(213, 162, 75, .14);
}

.active-sound-row:last-child {
  border-bottom: 0;
}

.active-sound-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .86rem;
  font-weight: 650;
}

.active-sound-row .sound-icon {
  color: var(--accent);
}

.remove-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(213, 162, 75, .24);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(0,0,0,.24);
  cursor: pointer;
}

.remove-button svg {
  width: 16px;
  height: 16px;
}

.empty-state {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.scene-row {
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  gap: 8px;
  min-height: 48px;
  padding: 7px 9px 7px 13px;
  text-align: left;
}

.scene-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--parchment);
  font-size: .9rem;
  font-weight: 650;
}

.scene-row.active {
  background: linear-gradient(90deg, rgba(127, 194, 76, .16), rgba(0,0,0,.1));
  box-shadow: inset 3px 0 0 var(--green);
}

.silence-button {
  color: #ead9bb;
  border-color: rgba(161, 103, 214, .58);
  background:
    linear-gradient(180deg, rgba(161,103,214,.16), rgba(0,0,0,.32)),
    #1b1024;
}

.silence-button .skull-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #d5c3a8;
}

.dialog-card {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(213, 162, 75, .45);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(0,0,0,.3)),
    #18120d;
  box-shadow: var(--shadow);
}

.dialog-card.scene-editor {
  width: min(760px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  overflow: auto;
}

.dialog-card.sound-manager {
  width: min(700px, calc(100vw - 32px));
  max-height: min(86vh, 720px);
  overflow: auto;
}

dialog {
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0,0,0,.72);
}

.dialog-card h2 {
  margin: 0;
}

.dialog-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.dialog-card input,
.dialog-card textarea {
  height: 42px;
  border-radius: 6px;
  border: 1px solid rgba(213, 162, 75, .44);
  color: var(--ink);
  background: #0d0a07;
  padding: 0 12px;
}

.dialog-card textarea {
  min-height: 76px;
  padding: 10px 12px;
  resize: vertical;
}

.scene-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sound-manager-actions {
  display: flex;
  justify-content: flex-start;
}

.editor-subtitle {
  margin: 2px 0 -6px;
  color: var(--gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
}

.scene-manager {
  min-width: 0;
  border: 1px solid rgba(213, 162, 75, .24);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, .16);
}

.scene-manager-list {
  max-height: 220px;
  overflow: auto;
  display: grid;
}

.scene-manager-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px 8px 12px;
  border-top: 1px solid rgba(213, 162, 75, .12);
  background: rgba(0, 0, 0, .12);
}

.scene-manager-row.active {
  box-shadow: inset 3px 0 0 var(--green);
  background: linear-gradient(90deg, rgba(127, 194, 76, .14), rgba(0,0,0,.08));
}

.scene-manager-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.scene-manager-row strong,
.scene-manager-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-manager-row strong {
  color: var(--ink);
  font-size: .9rem;
}

.scene-manager-row small {
  color: var(--muted);
  font-size: .74rem;
}

.scene-sound-picker {
  min-width: 0;
  border: 1px solid rgba(213, 162, 75, .24);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, .16);
}

.sound-manager-list {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.sound-manager-group {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.sound-manager-group h3 {
  margin: 0;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  text-transform: uppercase;
}

.sound-manager-options {
  display: grid;
  border: 1px solid rgba(213, 162, 75, .22);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, .16);
}

.sound-manager-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid rgba(213, 162, 75, .12);
}

.sound-manager-row:last-child {
  border-bottom: 0;
}

.sound-manager-row.is-hidden {
  opacity: .62;
  background: rgba(0, 0, 0, .28);
}

.sound-manager-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sound-manager-row strong,
.sound-manager-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-manager-row strong {
  color: var(--ink);
  font-size: .9rem;
}

.sound-manager-row small {
  color: var(--muted);
  font-size: .74rem;
}

.sound-visibility-button {
  min-height: 34px;
  padding: 0 9px;
}

.compact-title {
  padding: 10px 12px;
  font-size: .88rem;
}

.scene-sound-list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.scene-sound-group {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.scene-sound-group legend {
  padding: 0 0 2px;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  text-transform: uppercase;
}

.scene-sound-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.scene-sound-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 54px;
  padding: 8px;
  border: 1px solid rgba(213, 162, 75, .18);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(0, 0, 0, .18);
}

.scene-sound-option input {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.scene-sound-option span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.scene-sound-option strong,
.scene-sound-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-sound-option strong {
  color: var(--ink);
  font-size: .86rem;
}

.scene-sound-option small {
  color: var(--muted);
  font-size: .74rem;
}

.form-error {
  min-height: 18px;
  margin: -5px 0 0;
  color: #f3a59e;
  font-size: .82rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: visible;
  }

  body {
    overflow: auto;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dashboard {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: 0;
    border-top: 1px solid rgba(213, 162, 75, .22);
  }
}

@media (max-width: 760px) {
  .topbar,
  .left-rail,
  .right-rail,
  .sound-library {
    padding: 12px;
  }

  .brand-copy strong {
    font-size: 1.6rem;
  }

  .dashboard,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .sound-library {
    order: 1;
  }

  .right-rail {
    order: 2;
  }

  .left-rail {
    order: 3;
  }

  .left-rail,
  .right-rail {
    border-left: 0;
    border-right: 0;
  }

  .library-head {
    align-items: stretch;
    flex-direction: column;
  }

  .sound-grid {
    grid-template-columns: 1fr;
  }

  .scene-controls,
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .active-sound-row {
    grid-template-columns: 24px minmax(0, 1fr) 64px 28px 28px 28px;
  }
}
