:root {
  --bg: #071018;
  --bg-soft: rgba(8, 18, 25, 0.8);
  --panel: rgba(8, 16, 23, 0.68);
  --panel-strong: rgba(8, 16, 23, 0.84);
  --panel-border: rgba(194, 244, 255, 0.16);
  --text: #f3f7fb;
  --muted: #8ea4b6;
  --accent: #7af4ff;
  --accent-strong: #11d9ff;
  --accent-warm: #ffb66d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(17, 217, 255, 0.18), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(255, 157, 68, 0.12), transparent 22%),
    linear-gradient(180deg, #050b10 0%, #08131b 44%, #03070a 100%);
}


/* 스크롤 가능한 영역 설정 */
.dock-section {
    overflow-y: auto;
    max-height: 100vh;
}

/* =========================
   WebKit (Chrome, Edge, Safari)
========================= */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.dock-section::-webkit-scrollbar {
    width: 3px;
}

body::-webkit-scrollbar-track,
.dock-section::-webkit-scrollbar-track {
    background: #0b0f1a;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.dock-section::-webkit-scrollbar-thumb {
    background: #0b0f1a;
    border-radius: 10px;
}

body::-webkit-scrollbar-thumb:hover,
.dock-section::-webkit-scrollbar-thumb:hover {
    background: #0b0f1a;
}

/* =========================
   Firefox
========================= */
body,
.dock-section {
    scrollbar-width: thin;
    scrollbar-color: #444 #1e1e1e;
}
/* 스크롤 시에만 보이게 (고급) */
body:not(:hover)::-webkit-scrollbar-thumb,
.dock-section:not(:hover)::-webkit-scrollbar-thumb {
    background: transparent;
}



.site-shell {
  width: min(1560px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 20px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 24px;
  margin-bottom: 18px;
}

.site-brand {
  color: var(--text);
  text-decoration: none;
  font-family: "Syne", sans-serif;
  font-size: 1.1rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.site-nav a[aria-current="page"] {
  color: #041117;
  background: linear-gradient(135deg, rgba(152, 248, 255, 0.96), rgba(30, 218, 255, 0.92));
}

.app-shell {
  width: min(1560px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 20px;
}

.hero {
  margin-bottom: 18px;
}

.hero-copy {
  max-width: 760px;
}

.hero-compact {
  margin-bottom: 18px;
}

.site-hero,
.content-page {
  border-radius: 28px;
  padding: 28px;
}

.site-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-link,
.ghost-link,
.text-link {
  text-decoration: none;
}

.primary-link,
.ghost-link {
  padding: 12px 16px;
  border-radius: 16px;
}

.primary-link {
  color: #031118;
  background: linear-gradient(135deg, #98f8ff, #1fd9ff);
}

.ghost-link {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.content-card {
  padding: 22px;
  border-radius: 24px;
}

.content-card h2,
.faq-item h2 {
  margin: 10px 0 10px;
  font-family: "Syne", sans-serif;
}

.content-card p,
.content-flow p,
.faq-item p {
  color: var(--muted);
}

.text-link {
  color: var(--accent);
}

.content-flow {
  display: grid;
  gap: 14px;
}

.content-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.faq-list {
  display: grid;
  gap: 14px;
}

.faq-item {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.24em;
  font-size: 0.72rem;
}

h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.94;
}

.lede {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
}

.panel {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(14, 26, 36, 0.84), rgba(7, 15, 22, 0.72));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.visual-stage {
  position: relative;
  min-height: calc(100vh - 170px);
  overflow: hidden;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  background:
    radial-gradient(circle at center, rgba(122, 244, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.08));
}

.three-stage,
#cymatics-canvas {
  position: absolute;
  inset: 0;
}

.three-stage {
  z-index: 1;
}

#cymatics-canvas {
  display: block;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0.88;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: saturate(1.18) contrast(1.08);
}

.control-dock {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: calc(100vh - 170px);
  max-height: calc(100vh - 170px);
  padding: 18px 18px 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(10, 18, 25, 0.84), rgba(7, 14, 20, 0.74));
  overflow-y: auto;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.panel-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#frequency-readout {
  display: block;
  font-size: clamp(1.3rem, 2.2vw, 2.0rem);
  line-height: 1;
}

.status-stack {
  display: grid;
  gap: 6px;
  margin: 14px 0 16px;
}

.dock-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.subpanel+.subpanel {
  margin-top: 14px;
}

.subpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
}

.subtle-text {
  font-size: 0.78rem;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(130px, 160px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.control-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.compact-row {
  padding-top: 2px;
}

.control-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.control-copy strong {
  font-size: 0.94rem;
}

.control-ui {
  min-width: 0;
}

.frequency-ui {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

.segmented-row,
.action-row,
.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.action-row {
  margin-top: 10px;
}

.radio-row {
  display: grid;
  grid-template-columns: minmax(130px, 160px) minmax(0, 1fr);
  align-items: center;
}

.radio-row .control-copy {
  margin: 0;
}

input,
button {
  font: inherit;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(4, 13, 18, 0.72);
  color: var(--text);
}

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

button {
  border: 0;
  border-radius: 16px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: default;
  opacity: 0.5;
  transform: none;
}

.primary-button {
  color: #031118;
  background: linear-gradient(135deg, #98f8ff, #1fd9ff);
  box-shadow: 0 12px 30px rgba(17, 217, 255, 0.24);
  flex: 1 1 auto;
}

.secondary-button {
  color: #031118;
  background: linear-gradient(135deg, #ffb998, #ff981f);
  box-shadow: 0 12px 30px rgba(255, 152, 31, 0.24);
  flex: 1 1 auto;
}


.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.compact-button {
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.pill-option {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1 1 0;
}

.pill-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.84rem;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.pill-group {
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.pill-group .pill-option+.pill-option span {
  border-left-width: 0;
}

.pill-group .pill-option:first-child span {
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
}

.pill-group .pill-option:last-child span {
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
}

.pill-option input:checked+span {
  color: #041117;
  border-color: rgba(17, 217, 255, 0.4);
  background: linear-gradient(135deg, rgba(152, 248, 255, 0.96), rgba(30, 218, 255, 0.92));
  box-shadow: inset 0 0 0 1px rgba(17, 217, 255, 0.16);
}

.preset-list {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  margin-top: 12px;
}

.preset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.preset-meta {
  min-width: 0;
}

.preset-title {
  display: block;
  font-size: 0.92rem;
}

.preset-details {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  color: #021017;
  background: linear-gradient(135deg, #ffd29b, #ffb35b);
}

.preset-list-empty {
  padding: 14px;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-shell[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 10, 0.72);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: min(82vh, 900px);
  border-radius: 28px;
  padding: 20px;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 6px 0 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.modal-body {
  overflow: auto;
  max-height: calc(82vh - 96px);
  padding-right: 4px;
}

#spectrum-canvas {
  width: 100%;
  height: 120px;
  display: block;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(19, 31, 41, 0.95), rgba(7, 14, 20, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.07);
}

@media (max-width: 1280px) {
  .control-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .radio-row {
    grid-template-columns: minmax(130px, 160px) minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 960px) {
  .site-shell,
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .site-header,
  .site-hero {
    flex-direction: column;
    align-items: start;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
  }

  .visual-stage {
    min-height: auto;
    padding: 16px;
    display: grid;
    gap: 14px;
  }

  .three-stage,
  #cymatics-canvas {
    inset: 0;
  }

  .control-dock {
    position: relative;
    inset: auto;
    width: 100%;
    max-height: none;
    min-height: auto;
  }

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

@media (max-width: 720px) {

  .visual-stage,
  .control-dock {
    border-radius: 24px;
  }

  .frequency-ui {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: start;
    flex-direction: column;
  }

  .segmented-row,
  .action-row,
  .pill-group {
    flex-wrap: wrap;
  }
}
