    /* ─────────────────────────────────────────────
       DESIGN TOKENS
    ───────────────────────────────────────────── */
    :root {
      --c-bg:          #0d1117;
      --c-surface:     #161b22;
      --c-surface2:    #21262d;
      --c-border:      rgba(255,255,255,0.08);
      --c-border2:     rgba(255,255,255,0.14);
      --c-text-primary:#e6edf3;
      --c-text-secondary:#8b949e;
      --c-text-muted:  #6e7681;

      --c-safe:        #2ddc6e;
      --c-safe-glow:   rgba(45,220,110,0.35);
      --c-safe-dim:    rgba(45,220,110,0.12);
      --c-danger:      #f85149;
      --c-danger-glow: rgba(248,81,73,0.35);
      --c-danger-dim:  rgba(248,81,73,0.12);

      --c-accent:      #58a6ff;
      --c-accent-hover:#79b8ff;
      --c-brand:       #1a6cff;
      --c-brand-light: #4d93ff;

      --c-naver:       #03C75A;
      --c-naver-dark:  #02a94d;

      --radius-sm:     8px;
      --radius-md:     14px;
      --radius-lg:     20px;
      --radius-xl:     28px;

      --shadow-card:   0 4px 24px rgba(0,0,0,0.5);
      --shadow-modal:  0 8px 48px rgba(0,0,0,0.7);
      --shadow-marker: 0 2px 12px rgba(0,0,0,0.6);

      --sheet-collapsed-h: 200px;
      --sheet-expanded-h:  70vh;
      --header-h:          64px;

      --font:  'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --transition: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* ─────────────────────────────────────────────
       RESET & BASE
    ───────────────────────────────────────────── */
    *, *::before, *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    html, body {
      height: 100%;
      width: 100%;
      overflow: hidden;
      font-family: var(--font);
      background: var(--c-bg);
      color: var(--c-text-primary);
      -webkit-font-smoothing: antialiased;
    }

    button {
      font-family: var(--font);
      cursor: pointer;
      border: none;
      outline: none;
    }

    input {
      font-family: var(--font);
    }

    /* ─────────────────────────────────────────────
       MAP CONTAINER (Full Screen)
    ───────────────────────────────────────────── */
    #map {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 0;
      background:
        repeating-linear-gradient(
          0deg,
          transparent,
          transparent 59px,
          rgba(255,255,255,0.03) 59px,
          rgba(255,255,255,0.03) 60px
        ),
        repeating-linear-gradient(
          90deg,
          transparent,
          transparent 59px,
          rgba(255,255,255,0.03) 59px,
          rgba(255,255,255,0.03) 60px
        ),
        repeating-linear-gradient(
          -45deg,
          transparent,
          transparent 120px,
          rgba(255,255,255,0.015) 120px,
          rgba(255,255,255,0.015) 121px
        ),
        radial-gradient(ellipse at 30% 40%, #0f1e35 0%, #0d1520 50%, #080e18 100%);
      overflow: hidden;
    }

    #map-dummy {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }

    #map.map-load-failed {
      background: radial-gradient(ellipse at 30% 40%, #0f1e35 0%, #0d1520 50%, #080e18 100%);
    }

    .map-road {
      position: absolute;
      background: rgba(255,255,255,0.04);
      border-radius: 2px;
    }

    .map-block {
      position: absolute;
      background: rgba(255,255,255,0.025);
      border-radius: 4px;
    }

    /* ─────────────────────────────────────────────
       HEADER
    ───────────────────────────────────────────── */
    #header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: var(--header-h);
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      background: rgba(13,17,23,0.82);
      backdrop-filter: blur(20px) saturate(1.6);
      -webkit-backdrop-filter: blur(20px) saturate(1.6);
      border-bottom: 1px solid var(--c-border);
    }

    #logo {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #logo-icon {
      width: 36px;
      height: 36px;
      background: linear-gradient(135deg, var(--c-brand) 0%, #0040cc 100%);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      box-shadow: 0 0 16px rgba(26,108,255,0.5);
      flex-shrink: 0;
    }

    #logo-text {
      display: flex;
      flex-direction: column;
      line-height: 1.1;
    }

    #logo-text .main {
      font-size: 15px;
      font-weight: 700;
      letter-spacing: -0.4px;
      color: var(--c-text-primary);
    }

    #logo-text .sub {
      font-size: 10px;
      font-weight: 400;
      color: var(--c-text-muted);
      letter-spacing: 0.2px;
    }

    #danger-toggle-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #danger-label {
      font-size: 12px;
      font-weight: 600;
      color: var(--c-danger);
      white-space: nowrap;
    }

    /* iOS-style toggle */
    .toggle-switch {
      position: relative;
      width: 44px;
      height: 26px;
      flex-shrink: 0;
    }

    .toggle-switch input {
      position: absolute;
      opacity: 0;
      width: 0;
      height: 0;
    }

    .toggle-track {
      position: absolute;
      inset: 0;
      border-radius: 13px;
      background: var(--c-surface2);
      border: 1px solid var(--c-border2);
      transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
      cursor: pointer;
    }

    .toggle-thumb {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: var(--c-text-muted);
      transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
      box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    }

    .toggle-switch input:checked + .toggle-track {
      background: var(--c-danger);
      border-color: var(--c-danger);
      box-shadow: 0 0 12px var(--c-danger-glow);
    }

    .toggle-switch input:checked + .toggle-track .toggle-thumb {
      transform: translateX(18px);
      background: #fff;
      box-shadow: 0 1px 6px rgba(248,81,73,0.5);
    }

    /* ─────────────────────────────────────────────
       MAP MARKERS
    ───────────────────────────────────────────── */
    .marker-wrap {
      position: absolute;
      transform: translate(-50%, -100%);
      cursor: pointer;
      z-index: 10;
      transition: transform 0.15s ease, filter 0.15s ease;
    }

    .marker-wrap:hover {
      transform: translate(-50%, -100%) scale(1.15);
      z-index: 20;
    }

    .marker-wrap:active {
      transform: translate(-50%, -100%) scale(0.95);
    }

    .marker-pin {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .marker-bubble {
      display: flex;
      align-items: center;
      gap: 5px;
      padding: 5px 10px 5px 7px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
      box-shadow: var(--shadow-marker);
      border: 1.5px solid transparent;
      position: relative;
    }

    .marker-safe .marker-bubble {
      background: rgba(10,25,15,0.95);
      border-color: var(--c-safe);
      color: var(--c-safe);
      box-shadow: 0 2px 16px var(--c-safe-glow);
    }

    .marker-danger .marker-bubble {
      background: rgba(30,10,10,0.95);
      border-color: var(--c-danger);
      color: var(--c-danger);
      box-shadow: 0 2px 16px var(--c-danger-glow);
    }

    .marker-icon {
      font-size: 13px;
      line-height: 1;
    }

    .marker-tail {
      width: 2px;
      height: 8px;
      border-radius: 0 0 2px 2px;
    }

    .marker-safe .marker-tail {
      background: var(--c-safe);
      box-shadow: 0 2px 6px var(--c-safe-glow);
    }

    .marker-danger .marker-tail {
      background: var(--c-danger);
      box-shadow: 0 2px 6px var(--c-danger-glow);
    }

    .marker-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
    }

    .marker-safe .marker-dot {
      background: var(--c-safe);
      box-shadow: 0 0 8px var(--c-safe-glow);
    }

    .marker-danger .marker-dot {
      background: var(--c-danger);
      box-shadow: 0 0 8px var(--c-danger-glow);
    }

    .marker-safe .marker-bubble::after {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: 24px;
      border: 1.5px solid var(--c-safe);
      opacity: 0;
      animation: pulse-ring 2.4s ease-out infinite;
    }

    @keyframes pulse-ring {
      0%   { opacity: 0.6; transform: scale(1); }
      100% { opacity: 0;   transform: scale(1.35); }
    }

    /* ─────────────────────────────────────────────
       BOTTOM SHEET
    ───────────────────────────────────────────── */
    #bottom-sheet {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 50;
      border-radius: var(--radius-xl) var(--radius-xl) 0 0;
      background: rgba(22,27,34,0.96);
      backdrop-filter: blur(24px) saturate(1.8);
      -webkit-backdrop-filter: blur(24px) saturate(1.8);
      border: 1px solid var(--c-border2);
      border-bottom: none;
      box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
      transition: height var(--transition);
      height: var(--sheet-collapsed-h);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    #bottom-sheet.expanded {
      height: var(--sheet-expanded-h);
    }

    #sheet-handle-wrap {
      padding: 14px 0 8px;
      display: flex;
      justify-content: center;
      cursor: grab;
      flex-shrink: 0;
    }

    #sheet-handle-wrap:active { cursor: grabbing; }

    #sheet-handle {
      width: 40px;
      height: 4px;
      border-radius: 2px;
      background: var(--c-border2);
      transition: background 0.2s ease, width 0.2s ease;
    }

    #bottom-sheet.expanded #sheet-handle,
    #sheet-handle-wrap:hover #sheet-handle {
      background: var(--c-text-muted);
      width: 48px;
    }

    #sheet-header {
      padding: 0 20px 12px;
      flex-shrink: 0;
    }

    #sheet-title {
      font-size: 18px;
      font-weight: 800;
      letter-spacing: -0.5px;
      color: var(--c-text-primary);
    }

    #sheet-subtitle {
      font-size: 12px;
      color: var(--c-text-muted);
      margin-top: 2px;
    }

    #sheet-body {
      flex: 1;
      overflow-y: auto;
      padding: 0 20px 32px;
      scroll-behavior: smooth;
      -webkit-overflow-scrolling: touch;
    }

    #sheet-body::-webkit-scrollbar { display: none; }

    /* 예산 칩 */
    #budget-summary {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 10px;
      margin-bottom: 20px;
    }

    .budget-chip {
      background: var(--c-surface2);
      border: 1px solid var(--c-border);
      border-radius: var(--radius-md);
      padding: 12px 10px;
      text-align: center;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .budget-chip.highlight {
      border-color: var(--c-accent);
      box-shadow: 0 0 12px rgba(88,166,255,0.15);
    }

    .budget-chip-label {
      font-size: 10px;
      color: var(--c-text-muted);
      font-weight: 500;
      margin-bottom: 4px;
    }

    .budget-chip-value {
      font-size: 14px;
      font-weight: 700;
      color: var(--c-text-primary);
      letter-spacing: -0.3px;
    }

    .budget-chip-value.accent { color: var(--c-accent); }
    .budget-chip-value.safe   { color: var(--c-safe); }

    /* 폼 */
    .form-group {
      margin-bottom: 16px;
    }

    .form-label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: var(--c-text-secondary);
      margin-bottom: 8px;
      letter-spacing: 0.1px;
    }

    .input-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }

    .input-prefix {
      position: absolute;
      left: 14px;
      font-size: 14px;
      font-weight: 500;
      color: var(--c-text-muted);
      pointer-events: none;
    }

    .input-suffix {
      position: absolute;
      right: 14px;
      font-size: 12px;
      font-weight: 500;
      color: var(--c-text-muted);
      pointer-events: none;
    }

    .form-input {
      width: 100%;
      height: 52px;
      padding: 0 56px 0 36px;
      background: var(--c-surface2);
      border: 1.5px solid var(--c-border2);
      border-radius: var(--radius-md);
      color: var(--c-text-primary);
      font-size: 17px;
      font-weight: 600;
      letter-spacing: -0.2px;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
      -webkit-appearance: none;
    }

    .form-input::placeholder {
      color: var(--c-text-muted);
      font-weight: 400;
      font-size: 14px;
    }

    .form-input:focus {
      outline: none;
      border-color: var(--c-accent);
      background: rgba(88,166,255,0.06);
      box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
    }

    .form-hint {
      font-size: 11px;
      color: var(--c-text-muted);
      margin-top: 6px;
      line-height: 1.5;
    }

    .hint-highlight {
      color: var(--c-safe);
      font-weight: 600;
    }

    .form-divider {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 20px 0;
    }

    .form-divider-line {
      flex: 1;
      height: 1px;
      background: var(--c-border);
    }

    .form-divider-text {
      font-size: 11px;
      color: var(--c-text-muted);
      font-weight: 500;
    }

    /* 버팀목 정보 카드 */
    #loan-info-card {
      background: linear-gradient(135deg, rgba(26,108,255,0.1) 0%, rgba(0,64,204,0.06) 100%);
      border: 1px solid rgba(26,108,255,0.25);
      border-radius: var(--radius-md);
      padding: 14px 16px;
      margin-bottom: 20px;
      display: flex;
      align-items: flex-start;
      gap: 12px;
    }

    #loan-info-card .icon {
      font-size: 22px;
      flex-shrink: 0;
      margin-top: 1px;
    }

    #loan-info-card .title {
      font-size: 13px;
      font-weight: 700;
      color: var(--c-accent);
      margin-bottom: 3px;
    }

    #loan-info-card .desc {
      font-size: 11px;
      color: var(--c-text-muted);
      line-height: 1.6;
    }

    #loan-info-card .desc strong {
      color: var(--c-text-secondary);
      font-weight: 600;
    }

    /* 액션 버튼 */
    #btn-find {
      width: 100%;
      height: 56px;
      border-radius: var(--radius-md);
      background: linear-gradient(135deg, var(--c-brand) 0%, #0052dd 100%);
      color: #fff;
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -0.2px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      box-shadow: 0 4px 20px rgba(26,108,255,0.45);
      transition: transform 0.15s ease, box-shadow 0.15s ease;
      position: relative;
      overflow: hidden;
      margin-top: 4px;
    }

    #btn-find::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
      border-radius: inherit;
    }

    #btn-find:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 28px rgba(26,108,255,0.55);
    }

    #btn-find:active {
      transform: translateY(0) scale(0.98);
      box-shadow: 0 2px 12px rgba(26,108,255,0.3);
    }

    #btn-find:disabled {
      background: var(--c-surface2);
      box-shadow: none;
      color: var(--c-text-muted);
      cursor: not-allowed;
      transform: none;
    }

    #btn-find .btn-icon { font-size: 18px; }

    /* ─────────────────────────────────────────────
       LEGEND
    ───────────────────────────────────────────── */
    #legend {
      position: fixed;
      bottom: calc(var(--sheet-collapsed-h) + 14px);
      left: 16px;
      z-index: 49;
      display: flex;
      flex-direction: column;
      gap: 6px;
      transition: bottom var(--transition);
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 7px;
      background: rgba(13,17,23,0.85);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-radius: 20px;
      padding: 5px 10px 5px 7px;
      border: 1px solid var(--c-border);
    }

    .legend-dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .legend-dot.safe   { background: var(--c-safe);  box-shadow: 0 0 6px var(--c-safe-glow); }
    .legend-dot.danger { background: var(--c-danger); box-shadow: 0 0 6px var(--c-danger-glow); }

    .legend-text {
      font-size: 11px;
      color: var(--c-text-secondary);
      font-weight: 500;
    }

    /* ─────────────────────────────────────────────
       MODAL
    ───────────────────────────────────────────── */
    #modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 200;
      background: rgba(0,0,0,0.65);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease;
    }

    #modal-overlay.visible {
      opacity: 1;
      pointer-events: all;
    }

    #modal-card {
      width: 100%;
      max-width: 480px;
      background: var(--c-surface);
      border-radius: var(--radius-xl) var(--radius-xl) 0 0;
      border: 1px solid var(--c-border2);
      border-bottom: none;
      box-shadow: var(--shadow-modal);
      transform: translateY(100%);
      transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      position: relative;
    }

    #modal-overlay.visible #modal-card {
      transform: translateY(0);
    }

    #modal-handle-wrap {
      padding: 14px 0 10px;
      display: flex;
      justify-content: center;
    }

    #modal-handle {
      width: 40px;
      height: 4px;
      border-radius: 2px;
      background: var(--c-border2);
    }

    #modal-status-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.2px;
      margin: 0 20px 14px;
      width: fit-content;
    }

    #modal-status-badge.safe {
      background: var(--c-safe-dim);
      color: var(--c-safe);
      border: 1px solid rgba(45,220,110,0.3);
    }

    #modal-status-badge.danger {
      background: var(--c-danger-dim);
      color: var(--c-danger);
      border: 1px solid rgba(248,81,73,0.3);
    }

    #modal-body {
      padding: 0 20px 0;
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    #modal-body::-webkit-scrollbar { display: none; }

    #modal-name {
      font-size: 22px;
      font-weight: 800;
      letter-spacing: -0.6px;
      margin-bottom: 4px;
      line-height: 1.25;
    }

    #modal-address {
      font-size: 13px;
      color: var(--c-text-muted);
      margin-bottom: 22px;
    }

    #modal-stats {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 20px;
    }

    .stat-card {
      background: var(--c-surface2);
      border: 1px solid var(--c-border);
      border-radius: var(--radius-md);
      padding: 14px;
      position: relative;
      overflow: hidden;
    }

    .stat-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 2px;
    }

    .stat-card.green::before  { background: var(--c-safe); }
    .stat-card.blue::before   { background: var(--c-accent); }
    .stat-card.orange::before { background: #f0883e; }
    .stat-card.neutral::before{ background: var(--c-text-muted); }

    .stat-label {
      font-size: 10px;
      color: var(--c-text-muted);
      font-weight: 500;
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }

    .stat-value {
      font-size: 17px;
      font-weight: 700;
      letter-spacing: -0.4px;
      color: var(--c-text-primary);
    }

    .stat-value.green  { color: var(--c-safe); }
    .stat-value.red    { color: var(--c-danger); }
    .stat-value.orange { color: #f0883e; }

    .stat-sub {
      font-size: 10px;
      color: var(--c-text-muted);
      margin-top: 2px;
    }

    #loan-limit-comparison {
      background: rgba(88,166,255,0.06);
      border: 1px solid rgba(88,166,255,0.2);
      border-radius: var(--radius-md);
      padding: 14px;
      margin-bottom: 20px;
    }

    .loan-limit-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .loan-limit-heading h3 {
      font-size: 13px;
      color: var(--c-text-primary);
    }

    .loan-limit-heading span {
      font-size: 10px;
      color: var(--c-safe);
      font-weight: 700;
    }

    .loan-limit-description {
      font-size: 11px;
      line-height: 1.5;
      color: var(--c-text-muted);
      margin: 6px 0 12px;
    }

    .loan-limit-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .loan-limit-card {
      background: var(--c-surface2);
      border: 1px solid var(--c-border);
      border-radius: var(--radius-sm);
      padding: 11px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .loan-limit-card.hug { border-color: rgba(45,220,110,0.35); }
    .loan-limit-card.hf { border-color: rgba(88,166,255,0.35); }

    .loan-limit-label,
    .loan-limit-sub {
      font-size: 10px;
      color: var(--c-text-muted);
      line-height: 1.35;
    }

    .loan-limit-card strong {
      font-size: 16px;
      letter-spacing: -0.3px;
    }

    .loan-limit-card.hug strong { color: var(--c-safe); }
    .loan-limit-card.hf strong { color: var(--c-accent); }

    /* 전세가율 바 */
    #ratio-bar-wrap {
      background: var(--c-surface2);
      border: 1px solid var(--c-border);
      border-radius: var(--radius-md);
      padding: 14px 16px;
      margin-bottom: 20px;
    }

    #ratio-bar-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }

    #ratio-bar-title {
      font-size: 11px;
      font-weight: 600;
      color: var(--c-text-secondary);
    }

    #ratio-bar-value {
      font-size: 15px;
      font-weight: 700;
    }

    #ratio-bar-track {
      height: 8px;
      background: var(--c-bg);
      border-radius: 4px;
      overflow: visible;
      position: relative;
      /* 아래쪽에 라벨 공간 확보 */
      margin-bottom: 22px;
    }

    /* fill 레이어 컨테이너 */
    #ratio-bar-fills {
      position: absolute;
      inset: 0;
      border-radius: 4px;
      overflow: hidden;
      display: flex;
    }

    /* 안전 구간 (0 ~ 126%) */
    #ratio-bar-fill-safe {
      height: 100%;
      background: linear-gradient(90deg, #1a3a28 0%, var(--c-safe) 100%);
      transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
      flex-shrink: 0;
    }

    /* 위험 구간 (126% ~) */
    #ratio-bar-fill-danger {
      height: 100%;
      background: linear-gradient(90deg, #f0883e 0%, var(--c-danger) 100%);
      transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
      flex-shrink: 0;
    }

    /* 126% 위험선 마커 – fill보다 위에 렌더 */
    #ratio-bar-threshold {
      position: absolute;
      top: -3px;
      bottom: -3px;
      width: 3px;
      background: var(--c-danger);
      /* 150% 스케일에서 126% 위치 = 84% */
      left: 84%;
      z-index: 2;
      border-radius: 2px;
      box-shadow: 0 0 6px var(--c-danger-glow);
      transform: translateX(-50%);
      transition: box-shadow 0.3s ease;
    }

    /* 초과 시 기준선 강조 애니메이션 */
    #ratio-bar-threshold.exceeded {
      box-shadow: 0 0 0 2px rgba(248,81,73,0.25), 0 0 12px var(--c-danger-glow);
      animation: threshold-pulse 1.6s ease-out infinite;
    }

    @keyframes threshold-pulse {
      0%, 100% { box-shadow: 0 0 6px var(--c-danger-glow); }
      50%       { box-shadow: 0 0 0 3px rgba(248,81,73,0.2), 0 0 16px var(--c-danger); }
    }

    #ratio-bar-threshold-label {
      position: absolute;
      /* 바 트랙 아래쪽에 배치 – 헤더 텍스트와 겹치지 않음 */
      top: 14px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 9px;
      color: var(--c-danger);
      font-weight: 700;
      white-space: nowrap;
    }

    #ratio-bar-caution {
      font-size: 10px;
      color: var(--c-text-muted);
      margin-top: 0;
      line-height: 1.5;
    }

    /* 위험 배너 */
    #modal-danger-banner {
      background: var(--c-danger-dim);
      border: 1px solid rgba(248,81,73,0.25);
      border-radius: var(--radius-md);
      padding: 12px 14px;
      margin-bottom: 16px;
      display: none;
    }

    #modal-danger-banner.show {
      display: flex;
      gap: 10px;
      align-items: flex-start;
    }

    #modal-danger-banner .icon {
      font-size: 16px;
      flex-shrink: 0;
    }

    #modal-danger-banner .text {
      font-size: 12px;
      color: var(--c-danger);
      font-weight: 500;
      line-height: 1.6;
    }

    /* 네이버 버튼 */
    #modal-footer {
      padding: 16px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
      border-top: 1px solid var(--c-border);
      flex-shrink: 0;
    }

    #btn-naver {
      width: 100%;
      height: 56px;
      border-radius: var(--radius-md);
      background: var(--c-naver);
      color: #fff;
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -0.2px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-decoration: none;
      box-shadow: 0 4px 20px rgba(3,199,90,0.35);
      transition: transform 0.15s ease, box-shadow 0.15s ease;
      position: relative;
      overflow: hidden;
    }

    #btn-naver::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    }

    #btn-naver:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 28px rgba(3,199,90,0.45);
    }

    #btn-naver:active {
      transform: translateY(0) scale(0.98);
    }

    .naver-logo {
      font-size: 17px;
      font-weight: 900;
      font-style: italic;
    }

    #modal-close {
      position: absolute;
      top: 12px;
      right: 16px;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--c-surface2);
      border: 1px solid var(--c-border);
      color: var(--c-text-secondary);
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.15s ease, color 0.15s ease;
      z-index: 10;
    }

    #modal-close:hover {
      background: var(--c-border2);
      color: var(--c-text-primary);
    }

    /* ─────────────────────────────────────────────
       TOAST
    ───────────────────────────────────────────── */
    #toast {
      position: fixed;
      top: calc(var(--header-h) + 12px);
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      z-index: 300;
      background: var(--c-surface2);
      border: 1px solid var(--c-border2);
      border-radius: 20px;
      padding: 10px 18px;
      font-size: 13px;
      font-weight: 600;
      color: var(--c-text-primary);
      white-space: nowrap;
      opacity: 0;
      transition: opacity 0.25s ease, transform 0.25s ease;
      pointer-events: none;
      box-shadow: var(--shadow-card);
    }

    #toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* ─────────────────────────────────────────────
       RESULT COUNT
    ───────────────────────────────────────────── */
    #result-count {
      position: fixed;
      top: calc(var(--header-h) + 12px);
      right: 16px;
      z-index: 49;
      background: rgba(13,17,23,0.9);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--c-border2);
      border-radius: 20px;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      color: var(--c-text-secondary);
      display: none;
      align-items: center;
      gap: 5px;
      box-shadow: var(--shadow-card);
    }

    #result-count.show { display: flex; }

    #result-count-num {
      color: var(--c-safe);
      font-weight: 700;
      font-size: 14px;
    }

    /* ─────────────────────────────────────────────
       ANIMATIONS
    ───────────────────────────────────────────── */
    @keyframes marker-pop {
      0%   { transform: translate(-50%, -100%) scale(0) rotate(-10deg); opacity: 0; }
      70%  { transform: translate(-50%, -100%) scale(1.15) rotate(2deg);  opacity: 1; }
      100% { transform: translate(-50%, -100%) scale(1) rotate(0deg);     opacity: 1; }
    }

    .marker-wrap {
      animation: marker-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    }

    @keyframes fade-in {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .fade-in {
      animation: fade-in 0.3s ease both;
    }

    /* ─────────────────────────────────────────────
       RESPONSIVE – Desktop
    ───────────────────────────────────────────── */
    @media (min-width: 640px) {
      #bottom-sheet {
        left: auto;
        right: 20px;
        bottom: 20px;
        width: 360px;
        border-radius: var(--radius-xl);
        border: 1px solid var(--c-border2);
        border-bottom: 1px solid var(--c-border2);
      }

      #bottom-sheet.expanded {
        height: min(80vh, 640px);
      }

      #modal-overlay {
        align-items: center;
      }

      #modal-card {
        border-radius: var(--radius-xl);
        max-width: 400px;
        border: 1px solid var(--c-border2);
        margin-bottom: 0;
      }

      #legend {
        bottom: 80px;
        left: 24px;
      }
    }
