@layer components {
  /* ═══ CCTV 지도 팝업 (어두운 톤) ═══ */
  .cctv-dark-popup .maplibregl-popup-content {
    background: #1a1f2e;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .cctv-dark-popup .maplibregl-popup-tip {
    border-top-color: #1a1f2e;
    border-bottom-color: #1a1f2e;
    border-left-color: transparent;
    border-right-color: transparent;
  }
  .cctv-dark-popup .maplibregl-popup-close-button {
    color: #888;
    font-size: 16px;
    right: 4px;
    top: 2px;
  }
  .cctv-dark-popup .maplibregl-popup-close-button:hover {
    color: #fff;
    background: transparent;
  }

  /* ═══ Scrollbar ═══ */
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--bdL) transparent;
  }

  .scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

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

  .scrollbar-thin::-webkit-scrollbar-thumb {
    background: var(--bdL);
    border-radius: 3px;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: var(--bd);
  }

  /* ═══ Prediction Input Form ═══ */
  .prd-i {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg0);
    border: 1px solid var(--bd);
    border-radius: 6px;
    color: var(--t1);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 11px;
    outline: none;
  }

  .prd-i:focus {
    border-color: var(--cyan);
  }

  .prd-i::placeholder {
    color: var(--t3);
  }

  /* Date/Time picker custom styling */
  .prd-date-input::-webkit-calendar-picker-indicator,
  .prd-time-input::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    width: 28px;
    height: 100%;
    cursor: pointer;
  }

  .prd-date-input,
  .prd-time-input {
    font-size: 10px;
    color-scheme: dark;
  }

  .prd-date-input::-webkit-datetime-edit,
  .prd-time-input::-webkit-datetime-edit {
    color: var(--t2);
    font-family: var(--fM);
    font-size: 10px;
    letter-spacing: 0.3px;
  }

  .prd-date-input::-webkit-datetime-edit-fields-wrapper,
  .prd-time-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
  }

  .prd-date-input::-webkit-datetime-edit-year-field,
  .prd-date-input::-webkit-datetime-edit-month-field,
  .prd-date-input::-webkit-datetime-edit-day-field,
  .prd-time-input::-webkit-datetime-edit-hour-field,
  .prd-time-input::-webkit-datetime-edit-minute-field,
  .prd-time-input::-webkit-datetime-edit-ampm-field {
    color: var(--t2);
    background: transparent;
    padding: 1px 2px;
    border-radius: 2px;
  }

  .prd-date-input::-webkit-datetime-edit-year-field:focus,
  .prd-date-input::-webkit-datetime-edit-month-field:focus,
  .prd-date-input::-webkit-datetime-edit-day-field:focus,
  .prd-time-input::-webkit-datetime-edit-hour-field:focus,
  .prd-time-input::-webkit-datetime-edit-minute-field:focus,
  .prd-time-input::-webkit-datetime-edit-ampm-field:focus {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
  }

  .prd-date-input::-webkit-datetime-edit-text,
  .prd-time-input::-webkit-datetime-edit-text {
    color: var(--t3);
    padding: 0 1px;
  }

  /* Time hour/minute select (dark dropdown) */
  select.prd-i.prd-time-select {
    color-scheme: dark;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
    background: var(--bg3) !important;
    background-image: none !important;
    padding-right: 4px;
    color: var(--t1);
    border-color: var(--bd);
  }

  /* Select Dropdown */
  select.prd-i {
    cursor: pointer;
    padding-right: 30px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 8px center;
    background-size: 10px;
    transition: border-color 0.2s, background-image 0.2s;
  }

  select.prd-i:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  }

  select.prd-i:focus {
    border-color: var(--cyan);
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2306b6d4' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  }

  select.prd-i option {
    background: #1a1f2e;
    color: var(--t1);
    padding: 10px;
    font-size: 11px;
    font-family: 'Noto Sans KR', sans-serif;
  }

  select.prd-i option:checked {
    background: linear-gradient(0deg, rgba(6, 182, 212, 0.25) 0%, rgba(30, 58, 138, 0.3) 100%);
    color: var(--cyan);
    font-weight: 500;
  }

  select.prd-i option:disabled {
    color: var(--t3);
    font-style: italic;
    opacity: 0.6;
  }

  /* ═══ Combo Dropdown ═══ */
  .combo-wrap {
    position: relative;
    width: 100%;
  }

  .combo-input {
    cursor: pointer !important;
    padding-right: 28px !important;
  }

  .combo-input:hover {
    border-color: var(--bdL);
  }

  .combo-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    color: var(--t3);
    pointer-events: none;
    transition: 0.2s;
  }

  .combo-wrap.open .combo-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--cyan);
  }

  .combo-wrap.open .combo-input {
    border-color: var(--cyan);
    background: var(--bg2);
  }

  .combo-list {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: var(--bg1);
    border: 1px solid var(--bdL);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bdL) transparent;
    animation: comboIn 0.15s ease;
  }

  @keyframes comboIn {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .combo-wrap.open .combo-list {
    display: block;
  }

  .combo-item {
    padding: 7px 10px;
    font-size: 11px;
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--t2);
    cursor: pointer;
    transition: 0.12s;
    border-bottom: 1px solid rgba(30, 42, 66, 0.5);
  }

  .combo-item:last-child {
    border-bottom: none;
  }

  .combo-item:hover {
    background: rgba(6, 182, 212, 0.08);
    color: var(--t1);
  }

  .combo-item.active {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    font-weight: 600;
  }

  /* ═══ Model Chips ═══ */
  .prd-mc {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 4px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 600;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    border: 1px solid var(--bd);
    background: var(--bg0);
    color: rgba(255, 255, 255, 0.5);
    transition: 0.15s;
    user-select: none;
  }

  .prd-mc.on {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.08);
    color: rgba(255, 255, 255, 0.9);
  }

  .prd-mc.on::before {
    content: '✓ ';
    font-size: 9px;
    color: var(--cyan);
  }

  .prd-md {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* ═══ Buttons ═══ */
  .prd-btn {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: 'Noto Sans KR', sans-serif;
  }

  .prd-btn.pri {
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    color: #fff;
  }

  .prd-btn.sec {
    background: var(--bg3);
    border: 1px solid var(--bd);
    color: var(--t2);
  }

  /* Map Button */
  .prd-map-btn {
    padding: 6px 8px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 6px;
    color: var(--cyan);
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Noto Sans KR', sans-serif;
  }

  .prd-map-btn:hover {
    background: rgba(6, 182, 212, 0.15);
  }

  .prd-map-btn.active {
    background: rgba(6, 182, 212, 0.25);
    border-color: rgba(6, 182, 212, 0.6);
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.3);
  }

  /* ═══ Coordinate Display ═══ */
  .cod {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 25, 41, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(30, 42, 66, 0.4);
    border-radius: 6px;
    padding: 5px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #1a1a2e;
    font-weight: 600;
    z-index: 20;
    display: flex;
    gap: 14px;
  }

  .cov {
    color: var(--cyan);
    font-weight: 500;
  }

  /* ═══ Weather Info Panel ═══ */
  .wip {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(18, 25, 41, 0.65);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(30, 42, 66, 0.5);
    border-radius: 6px;
    padding: 6px 10px;
    z-index: 20;
    display: flex;
    gap: 12px;
  }

  .wii {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: center;
  }

  .wii-icon {
    font-size: 12px;
    opacity: 0.5;
  }

  .wii-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--t1);
    font-family: 'JetBrains Mono', monospace;
  }

  .wii-label {
    font-size: 7px;
    color: #1a1a2e;
    font-weight: 700;
    font-family: 'Noto Sans KR', sans-serif;
  }

  /* ═══ Timeline Control Panel ═══ */
  .tlb {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(15, 21, 36, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--bd);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 30;
  }

  .tlc {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }

  .tb {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--bd);
    background: var(--bg3);
    color: var(--t2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
  }

  .tb:hover {
    background: var(--bgH);
    color: var(--t1);
  }

  .tb.on {
    background: var(--cyan);
    color: var(--bg0);
    border-color: var(--cyan);
  }

  .tlt {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .tlls {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
  }

  .tll {
    font-size: 10px;
    color: var(--t3);
    font-family: 'JetBrains Mono', monospace;
  }

  .tll.on {
    color: var(--cyan);
    font-weight: 600;
  }

  .tlsw {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
  }

  .tlr {
    width: 100%;
    height: 4px;
    background: var(--bd);
    border-radius: 2px;
    position: relative;
  }

  .tlp {
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--blue));
    border-radius: 2px;
    transition: width 0.3s;
  }

  .tlm {
    position: absolute;
    width: 2px;
    height: 10px;
    background: var(--bdL);
    top: -3px;
  }

  .tlm.mj {
    height: 14px;
    top: -5px;
    background: var(--t3);
  }

  .tlbm {
    position: absolute;
    top: -18px;
    transform: translateX(-50%);
    font-size: 12px;
    cursor: pointer;
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
  }

  .tlbm .tlbt {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 25, 41, 0.95);
    border: 1px solid var(--boom);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    color: var(--boom);
    white-space: nowrap;
    font-family: 'Noto Sans KR', sans-serif;
  }

  .tlbm:hover .tlbt {
    display: block;
  }

  .tlth {
    position: absolute;
    left: 25%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: var(--cyan);
    border: 3px solid var(--bg0);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
    z-index: 2;
    transition: left 0.3s;
  }

  .tli {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    min-width: 200px;
  }

  .tlct {
    font-size: 14px;
    font-weight: 600;
    color: var(--cyan);
    font-family: 'JetBrains Mono', monospace;
  }

  .tlss {
    display: flex;
    gap: 14px;
  }

  .tls {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
  }

  .tlsl {
    color: var(--t3);
    font-family: 'Noto Sans KR', sans-serif;
  }

  .tlsv {
    color: var(--t1);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
  }

  /* Timeline Action Buttons */
  .tlab {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 16px;
  }

  .tlab-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--bd);
    background: var(--bg3);
    color: var(--t2);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    transition: 0.2s;
    white-space: nowrap;
  }

  .tlab-btn:hover {
    background: var(--bgH);
    color: var(--t1);
  }

  .tlab-btn.primary {
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    color: #fff;
    border-color: transparent;
  }

  .tlab-btn.primary:hover {
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.3);
  }

  .tlab-btn.warning {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red);
  }

  .tlab-btn.warning:hover {
    background: rgba(239, 68, 68, 0.15);
  }

  /* ═══ Layer Tree ═══ */
  .layer-tree {
    display: flex;
    flex-direction: column;
  }

  .layer-node {
    display: flex;
    flex-direction: column;
  }

  .layer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 11px;
    color: var(--t2);
    font-family: 'Noto Sans KR', sans-serif;
  }

  .layer-item:hover {
    background: rgba(255, 255, 255, 0.02);
  }

  .layer-arrow {
    width: 12px;
    font-size: 8px;
    color: var(--t3);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
  }

  /* Toggle Switch */
  .layer-toggle {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
  }

  .layer-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(90, 100, 120, 0.3);
    transition: 0.3s;
    border-radius: 18px;
    border: 1px solid var(--bd);
  }

  .toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--t3);
    transition: 0.3s;
    border-radius: 50%;
  }

  .layer-toggle input:checked + .toggle-slider {
    background-color: rgba(6, 182, 212, 0.3);
    border-color: var(--cyan);
  }

  .layer-toggle input:checked + .toggle-slider:before {
    transform: translateX(14px);
    background-color: var(--cyan);
  }

  .layer-toggle input:disabled + .toggle-slider {
    opacity: 0.3;
    cursor: not-allowed;
  }

  .layer-icon {
    font-size: 14px;
    flex-shrink: 0;
  }

  .layer-name {
    flex: 1;
    font-weight: 500;
  }

  .layer-count {
    font-size: 10px;
    color: var(--t3);
    font-family: 'JetBrains Mono', monospace;
  }

  .layer-children {
    display: flex;
    flex-direction: column;
  }

  /* ═══ Oil Boom ═══ */
  .boom-drawing-indicator {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245, 158, 11, 0.15);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--boom);
    font-family: var(--fK);
    z-index: 40;
    white-space: nowrap;
    pointer-events: none;
    animation: fadeSlideDown 0.3s ease;
  }

  .boom-eff-bar {
    width: 100%;
    height: 6px;
    background: var(--bg0);
    border: 1px solid var(--bd);
    border-radius: 3px;
    overflow: hidden;
  }

  .boom-eff-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
  }

  .boom-setting-input {
    width: 56px;
    padding: 3px 6px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 4px;
    color: var(--orange);
    font-family: var(--fM);
    font-size: 11px;
    font-weight: 600;
    text-align: right;
    outline: none;
    transition: border-color 0.2s;
  }

  .boom-setting-input:focus {
    border-color: var(--orange);
  }

  .boom-setting-input::-webkit-inner-spin-button,
  .boom-setting-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .boom-setting-input[type=number] {
    -moz-appearance: textfield;
  }

  /* ═══ Backtrack Replay ═══ */
  .bt-ship-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
  }

  .bt-ship-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .bt-spd-btn {
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--bd);
    background: var(--bg3);
    color: var(--t3);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--fM);
    transition: 0.15s;
  }

  .bt-spd-btn:hover {
    background: rgba(168, 85, 247, 0.08);
    color: var(--t2);
  }

  .bt-spd-btn.active {
    border-color: var(--purple);
    background: rgba(168, 85, 247, 0.12);
    color: var(--purple);
  }

  @keyframes bt-collision-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
  }

  .bt-collision-marker {
    animation: bt-collision-pulse 1s infinite;
  }

  /* ═══ HNS Scenario Card ═══ */
  .hns-scn-card {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--bd);
    background: var(--bg3);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
  }

  .hns-scn-card:hover {
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.04);
  }

  .hns-scn-card.sel {
    border-color: var(--cyan);
    background: rgba(6, 182, 212, 0.08);
  }

  /* ═══ Analysis Tab ═══ */
  .rsc-atab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: #8b949e;
    font-family: var(--fK);
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: .2s;
  }

  .rsc-atab:hover {
    color: #c9d1d9;
  }

  .rsc-atab.on {
    color: var(--cyan);
    border-bottom-color: var(--cyan);
    background: rgba(6, 182, 212, .04);
  }
}

@layer utilities {
  .font-mono {
    font-family: 'JetBrains Mono', monospace;
  }

  .font-korean {
    font-family: 'Noto Sans KR', sans-serif;
  }

  /* ═══ Animations ═══ */
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
  }

  @keyframes pulse-border {
    0%, 100% { border-color: rgba(239, 68, 68, 0.2); }
    50% { border-color: rgba(239, 68, 68, 0.5); }
  }

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

  .animate-fadeIn {
    animation: fadeIn 0.5s ease both;
  }

  .animate-pulse-dot {
    animation: pulse-dot 1.5s infinite;
  }

  .animate-pulse-border {
    animation: pulse-border 2s infinite;
  }

  /* ═══ Layer Tree 3-Level ═══ */
  .lyr-g1 {
    margin-bottom: 2px;
  }

  .lyr-h1 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    cursor: pointer;
    border-radius: var(--rS);
    transition: background 0.15s;
    font-size: 12px;
    font-weight: 700;
    color: var(--t1);
    font-family: var(--fK);
  }

  .lyr-h1:hover {
    background: rgba(255, 255, 255, 0.04);
  }

  .lyr-h1 .lyr-arr {
    font-size: 8px;
    color: var(--t3);
    transition: transform 0.2s;
    width: 12px;
    text-align: center;
  }

  .lyr-h1 .lyr-arr.open {
    transform: rotate(90deg);
  }

  .lyr-h1-cnt {
    margin-left: auto;
    font-size: 10px;
    font-weight: 500;
    color: var(--t3);
    font-family: var(--fM);
  }

  .lyr-c1 {
    padding-left: 6px;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .lyr-c1.collapsed {
    max-height: 0 !important;
    overflow: hidden;
  }

  .lyr-g2 {
    margin-bottom: 1px;
  }

  .lyr-h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
    font-size: 11px;
    font-weight: 600;
    color: var(--t2);
    font-family: var(--fK);
  }

  .lyr-h2:hover {
    background: rgba(255, 255, 255, 0.03);
  }

  .lyr-h2 .lyr-arr {
    font-size: 7px;
    color: var(--t3);
    transition: transform 0.2s;
    width: 10px;
    text-align: center;
  }

  .lyr-h2 .lyr-arr.open {
    transform: rotate(90deg);
  }

  .lyr-h2-cnt {
    margin-left: auto;
    font-size: 10px;
    font-weight: 500;
    color: var(--t3);
    font-family: var(--fM);
  }

  .lyr-c2 {
    padding-left: 10px;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .lyr-c2.collapsed {
    max-height: 0 !important;
    overflow: hidden;
  }

  .lyr-t {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    color: var(--t2);
    transition: color 0.15s, background 0.15s;
    font-family: var(--fK);
    border-radius: 3px;
  }

  .lyr-t:hover {
    color: var(--t1);
    background: rgba(255, 255, 255, 0.02);
  }

  .lyr-cnt {
    margin-left: auto;
    font-size: 10px;
    font-weight: 400;
    color: var(--t3);
    font-family: var(--fM);
    flex-shrink: 0;
  }

  /* Color Swatch */
  .lyr-csw {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
  }
  .lyr-csw::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    border-radius: 1px;
    background: linear-gradient(135deg, #ef4444 25%, #3b82f6 25%, #3b82f6 50%, #22c55e 50%, #22c55e 75%, #eab308 75%);
    opacity: 0.6;
  }
  .lyr-csw.has-color::after {
    display: none;
  }

  .lyr-csw:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
  }

  /* Color Picker Popup */
  .lyr-cpop {
    position: absolute;
    right: 20px;
    top: -6px;
    z-index: 300;
    background: var(--bg1);
    border: 1px solid var(--bd);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    display: none;
    width: 190px;
  }

  .lyr-cpop.show {
    display: block;
    animation: lyrPopIn 0.2s ease-out;
  }

  @keyframes lyrPopIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .lyr-cpr {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
  }

  .lyr-cpr-i {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.15s;
  }

  .lyr-cpr-i:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
  }

  .lyr-cpr-i.sel {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.3);
  }

  .lyr-ccustom {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
  }

  .lyr-ccustom label {
    font-size: 9px;
    color: var(--t3);
    font-family: var(--fK);
  }

  .lyr-ccustom input[type="color"] {
    width: 24px;
    height: 20px;
    border: 1px solid var(--bd);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    background: transparent;
  }

  /* Layer Style Box */
  .lyr-style-box {
    margin-top: 10px;
    padding: 10px 8px;
    background: var(--bg0);
    border: 1px solid var(--bd);
    border-radius: var(--rS);
  }
  .lyr-style-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--t3);
    font-family: var(--fK);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .3px;
  }
  .lyr-style-row {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .lyr-style-row + .lyr-style-row {
    margin-top: 6px;
  }
  .lyr-style-name {
    font-size: 10px;
    color: var(--t3);
    font-family: var(--fK);
    min-width: 32px;
  }
  .lyr-style-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--bd);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    cursor: pointer;
    accent-color: var(--cyan);
  }
  .lyr-style-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cyan);
    cursor: pointer;
  }
  .lyr-style-val {
    font-size: 9px;
    color: var(--t3);
    font-family: var(--fM);
    min-width: 28px;
    text-align: right;
  }

  /* Toggle Switch (Layer Tree) */
  .lyr-sw {
    width: 28px;
    height: 16px;
    background: var(--bg0);
    border-radius: 8px;
    position: relative;
    border: 1px solid var(--bd);
    transition: 0.2s;
    flex-shrink: 0;
    cursor: pointer;
  }

  .lyr-sw::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background: var(--t3);
    border-radius: 50%;
    transition: 0.2s;
  }

  .lyr-sw.on {
    background: rgba(6, 182, 212, 0.3);
    border-color: var(--cyan);
  }

  .lyr-sw.on::after {
    left: 14px;
    background: var(--cyan);
  }

  .lyr-sw:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }
}
