:root {
  --bg: #f8f7f3;
  --panel: rgba(255, 255, 255, 0.73);
  --panel-strong: #ffffff;
  --panel-soft: #f4f2ec;
  --line: #e8e6df;
  --line-strong: #d9d2c9;
  --ink: #4a443d;
  --muted: #8d867d;
  --accent: #c3765a;
  --shadow: 0 18px 40px rgba(53, 41, 35, 0.08);
  --radius-card: 28px;
  --radius-pill: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', sans-serif;
  background:
    radial-gradient(circle at top, rgba(223, 201, 164, 0.24), transparent 30%),
    linear-gradient(180deg, #faf8f4 0%, #f2efe9 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

#root {
  min-height: 100vh;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 18px 48px;
}

.app-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.app-header,
.toolbar,
.module-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 22px 28px;
  border-radius: 28px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.brand-title {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.transport-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 16px 8px 10px;
  background: rgba(248, 247, 243, 0.9);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.control-button,
.icon-button,
.blend-button {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.control-button {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(35, 28, 24, 0.08);
}

.control-button--primary {
  background: var(--ink);
  color: white;
}

.control-button--primary:hover,
.blend-button:hover,
.icon-button:hover,
.module-toggle:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--muted);
}

.icon-button svg,
.blend-button svg,
.module-toggle svg {
  width: 18px;
  height: 18px;
}

.divider {
  width: 2px;
  height: 34px;
  background: var(--line);
  border-radius: 999px;
}

.master-volume-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(220px, 34vw);
}

.volume-slider {
  --val: 100%;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b4aea4 0 var(--val), #e8e6df var(--val) 100%);
}

.volume-slider:focus {
  outline: none;
}

.volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.volume-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-strong);
  border: 2px solid #a8a196;
  box-shadow: 0 4px 14px rgba(30, 25, 22, 0.12);
  margin-top: -5px;
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-strong);
  border: 2px solid #a8a196;
  box-shadow: 0 4px 14px rgba(30, 25, 22, 0.12);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 10px 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.4);
}

.toolbar-title {
  margin: 0;
  padding-left: 10px;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.blend-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  font-weight: 800;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 12px rgba(44, 36, 31, 0.04);
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  padding-bottom: 18px;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 280px;
  padding: 22px 18px 18px;
  border-radius: var(--radius-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.module-card--idle {
  background: var(--panel-soft);
  border-color: var(--line);
  opacity: 0.82;
}

.module-card--active {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(191, 161, 136, 0.6);
  box-shadow: 0 18px 32px rgba(38, 29, 24, 0.08);
}

.module-color {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.module-color--rain { color: #6ea1c4; }
.module-color--storm { color: #5c6e91; }
.module-color--wind { color: #a0b092; }
.module-color--waves { color: #6faaa2; }
.module-color--stream { color: #7d9f6f; }
.module-color--train { color: #9c948b; }
.module-color--noise { color: #b0aba0; }
.module-color--fireplace { color: #c87958; }
.module-color--forest { color: #78916d; }
.module-color--night { color: #787d9b; }

.module-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 241, 236, 0.65));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 18px rgba(72, 58, 49, 0.08);
  border: 1px solid rgba(143, 128, 118, 0.15);
}

.module-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
}

.control-button--playing {
  background: var(--ink);
  color: #ffffff;
}

.control-button--paused {
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  border: 1px solid var(--line);
}

.icon-button.is-muted {
  color: var(--accent);
}

.module-card:hover {
  transform: translateY(-2px);
}

.module-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.module-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 86px;
  height: 86px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 239, 232, 0.78));
  color: #b9b0a4;
  border: 1px solid rgba(114, 102, 92, 0.08);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.02), 0 12px 24px rgba(37, 29, 24, 0.06);
}

.module-toggle.is-active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 245, 239, 0.88));
  color: var(--ink);
  border-color: rgba(79, 69, 60, 0.08);
  box-shadow: inset 0 0 0 1px rgba(79, 69, 60, 0.04), 0 14px 26px rgba(37, 29, 24, 0.07);
}

.module-label {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.module-card--active .module-label {
  color: var(--ink);
}

.module-controls {
  display: grid;
  gap: 18px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.module-card--idle .module-controls {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.control-row {
  display: grid;
  gap: 8px;
}

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.mute-button {
  padding: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.mute-button.is-muted {
  color: var(--accent);
}

.module-card .volume-slider,
.module-card .pan-slider {
  --val: 50%;
}

.pan-slider {
  --val: 50%;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d9d2c9 0 var(--val), #ece8e2 var(--val) 100%);
}

.pan-slider:focus {
  outline: none;
}

.pan-slider::-webkit-slider-runnable-track,
.pan-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.pan-slider::-webkit-slider-thumb,
.pan-slider::-moz-range-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-strong);
  border: 2px solid #a8a196;
  box-shadow: 0 4px 14px rgba(30, 25, 22, 0.12);
  margin-top: -5px;
}

.pan-value {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 980px) {
  .modules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .app-header,
  .toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .app-header {
    align-items: stretch;
  }

  .transport-panel {
    justify-content: space-between;
    width: 100%;
  }

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

  .master-volume-wrap {
    width: min(200px, 55vw);
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #e0ddd5;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #cfcac1;
}
