:root{
      --glass-bg: rgba(255, 255, 255, 0.7);
      --glass-border: rgba(0, 0, 0, 0.08);
      --primary: #2563eb;
      --success: #10b981;
      --warning: #f59e0b;
      --text-primary: #111827;
      --text-secondary: #6b7280;
      --bg: #f8fafc;
      --blur: 20px;
    }

    * { box-sizing: border-box; }

    html, body {
      height: 100%;
      margin: 0;
      background: var(--bg);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    }

    #app {
      height: 100dvh;
      display: grid;
      grid-template-rows: auto auto 1fr auto;
      position: sticky;
      top: 0;
      z-index: 1;
    }

    header {
      position: sticky;
      top: 0;
      z-index: 10;
      display: flex;
      gap: 0.8rem;
      align-items: center;
      padding: 1rem 1.2rem;
      background: var(--glass-bg);
      border-bottom: 1px solid var(--glass-border);
      backdrop-filter: blur(var(--blur));
      -webkit-backdrop-filter: blur(var(--blur));
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    header .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--success);
      box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
      animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.6; }
    }

    header h1 {
      margin: 0;
      font-size: 1.1rem;
      font-weight: 600;
      color: var(--text-primary);
    }

    header .sub {
      margin-left: auto;
      font-size: 0.8rem;
      color: var(--text-secondary);
      font-weight: 400;
    }

    .lang-switch {
      display: inline-flex;
      align-items: center;
      padding: 0.35rem 0.6rem;
      border: 1px solid var(--glass-border);
      border-radius: 8px;
      background: white;
      color: var(--text-primary);
      font-size: 0.75rem;
      font-weight: 600;
      text-decoration: none;
      transition: all 0.2s;
    }

    .lang-switch:hover {
      background: #f9fafb;
      transform: translateY(-1px);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .lang-switch:active { transform: scale(0.96); }

    .stop-following-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.4rem 0.8rem;
      border: 1px solid var(--glass-border);
      border-radius: 8px;
      background: rgba(239, 68, 68, 0.1);
      color: #ef4444;
      font-size: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .stop-following-btn:hover {
      background: rgba(239, 68, 68, 0.15);
      transform: translateY(-1px);
    }

    .stop-following-btn:active { transform: scale(0.96); }

    #map {
      width: 100%;
      height: 100%;
      position: relative;
    }

    footer {
      position: sticky;
      bottom: 0;
      z-index: 12;
      background: var(--glass-bg);
      border-top: 1px solid var(--glass-border);
      backdrop-filter: blur(var(--blur));
      -webkit-backdrop-filter: blur(var(--blur));
      box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
    }

    .toolbar {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
      gap: 0.4rem;
      padding: 0.6rem;
    }

    @media (max-width: 400px) {
      .toolbar { grid-template-columns: repeat(2, 1fr); }
      .btn { height: 56px; font-size: 0.65rem; }
      .btn .ico { font-size: 1.2rem; }
    }

    .btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.25rem;
      height: 60px;
      border: 1px solid var(--glass-border);
      border-radius: 12px;
      background: white;
      color: var(--text-primary);
      font-size: 0.7rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .btn:hover {
      background: #f9fafb;
      transform: translateY(-1px);
    }

    .btn:active { transform: scale(0.97); }

    .btn .ico { font-size: 1.3rem; line-height: 1; }

    .btn.primary {
      background: var(--primary);
      color: white;
      border-color: var(--primary);
    }

    .btn.primary:hover { background: #1d4ed8; }

    .btn.toggle[aria-pressed="true"] {
      background: var(--primary);
      color: white;
      border-color: var(--primary);
    }

    .statusbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.5rem 0.6rem;
      font-size: 0.7rem;
      border-top: 1px solid var(--glass-border);
    }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.3rem 0.6rem;
      border-radius: 999px;
      background: white;
      border: 1px solid var(--glass-border);
      color: var(--text-secondary);
      font-weight: 500;
    }

    .email-pill{
      margin-left: 0.5rem;
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.3rem 0.6rem;
      border-radius: 999px;
      background: white;
      border: 1px solid var(--glass-border);
      color: var(--text-secondary);
      font-weight: 500;
    }

    .status-ok { color: var(--success); font-weight: 600; }
    .status-warn { color: var(--warning); font-weight: 600; }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.3);
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s;
      z-index: 100;
    }

    .modal {
      position: fixed;
      inset: 0;
      display: flex;
      flex-direction: column;
      background: white;
      transform: translateY(100%);
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s;
      z-index: 101;
    }

    .modal.open {
      transform: translateY(0);
      opacity: 1;
      visibility: visible;
      z-index:9999;
    }

    .modal-backdrop.open {
      opacity: 1;
      visibility: visible;
    }

    .modal header {
      position: sticky;
      top: 0;
      background: white;
      border-bottom: 1px solid var(--glass-border);
      display: flex;
      align-items: center;
      gap: 0.8rem;
      padding: 1rem 1.2rem;
      z-index: 2;
    }

    .modal header h2 {
      margin: 0;
      font-size: 1.1rem;
      font-weight: 600;
      color: var(--text-primary);
    }

    .modal header .close {
      margin-left: auto;
      width: 36px;
      height: 36px;
      border: 1px solid var(--glass-border);
      background: white;
      color: var(--text-primary);
      border-radius: 50%;
      font-size: 1.1rem;
      cursor: pointer;
      transition: all 0.2s;
    }

    .modal header .close:active {
      transform: scale(0.9);
      background: #f9fafb;
    }

    .modal .searchwrap {
      position: sticky;
      top: 57px;
      background: white;
      padding: 0.8rem 1.2rem;
      border-bottom: 1px solid var(--glass-border);
      z-index: 1;
    }

    .modal .search { display: flex; gap: 0.6rem; }

    .modal input[type="search"] {
      flex: 1;
      background: #f9fafb;
      color: var(--text-primary);
      border: 1px solid var(--glass-border);
      border-radius: 10px;
      height: 44px;
      padding: 0 1rem;
      font-size: 0.95rem;
      transition: all 0.2s;
    }

    .modal input[type="search"]:focus {
      outline: none;
      border-color: var(--primary);
      background: white;
    }

    .modal .content {
      flex: 1;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 1rem 1.2rem 2rem;
      background: #f9fafb;
    }

    .list { display: flex; flex-direction: column; gap: 0.5rem; }

    .item {
      display: flex;
      align-items: center;
      gap: 0.8rem;
      background: white;
      border: 1px solid var(--glass-border);
      border-radius: 12px;
      padding: 0.8rem 1rem;
      min-height: 56px;
      font-size: 0.95rem;
      cursor: pointer;
      transition: all 0.2s;
    }

    .item:hover {
      transform: translateX(3px);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .item:active { transform: scale(0.98); }

    .item.selected {
      background: #eff6ff;
      border: 2px solid var(--primary);
      box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
    }

    .sw {
      width: 20px;
      height: 20px;
      border-radius: 6px;
      border: 2px solid var(--glass-border);
      flex-shrink: 0;
    }

    .bus-name { font-weight: 600; color: var(--text-primary); }

    .count {
      margin-left: auto;
      color: var(--text-secondary);
      font-size: 0.85rem;
      font-weight: 500;
    }

    .bus-marker { pointer-events: auto; }

    .bus-wrap {
      position: relative;
      transform: translate(-50%, -50%);
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }

    .bus-emoji {
      font-size: 26px;
      line-height: 26px;
      transition: all 0.3s;
    }

    .bus-badge {
      position: absolute;
        top: -25px;
        left: 59%;
        transform: translateX(-50%);
        padding: 2px 7px;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 700;
        color: white;
        background: var(--primary);
        border: 1px solid white;
        white-space: nowrap;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    }

    .bus-badge.off {
      opacity: 0.5;
      background: #9ca3af;
    }

    .station-marker { pointer-events: auto; }

    .station-wrap {
      position: relative;
      transform: translate(-50%, -50%);
    }

    .station-icon {
      width: 30px;
      height: 30px;
      background: white;
      border: 2px solid var(--primary);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
      transition: all 0.2s;
    }

    .station-icon:hover {
      transform: scale(1.1);
      box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
    }

    .popup-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.5rem 0.9rem;
      margin-top: 0.4rem;
      border: none;
      border-radius: 10px;
      background: var(--primary);
      color: white;
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .popup-btn:hover { background: #1d4ed8; }
    .popup-btn:active { transform: scale(0.96); }

    .popup-btn.following { background: var(--success); }
    .popup-btn.following:hover { background: #059669; }

    .leaflet-popup-content-wrapper {
      background: white;
      border-radius: 12px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
      border: 1px solid var(--glass-border);
    }

    .leaflet-popup-content {
      margin: 0.9rem;
      font-size: 0.9rem;
      color: var(--text-primary);
    }

    .leaflet-popup-tip { background: white; }

    .leaflet-container a {
      color: var(--primary);
      font-weight: 600;
    }

    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

    .seo-section {
      display: block;
      background: white;
      padding: 2rem 1.5rem;
      max-width: 1200px;
      margin: 0 auto;
    }

    @media (min-width: 768px) {
      .seo-section { padding: 4rem 2rem; }
    }

    .seo-content { line-height: 1.8; color: var(--text-primary); }

    .seo-content h1 {
      font-size: 2rem;
      font-weight: 700;
      color: var(--primary);
      margin: 0 0 1.5rem 0;
      line-height: 1.2;
    }

    .seo-content h2 {
      font-size: 1.5rem;
      font-weight: 600;
      color: var(--text-primary);
      margin: 2rem 0 1rem 0;
      border-left: 4px solid var(--primary);
      padding-left: 1rem;
    }

    .seo-content h3 {
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--text-secondary);
      margin: 1.5rem 0 0.75rem 0;
    }

    .seo-content p {
      margin: 0 0 1rem 0;
      font-size: 1rem;
      color: #374151;
    }

    .seo-content ul {
      margin: 0 0 1rem 0;
      padding-left: 1.5rem;
    }

    .seo-content li {
      margin: 0.5rem 0;
      color: #374151;
    }

    .seo-content strong { color: var(--primary); font-weight: 600; }

    .feature-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 1.5rem;
      margin: 2rem 0;
    }

    .feature-card {
      background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
      border: 1px solid var(--glass-border);
      border-radius: 12px;
      padding: 1.5rem;
      transition: all 0.3s;
    }

    .feature-card:hover {
      transform: translateY(-4px);
      box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
    }

    .feature-card .icon {
      font-size: 2.5rem;
      margin-bottom: 0.75rem;
      display: block;
    }

    .feature-card h3 {
      margin: 0 0 0.5rem 0;
      font-size: 1.1rem;
      color: var(--primary);
    }

    .feature-card p {
      margin: 0;
      font-size: 0.95rem;
      color: var(--text-secondary);
    }

    .cta-box {
      background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
      color: white;
      border-radius: 16px;
      padding: 2rem;
      margin: 2rem 0;
      text-align: center;
    }

    .cta-box h2 {
      color: white;
      border: none;
      padding: 0;
      margin: 0 0 1rem 0;
    }

    .cta-box p {
      color: rgba(255, 255, 255, 0.9);
      margin: 0;
      font-size: 1.1rem;
    }