:root {
  --ambient-hue: 28;
  --ambient-sat: 88%;
  --ambient-top: hsl(28, 72%, 26%);
  --ambient-mid: hsl(24, 62%, 14%);
  --ambient-deep: hsl(22, 45%, 7%);
  --ambient-bright: hsl(28, 88%, 62%);
  --brightness-level: 0.8;

  --surface-dark: rgba(14, 15, 18, 0.46);
  --surface-dark-hover: rgba(20, 21, 26, 0.58);
  --surface-dock: rgba(14, 15, 18, 0.56);
  --surface-active: rgba(255, 255, 255, 0.94);

  --border-subtle: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);

  --ink-light: rgba(255, 255, 255, 0.94);
  --ink-muted: rgba(255, 255, 255, 0.56);
  --ink-faint: rgba(255, 255, 255, 0.34);
  --ink-dark: #111215;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background-color: #090a0d;
  color: var(--ink-light);
  font-family: "Plus Jakarta Sans", "Pretendard", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.015em;
  overflow-x: hidden;
}

button,
input,
select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* =========================================================================
   선택한 조명 색상에 따라 화면 전체가 부드럽게 물드는 공간 배경
   ========================================================================= */
.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--ambient-top) 0%, transparent 70%),
    radial-gradient(95% 85% at 85% 100%, var(--ambient-mid) 0%, transparent 72%),
    linear-gradient(180deg, var(--ambient-mid) 0%, var(--ambient-deep) 100%);
  opacity: calc(0.32 + var(--brightness-level) * 0.68);
  transition: background 0.25s ease, opacity 0.2s ease;
}

/* 미세한 무광 필름 질감 (디지털 색 번짐 제거) */
.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wordmark {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.045em;
  color: #ffffff;
  user-select: none;
}

/* =========================================================================
   1. AUTH VIEW — 절제된 에디토리얼 로그인
   ========================================================================= */
.auth-view {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: rgba(14, 15, 19, 0.62);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 36px 28px 30px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.auth-header {
  margin-bottom: 26px;
}

.auth-header .wordmark {
  display: block;
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-muted);
  font-weight: 400;
}

.oauth-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.oauth-btn:active {
  transform: scale(0.99);
}

.oauth-google {
  background: #ffffff;
  color: var(--ink-dark);
  border: none;
}

.oauth-google:hover {
  opacity: 0.92;
}

.oauth-apple {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  border: 1px solid var(--border-subtle);
}

.oauth-apple:hover {
  background: rgba(255, 255, 255, 0.12);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--ink-faint);
  font-size: 11.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.28);
  padding: 3px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  padding: 7px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.form-field input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.24);
  color: #ffffff;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form-field input::placeholder {
  color: var(--ink-faint);
}

.form-field input:focus {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(0, 0, 0, 0.36);
}

.auth-message {
  margin: 2px 0;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  background: rgba(255, 95, 86, 0.16);
  color: #ffc2bb;
}

.auth-message.success {
  background: rgba(70, 210, 145, 0.16);
  color: #a8f5ce;
}

.solid-white-btn {
  margin-top: 4px;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 11px;
  background: #ffffff;
  color: var(--ink-dark);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.solid-white-btn:hover {
  opacity: 0.92;
}

.solid-white-btn:active {
  transform: scale(0.99);
}

/* =========================================================================
   2. MAIN STUDIO — 모던 아키텍처 레이아웃
   ========================================================================= */
.app-view {
  position: relative;
  z-index: 1;
  max-width: 900px;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    calc(26px + env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

@media (max-width: 820px) and (display-mode: standalone),
       (max-width: 820px) and (display-mode: fullscreen) {
  .app-view {
    padding-top: max(58px, calc(14px + env(safe-area-inset-top, 0px)));
  }
}

body.is-standalone-pwa .app-view {
  padding-top: max(58px, calc(14px + env(safe-area-inset-top, 0px)));
}

/* 상단 바 (모바일 노치 터치 간섭 방지 및 최상위 레이어 보장) */
.top-bar {
  position: relative;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.playing-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  font-variant-numeric: tabular-nums;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.nav-btn,
.nav-icon-btn,
.nav-pro-btn,
.nav-avatar-btn {
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-dark);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-btn {
  padding: 0 12px;
}

.nav-icon-btn {
  min-width: 38px;
  padding: 0 10px;
}

.nav-icon-btn.is-active {
  background: var(--surface-active);
  color: var(--ink-dark);
  border-color: transparent;
}

.timer-readout {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.nav-pro-btn {
  padding: 0 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.nav-avatar-btn {
  width: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 600;
}

.nav-btn:hover,
.nav-icon-btn:hover:not(.is-active),
.nav-pro-btn:hover,
.nav-avatar-btn:hover {
  background: var(--surface-dark-hover);
  border-color: var(--border-strong);
  color: #ffffff;
}

/* 깔끔한 미니 팝오버 */
.clean-popover {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 120;
  min-width: 224px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(16, 17, 21, 0.92);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.popover-heading {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.popover-row {
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.popover-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.popover-row.is-selected {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 600;
}

.popover-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-weight: 400;
}

/* =========================================================================
   중앙: 모던 택타일 사운드 패드 그리드
   꺼짐 = 스모크 다크 매트 유리 / 눌림(켜짐) = 선명한 펄 화이트 서피스
   ========================================================================= */
.sound-stage {
  flex: 1;
  display: flex;
  align-items: center;
}

.sound-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 760px) {
  .sound-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .sound-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

.sound-tile {
  position: relative;
  border-radius: 18px;
  background: var(--surface-dark);
  backdrop-filter: blur(28px) saturate(130%);
  -webkit-backdrop-filter: blur(28px) saturate(130%);
  border: 1px solid var(--border-subtle);
  padding: 16px 15px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  transition:
    transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.sound-tile:hover:not(.is-active) {
  background: var(--surface-dark-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.sound-tile.is-drop-hover {
  border-color: #ffffff;
  transform: scale(1.015);
}

/* 눌린 버튼 상태 (재생 중): 깔끔한 펄 화이트 택타일 타일 */
.sound-tile.is-active {
  transform: translateY(1.5px);
  background: var(--surface-active);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.sound-push-btn {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  user-select: none;
}

.sound-tile-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sound-icon-wrap {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.78);
  transition: color 0.18s ease;
}

.sound-tile.is-active .sound-icon-wrap {
  color: var(--ink-dark);
}

/* 잠금 아이콘(Pro 미구독 시 아주 절제된 미니 자물쇠) & 볼륨 수치 */
.tile-meta-right {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sound-tile.is-active .tile-meta-right {
  color: rgba(17, 18, 21, 0.52);
}

.lock-svg {
  opacity: 0.65;
}

body.is-pro-member .lock-svg {
  display: none;
}

.sound-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.88);
  transition: color 0.18s ease;
}

.sound-tile.is-active .sound-name {
  color: var(--ink-dark);
}

/* 미니멀 리니어 볼륨 슬라이더 */
.tile-vol-wrap {
  width: 100%;
  display: flex;
  align-items: center;
}

.tile-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.45) var(--vol, 65%),
    rgba(255, 255, 255, 0.1) var(--vol, 65%),
    rgba(255, 255, 255, 0.1) 100%
  );
  outline: none;
  cursor: pointer;
}

.sound-tile.is-active .tile-vol-slider {
  background: linear-gradient(
    90deg,
    #141519 0%,
    #141519 var(--vol, 65%),
    rgba(17, 18, 21, 0.14) var(--vol, 65%),
    rgba(17, 18, 21, 0.14) 100%
  );
}

.tile-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.sound-tile.is-active .tile-vol-slider::-webkit-slider-thumb {
  background: #141519;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.sound-tile:hover .tile-vol-slider::-webkit-slider-thumb,
.tile-vol-slider:active::-webkit-slider-thumb {
  opacity: 1;
}

@media (hover: none) {
  .tile-vol-slider::-webkit-slider-thumb {
    opacity: 1;
  }
}

/* =========================================================================
   하단: 모던 하드웨어 페이더 조명 컨트롤 바
   ========================================================================= */
.lighting-bar {
  background: var(--surface-dock);
  backdrop-filter: blur(36px) saturate(140%);
  -webkit-backdrop-filter: blur(36px) saturate(140%);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fader-columns {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .fader-columns {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.fader-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fader-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 18px;
}

.fader-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.fader-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  font-variant-numeric: tabular-nums;
}

.swatch-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tone-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--dot);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  padding: 0;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.tone-dot:hover {
  transform: scale(1.15);
}

.tone-dot.is-selected {
  border-color: #ffffff;
  transform: scale(1.2);
}

/* 1. 자연스러운 건축 조명 스펙트럼 페이더 바 (원색 네온 배제) */
.color-fader-track {
  position: relative;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(
    90deg,
    hsl(8, 76%, 58%) 0%,
    hsl(28, 86%, 60%) 10%,
    hsl(45, 82%, 66%) 20%,
    hsl(95, 48%, 56%) 35%,
    hsl(162, 54%, 52%) 48%,
    hsl(204, 72%, 58%) 62%,
    hsl(245, 62%, 64%) 76%,
    hsl(295, 56%, 64%) 88%,
    hsl(348, 72%, 60%) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
}

.color-fader-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.color-fader-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 28px;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  cursor: ew-resize;
}

/* 2. iOS 디스플레이 스타일 캡슐형 화면 밝기 페이더 바 */
.brightness-fader-track {
  position: relative;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.brightness-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--bright-pct, 80%);
  background: rgba(255, 255, 255, 0.88);
  pointer-events: none;
  transition: width 0.04s linear;
}

.brightness-icon {
  position: relative;
  z-index: 1;
  margin-left: 12px;
  color: #15161a;
  mix-blend-mode: difference;
  pointer-events: none;
}

.brightness-tone-name {
  position: relative;
  z-index: 1;
  margin-left: auto;
  margin-right: 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: #ffffff;
  mix-blend-mode: difference;
  pointer-events: none;
}

.brightness-fader-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  outline: none;
  cursor: ew-resize;
}

.brightness-fader-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 38px;
  background: transparent;
  cursor: ew-resize;
}

/* 하단 무드 스위치 & 전체화면 버튼 */
.lighting-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.motion-switch {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.26);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.motion-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.motion-btn:hover {
  color: #ffffff;
}

.motion-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.fullscreen-btn {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink-dark);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.fullscreen-btn:hover {
  opacity: 0.9;
}

.fullscreen-btn:active {
  transform: scale(0.985);
}

@media (max-width: 560px) {
  .fullscreen-btn {
    width: 100%;
    justify-content: center;
  }
}

/* =========================================================================
   3. FULLSCREEN AMBIENT LAMP (화면 터치 시 즉시 복귀)
   ========================================================================= */
.fullscreen-lamp {
  position: fixed;
  top: calc(-1 * env(safe-area-inset-top, 0px));
  right: calc(-1 * env(safe-area-inset-right, 0px));
  bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
  left: calc(-1 * env(safe-area-inset-left, 0px));
  width: calc(100vw + env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px));
  height: calc(100lvh + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  background: #000000;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
}

.fullscreen-lamp-glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  will-change: background, opacity;
}

.fullscreen-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12.5px;
  font-weight: 500;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.8s ease;
  white-space: nowrap;
}

.fullscreen-hint.fade-out {
  opacity: 0;
}

/* =========================================================================
   4. STRIPE PRO MODAL & TOAST
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #141519;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px 26px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-muted);
  cursor: pointer;
}

.modal-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.modal-title {
  margin: 6px 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.modal-desc {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
}

.plan-box {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.plan-box.featured {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.24);
}

.plan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.plan-name {
  font-size: 14px;
  font-weight: 600;
}

.plan-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.plan-price {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.plan-price span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

.plan-note {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--ink-muted);
  flex: 1;
}

.outline-btn {
  margin-top: 4px;
  width: 100%;
  height: 44px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.outline-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.stripe-sandbox-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  color: var(--ink-muted);
  text-align: center;
}

.stripe-sandbox-note code {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.pro-modal-status {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

.pro-reset-wrap {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.text-reset-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.payment-toast {
  position: fixed;
  top: max(20px, calc(12px + env(safe-area-inset-top, 0px)));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6500;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink-dark);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

/* DB 저장 조합 리스트 & 인라인 저장 폼 */
.popover-sep {
  height: 1px;
  margin: 6px 8px;
  background: rgba(255, 255, 255, 0.08);
}

.saved-mixes-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 140px;
  overflow-y: auto;
}

.saved-mix-empty {
  padding: 4px 10px 8px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.saved-mix-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.saved-mix-item .popover-row {
  flex: 1;
}

.delete-mix-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 13px;
  cursor: pointer;
}

.delete-mix-btn:hover {
  background: rgba(255, 95, 86, 0.18);
  color: #ffb4ab;
}

.save-mix-form {
  display: flex;
  gap: 6px;
  padding: 6px 4px 2px;
}

.save-mix-form input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 12px;
  outline: none;
}

.save-mix-form input:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

.save-mix-btn {
  height: 32px;
  padding: 0 11px;
  border: none;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* 로그인 정보 저장 체크박스 */
.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}

.remember-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  display: inline-grid;
  place-content: center;
  margin: 0;
  cursor: pointer;
  transition: all 0.14s ease;
}

.remember-row input[type="checkbox"]:checked {
  background: #ffffff;
  border-color: #ffffff;
}

.remember-row input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid var(--ink-dark);
  border-bottom: 2px solid var(--ink-dark);
  transform: rotate(-45deg) translate(1px, -1px);
}

/* 수면 타이머 직접 설정 모달 */
.timer-modal-card {
  max-width: 420px;
}

.custom-time-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.time-unit-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.time-unit-box label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.stepper-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-btn {
  width: 34px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s ease;
}

.step-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.stepper-control input[type="number"] {
  width: 64px;
  height: 44px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}

.stepper-control input[type="number"]::-webkit-outer-spin-button,
.stepper-control input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.unit-sub {
  font-size: 11px;
  color: var(--ink-faint);
}

.time-colon {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: 6px;
}

.fade-setting-block {
  margin-bottom: 20px;
}

.fade-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.fade-pill-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.fade-pill {
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.fade-pill.is-active {
  background: #ffffff;
  color: var(--ink-dark);
  border-color: #ffffff;
}

.timer-modal-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}
