    html, body {
      margin: 0;
      padding: 0;
      overflow: hidden;
      height: 100%;
    }

    #map {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 100%;
    }

    /* ... (기존 팝업 및 모달 스타일) ... */
    .mapboxgl-popup-content {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      padding: 0;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      max-width: 240px !important;
    }

    .mapboxgl-popup-close-button {
      font-size: 20px;
      padding: 4px;
      margin: 4px;
    }

    .custom-popup {
      color: #333;
    }

    .popup-header {
      background-color: #f7f7f7;
      padding: 12px 16px;
      border-bottom: 1px solid #eee;
      border-top-left-radius: 8px;
      border-top-right-radius: 8px;
    }

    .popup-header h3 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #000;
    }

    .popup-content {
      padding: 12px 16px;
      font-size: 14px;
    }

    .popup-content p {
      margin: 0 0 4px 0;
      display: flex;
      align-items: flex-start;
    }

    .popup-content p:last-child {
      margin-bottom: 0;
    }

    .color-swatch {
      width: 14px;
      height: 14px;
      border-radius: 3px;
      border: 1px solid rgba(0, 0, 0, 0.1);
      margin-right: 8px;
      flex-shrink: 0;
      margin-top: 3px;
    }

    .label {
      font-weight: 600;
      margin-right: 6px;
      color: #555;
      white-space: nowrap;
    }

    .popup-text-content {
      min-width: 0;
    }

    .popup-value {
      word-wrap: break-word;
      overflow-wrap: break-word;
      white-space: normal;
    }

    .popup-value a {
      color: #007bff;
      text-decoration: none;
    }

    .popup-value a:hover {
      text-decoration: underline;
    }

    .story-button {
      background-color: #007bff;
      color: white;
      border: none;
      padding: 8px 12px;
      border-radius: 5px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 600;
      width: 100%;
      text-align: center;
    }

    .story-button:hover {
      background-color: #0056b3;
    }

    #loading-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.5);
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 1100;
      color: white;
      font-size: 1.2em;
    }

    #story-modal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.6);
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 1001;
      padding: 20px;
      box-sizing: border-box;
      transition: all 0.3s ease-in-out;
    }

    .story-modal-content {
      background-color: white;
      border-radius: 8px;
      padding: 20px;
      max-width: 500px;
      width: 100%;
      height: 70vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
      transition: all 0.3s ease-in-out;
      overflow: hidden;
    }

    #story-modal-title {
      margin: 0 0 15px 0;
      font-size: 1.5em;
      font-weight: 600;
      border-bottom: 1px solid #eee;
      padding-bottom: 10px;
      cursor: pointer;
    }

    #story-modal-body {
      overflow-y: auto;
      flex-grow: 1;
      white-space: pre-wrap;
      line-height: 1.6;
    }

    .modal-buttons-container {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 20px;
    }

    #close-modal-btn,
    #minimize-modal-btn {
      background-color: #007bff;
      color: white;
      border: none;
      padding: 10px 15px;
      border-radius: 5px;
      cursor: pointer;
      font-size: 1em;
      font-weight: 500;
    }

    #minimize-modal-btn {
      background-color: #6c757d;
    }

    #close-modal-btn:hover {
      background-color: #0056b3;
    }

    #minimize-modal-btn:hover {
      background-color: #5a6268;
    }

    #story-modal.story-modal-minimized {
      top: auto;
      bottom: 10px;
      left: 10px;
      right: auto;
      width: 300px;
      height: auto;
      background-color: transparent;
      padding: 0;
      z-index: 1002;
    }

    .story-modal-content.story-modal-minimized .story-modal-content {
      height: auto;
      max-width: 300px;
      padding: 10px 15px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    #story-modal.story-modal-minimized #story-modal-title {
      margin: 0;
      padding: 0;
      border-bottom: none;
      font-size: 1.1em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    #story-modal.story-modal-minimized #story-modal-body,
    #story-modal.story-modal-minimized .modal-buttons-container {
      display: none;
    }

    #search-container {
      position: absolute;
      top: 15px;
      left: 15px;
      z-index: 10;
      width: 280px;
      background-color: #fff;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }

    #search-input {
      width: 100%;
      border: none;
      padding: 12px 15px;
      font-size: 15px;
      border-radius: 8px;
      box-sizing: border-box;
      outline: none;
    }

    #search-results {
      max-height: 300px;
      overflow-y: auto;
      border-top: 1px solid #eee;
      display: none;
      border-bottom-left-radius: 8px;
      border-bottom-right-radius: 8px;
    }

    .search-result-item {
      padding: 12px 15px;
      cursor: pointer;
      font-size: 14px;
      color: #333;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .search-result-item:hover {
      background-color: #f5f5f5;
    }

    .search-result-item:last-child {
      border-bottom-left-radius: 8px;
      border-bottom-right-radius: 8px;
    }

    /* ★ 팝업 스타일 추가 */
    .train-popup .mapboxgl-popup-content {
      padding: 0;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }

    .train-popup-inner {
      padding: 10px;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      font-size: 14px;
      color: #333;
    }

    .train-popup-inner h4 {
      margin: 0 0 8px 0;
      font-size: 16px;
      font-weight: 600;
      color: #000;
      border-bottom: 1px solid #eee;
      padding-bottom: 5px;
    }

    .train-popup-inner p {
      margin: 0 0 4px 0;
    }

    .train-popup-inner p:last-child {
      margin-bottom: 0;
    }

    /* ★★★ 시간 제어 UI 스타일 ★★★ */
    #time-controls-container {
      position: absolute;
      top: 80px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 10;
      background-color: rgba(255, 255, 255, 0.95);
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      padding: 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      width: auto;
      max-width: 95vw;
      box-sizing: border-box;
    }

    .time-controls-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: center;
    }

    #play-pause-btn {
      font-size: 14px;
      font-weight: 600;
      padding: 8px 12px;
      border: none;
      border-radius: 5px;
      background-color: #007bff;
      color: white;
      cursor: pointer;
      min-width: 60px;
    }

    #play-pause-btn:hover {
      background-color: #0056b3;
    }

    #time-display {
      font-size: 16px;
      font-weight: 600;
      color: #333;
      background-color: #eee;
      padding: 8px 10px;
      border-radius: 5px;
      min-width: 70px;
      text-align: center;
    }

    .time-input-group {
      display: flex;
      align-items: center;
      gap: 3px;
    }

    .time-input-group input[type="number"] {
      width: 40px;
      padding: 6px 4px;
      text-align: center;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 14px;
      -moz-appearance: textfield;
    }

    .time-input-group input[type="number"]::-webkit-outer-spin-button,
    .time-input-group input[type="number"]::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    .time-separator {
      font-weight: 600;
      color: #333;
    }

    #set-time-btn {
      padding: 6px 10px;
      background: #28a745;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 600;
      font-size: 13px;
      margin-left: 3px;
    }

    #set-time-btn:hover {
      background: #218838;
    }

    #debug-toggle-btn {
      background: #ff6b6b;
      color: white;
      border: none;
      padding: 6px 10px;
      cursor: pointer;
      border-radius: 4px;
      font-size: 12px;
    }

    #debug-toggle-btn:hover {
      background: #ee5a5a;
    }

    /* ★ 모바일 반응형 (480px 이하) */
    @media (max-width: 480px) {
      #time-controls-container {
        top: 70px;
        padding: 8px;
        gap: 6px;
      }

      .time-controls-row {
        gap: 6px;
      }

      #play-pause-btn {
        font-size: 12px;
        padding: 6px 10px;
        min-width: 50px;
      }

      #time-display {
        font-size: 14px;
        padding: 6px 8px;
        min-width: 60px;
      }

      .time-input-group input[type="number"] {
        width: 32px;
        padding: 5px 2px;
        font-size: 13px;
      }

      #set-time-btn {
        padding: 5px 8px;
        font-size: 12px;
      }

      #debug-toggle-btn {
        display: none;
      }
    }

    /* ★ 태블릿 반응형 (481px ~ 768px) */
    @media (min-width: 481px) and (max-width: 768px) {
      #time-controls-container {
        top: 75px;
      }

      #debug-toggle-btn {
        font-size: 11px;
        padding: 5px 8px;
      }
    }

    /* ★★★ Train Bottom Sheet UI ★★★ */
    #train-bottom-sheet-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: transparent;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
      z-index: 999;
    }

    #train-bottom-sheet-overlay.active {
      opacity: 1;
      visibility: visible;
    }

    #train-bottom-sheet {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%) translateY(100%);
      width: 100%;
      max-width: 600px;
      background-color: white;
      border-top-left-radius: 20px;
      border-top-right-radius: 20px;
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
      z-index: 1000;
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }

    #train-bottom-sheet.active {
      transform: translateX(-50%) translateY(0);
    }

    .bottom-sheet-handle {
      width: 40px;
      height: 4px;
      background-color: #ddd;
      border-radius: 2px;
      margin: 12px auto 8px auto;
      cursor: pointer;
    }

    .bottom-sheet-content {
      padding: 0 20px 20px 20px;
      position: relative;
    }

    .bottom-sheet-close-btn {
      position: absolute;
      top: 0;
      right: 20px;
      background: none;
      border: none;
      font-size: 32px;
      color: #999;
      cursor: pointer;
      padding: 0;
      width: 32px;
      height: 32px;
      line-height: 32px;
      text-align: center;
      transition: color 0.2s;
    }

    .bottom-sheet-close-btn:hover {
      color: #333;
    }

    /* #bottom-sheet-body 내부는 .train-popup-inner 스타일을 따름 */
    #bottom-sheet-body .train-popup-inner {
      padding: 0;
    }

    #bottom-sheet-body .train-popup-inner h4 {
      margin: 0 0 12px 0;
      font-size: 18px;
      font-weight: 600;
      color: #000;
      border-bottom: 1px solid #eee;
      padding-bottom: 8px;
    }

    #bottom-sheet-body .train-popup-inner p {
      margin: 0 0 6px 0;
      font-size: 15px;
      color: #333;
      line-height: 1.6;
    }

    #bottom-sheet-body .train-popup-inner p:last-of-type {
      margin-bottom: 0;
    }

    #bottom-sheet-body .train-popup-inner strong {
      font-weight: 600;
      color: #555;
    }

    /* 2x2 Grid layout for train info */
    .train-info-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      margin: 0 0 10px 0;
    }

    .train-info-grid p {
      margin: 0;
      font-size: 15px;
      color: #333;
      line-height: 1.6;
      display: block;
    }

    .train-info-grid strong {
      font-weight: 600;
      color: #555;
      display: block;
      margin-bottom: 2px;
    }

    /* Route Progress Bar */
    .route-progress {
      padding: 10px 0;
    }

    /* Moving train: vertical layout (time on top, stations on bottom) */
    .route-progress-moving {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    /* Stopping train: vertical layout (time on top, stations on bottom) */
    .route-progress-stopping {
      display: flex;
      flex-direction: column;
    }

    .route-progress-stopping-time-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }

    .route-time-outside {
      font-size: 14px;
      font-weight: 600;
      color: #333;
      white-space: nowrap;
    }

    .time-with-bar {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      flex: 1;
      min-height: 36px;
      gap: 0;
    }

    .route-bar-background {
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      height: 20px;
      border-radius: 10px;
      transform: translateY(-50%);
      z-index: 0;
    }

    .route-progress-stopping-station-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    .stopping-current-station {
      position: relative;
      z-index: 2;
      display: inline-block;
      padding: 10px 14px;
      border-radius: 999px;
      white-space: nowrap;
      font-size: 15px;
      font-weight: 500;
    }

    .route-progress-time-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    .route-progress-station-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    .route-time {
      position: relative;
      z-index: 1;
      font-size: 14px;
      font-weight: 600;
      color: #333;
      white-space: nowrap;
      background-color: white;
      padding: 2px 6px;
      border-radius: 4px;
    }

    .route-time-in-bar {
      position: relative;
      z-index: 1;
      font-size: 14px;
      font-weight: normal;
      white-space: nowrap;
      background-color: transparent;
      padding: 2px 6px;
      border-radius: 4px;
    }

    .route-station {
      font-size: 16px;
      color: #000;
      white-space: nowrap;
    }

    .route-station-left {
      text-align: left;
    }

    .route-station-right {
      text-align: right;
    }

    .route-bar-container {
      flex-grow: 1;
      height: 12px;
      background-color: #e0e0e0;
      border-radius: 6px;
      position: relative;
      overflow: visible;
    }

    .route-bar-fill {
      height: 100%;
      border-radius: 6px;
      transition: width 0.3s ease;
    }

    /* Desktop responsive */
    @media (min-width: 768px) {
      #train-bottom-sheet {
        max-width: 500px;
      }
      .story-modal-content {
        height: 85vh;
      }
    }