  :root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: #2e2e2e;
    --accent: #c8f135;
    --accent2: #35f1c8;
    --text: #f0f0f0;
    --muted: #888;
    --danger: #ff5252;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  html { background: var(--bg); }

  body {
    font-family: 'Syne', sans-serif;
    background: transparent;
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(var(--safe-top) + 24px) 16px calc(var(--safe-bottom) + 80px);
    max-width: 480px;
    margin: 0 auto;
    overflow-x: hidden;
    position: relative;
  }

  header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-top: 8px;
    flex-wrap: wrap;
  }

  .header-status {
    display: none;
    width: 100%;
    font-size: 12px;
    color: var(--accent);
    align-items: center;
    margin-top: 6px;
  }
  .header-status.visible { display: flex; }

  .header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
  header h1 span { color: var(--accent); }

  .date-badge {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    background: var(--surface2);
    padding: 6px 10px;
    border-radius: 6px;
  }

  .tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 28px;
  }

  .tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .tab svg { display: block; flex-shrink: 0; }

  .tab.active { background: var(--surface2); color: var(--accent); }

  .view { display: none; }
  .view.active { display: block; }

  .activity-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    user-select: none;
  }

  .activity-card.running { border-color: var(--accent); background: #1a1f0f; }
  .activity-card:active { transform: scale(0.98); }

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

  .activity-info { flex: 1; min-width: 0; overflow: hidden; }
  .activity-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .activity-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .activity-total { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }

  .timer-display {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
  }

  .activity-card.running .timer-display { color: var(--accent); }

  @media (max-width: 600px) {
    .activity-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
    .activity-card.running .timer-display { font-size: 13px; font-weight: 600; }
  }

  .play-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--surface2);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
  }

  .activity-card.running .play-btn { background: var(--accent); color: #0f0f0f; }

  .delete-btn {
    width: 28px; height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
  }

  .delete-btn:hover { border-color: var(--danger); color: var(--danger); }

  .add-form { display: flex; gap: 8px; margin-bottom: 20px; }

  .add-form input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
  }

  .add-form input:focus { border-color: var(--accent); }
  .add-form input::placeholder { color: var(--muted); }

  .add-btn {
    padding: 12px 18px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: 12px;
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
  }

  .stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
  .stats-header h2 { font-size: 16px; font-weight: 700; }

  .total-badge {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    background: var(--surface2);
    padding: 5px 10px;
    border-radius: 8px;
    color: var(--accent2);
  }

  .stats-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
  }

  .table-row {
    display: flex;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
  }

  .table-row:last-child { border-bottom: none; }

  .table-header {
    background: var(--surface2);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
  }

  .col-name { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .col-time { font-family: 'DM Mono', monospace; font-size: 13px; min-width: 70px; text-align: right; color: var(--muted); }
  .col-pct { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); min-width: 42px; text-align: right; }

  .row-bar-wrap { width: 60px; height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
  .row-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

  .chart-title {
    font-size: 13px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 16px;
  }

  .bar-chart {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
  }

  .bar-group {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
    margin-bottom: 8px;
    padding-top: 50px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }

  .bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }

  .bar-fill {
    width: 100%;
    border-radius: 6px 6px 0 0;
    min-height: 3px;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
  }

  .bar-val {
    position: absolute;
    top: -52px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center center;
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    white-space: nowrap;
  }

  .bar-val-horizontal {
    transform: translateX(-50%) rotate(0deg) !important;
    top: -18px !important;
    font-size: 11px !important;
    font-weight: 700;
  }

  .bar-labels { display: flex; gap: 6px; }
  .bar-label {
    flex: 1; font-size: 10px; color: var(--muted); padding: 4px 0 0;
    writing-mode: vertical-lr; text-orientation: mixed; transform: rotate(180deg);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    height: 80px; display: flex; align-items: center; justify-content: flex-start;
  }

  .chart-box {
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
  }

  .chart-toggle-btn {
    background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
    border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12px;
  }
  .chart-toggle-btn.active { background: var(--accent); color: #0f0f0f; border-color: var(--accent); }

  .empty { text-align: center; padding: 48px 20px; color: var(--muted); }
  .empty .icon { font-size: 32px; margin-bottom: 12px; }
  .empty p { font-size: 14px; line-height: 1.6; }

  .pulse { display: inline-block; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; animation: pulse 1.2s infinite; margin-right: 6px; }

  @keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
  }

  .running-indicator { font-size: 12px; color: var(--accent); margin-bottom: 20px; display: none; align-items: center; }
  .running-indicator.visible { display: flex; }

  /* Filter bar */
  .filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }

  .filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
  }

  .filter-btn.active { background: var(--surface2); color: var(--text); border-color: var(--accent); }

  .reset-all-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s;
  }

  .reset-all-btn:hover { border-color: var(--danger); color: var(--danger); }

  .export-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s;
  }
  .export-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--accent); }

  .export-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
  .export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.2s;
  }
  .export-option:has(input:checked) { border-color: var(--accent); }
  .export-option input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
  .export-option-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
  .export-option-desc { font-size: 12px; color: var(--muted); }

  .export-preview {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    line-height: 1.7;
    max-height: 90px;
    overflow: hidden;
    margin-bottom: 16px;
    white-space: pre;
    overflow-x: auto;
  }

  /* Install banner */
  .install-banner {
    display: none;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    gap: 12px;
    align-items: center;
  }

  .install-banner.visible { display: flex; }
  .install-banner p { flex: 1; font-size: 13px; line-height: 1.5; color: var(--muted); }
  .install-banner p strong { color: var(--text); }

  .install-btn {
    padding: 8px 14px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: 9px;
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
  }

  .dismiss-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
  }

  /* Modal Overlay */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
  }
  .modal-overlay.visible { display: flex; }

  .about-btn {
    background: none; border: none; color: var(--muted);
    font-size: 11px; cursor: pointer; padding: 2px 0;
    display: block; text-align: left;
    font-family: 'Syne', sans-serif; font-weight: 600;
    transition: color 0.2s; margin-top: 4px;
  }
  .about-btn:hover { color: var(--text); }

  .about-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,15,15,0.96);
    z-index: 500; overflow-y: auto;
    padding: calc(var(--safe-top) + 24px) 16px calc(var(--safe-bottom) + 40px);
  }
  .about-overlay > * {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
  .about-overlay > .about-back {
    position: fixed;
    margin: 0;
  }
  .about-overlay.visible { display: block; }

  .about-logo { font-family:'Syne',sans-serif; font-size:36px; font-weight:800;
    letter-spacing:-1px; text-align:center; margin: 48px auto 40px; }
  .about-logo span { color: var(--accent); }

  .about-back { position:fixed; top:calc(var(--safe-top)+16px); right:20px;
    background:var(--surface); border:1px solid var(--border); color:var(--text);
    border-radius:10px; padding:8px 14px; font-family:'Syne',sans-serif;
    font-size:13px; font-weight:600; cursor:pointer; z-index:501; }

  .about-section { margin-bottom:32px; }
  .about-section h3 { font-size:14px; font-weight:700; color:var(--accent);
    text-transform:uppercase; letter-spacing:0.8px; margin-bottom:10px; }
  .about-section p { font-size:14px; color:#fff; line-height:1.7; }

  .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    animation: modalIn 0.2s ease;
  }

  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.93) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }

  .modal-icon { font-size: 28px; margin-bottom: 12px; text-align: center; }
  .modal-title { font-size: 17px; font-weight: 800; margin-bottom: 10px; text-align: center; }
  .modal-body { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 20px; text-align: center; }
  .modal-body strong { color: var(--accent); }

  .modal-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
    transition: border-color 0.2s;
  }
  .modal-input:focus { border-color: var(--accent); }
  .modal-input::placeholder { color: var(--muted); }

  .modal-input.error { border-color: var(--danger); }
  .modal-error { font-size: 12px; color: var(--danger); margin-top: -10px; margin-bottom: 12px; display: none; }
  .modal-error.visible { display: block; }

  .modal-buttons { display: flex; gap: 10px; }
  .modal-btn { flex: 1; padding: 12px; border: none; border-radius: 12px; font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.2s; }
  .modal-btn-cancel { background: var(--surface2); color: var(--muted); }
  .modal-btn-cancel:hover { color: var(--text); }
  .modal-btn-danger { background: var(--danger); color: #fff; }
  .modal-btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }
  .modal-btn-primary { background: var(--accent); color: #0f0f0f; }

  /* Group styles */
  .group-section { margin-bottom: 6px; }
  .group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    user-select: none;
  }
  .group-chevron { font-size: 11px; color: var(--muted); transition: transform 0.2s; }
  .group-chevron.open { transform: rotate(90deg); }
  .group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); flex: 1; }
  .group-count { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); background: var(--surface2); padding: 2px 7px; border-radius: 20px; }
  .group-activities { overflow: hidden; }
  .group-activities.collapsed { display: none; }

  /* Edit modal select */
  .modal-select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
    transition: border-color 0.2s;
    appearance: none;
    cursor: pointer;
  }
  .modal-select:focus { border-color: var(--accent); }
  .modal-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 6px; }

  .emoji-picker-wrap { border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin-bottom: 16px; }
  .emoji-selected-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
  .emoji-large { font-size: 28px; line-height: 1; }
  .emoji-selected-label { font-size: 12px; color: var(--muted); }
  .emoji-grid { display: flex; flex-wrap: wrap; gap: 2px; max-height: 200px; overflow-y: auto; }
  .emoji-group-label { width: 100%; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; padding: 6px 2px 2px; margin-top: 4px; }
  .emoji-group-label:first-child { margin-top: 0; padding-top: 2px; }
  .emoji-btn { width: 36px; height: 36px; border: none; background: transparent; font-size: 20px; cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
  .emoji-btn:hover { background: var(--surface2); }
  .emoji-btn.selected { background: var(--surface2); outline: 2px solid var(--accent); outline-offset: -2px; }
  .modal-info { font-size: 12px; color: var(--muted); margin-bottom: 16px; }

  .act-emoji { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }

  /* Group badge on card */
  .group-badge { font-size: 10px; color: var(--muted); background: var(--surface2); padding: 2px 6px; border-radius: 4px; margin-left: 4px; }

  /* Add group form */
  .add-group-row { display: flex; gap: 8px; margin-bottom: 16px; }
  .add-group-input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
  }
  .add-group-input:focus { border-color: var(--accent); }
  .add-group-input::placeholder { color: var(--muted); }
  .add-group-btn {
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--accent);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
  }
  .add-group-btn:hover { background: var(--accent); color: #0f0f0f; border-color: var(--accent); }

  .edit-btn {
    width: 28px; height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  .edit-btn:hover { border-color: var(--accent); color: var(--accent); }

  /* Counter cards */
  .counter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    user-select: none;
  }
  .counter-card:active { transform: scale(0.98); }
  .counter-card:hover { border-color: var(--accent2); }

  .counter-emoji { font-size: 22px; flex-shrink: 0; width: 32px; text-align: center; }
  .counter-info { flex: 1; min-width: 0; overflow: hidden; }
  .counter-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; margin-bottom: 2px; }
  .counter-group-label { font-size: 11px; color: var(--muted); }

  .counter-value {
    font-family: 'DM Mono', monospace;
    font-size: 28px;
    font-weight: 500;
    color: var(--accent2);
    min-width: 48px;
    text-align: right;
    flex-shrink: 0;
  }

  /* Counter stats */
  .counter-stats-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
  }

  .counter-bar-chart {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
  }

  /* Upgrade */
  .upgrade-ext-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #0f0f0f;
    border-radius: 12px;
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    margin-bottom: 4px;
  }
  .upgrade-ext-btn:hover { opacity: 0.9; }

  .upgrade-limit-msg {
    background: rgba(255,82,82,0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
  }
  .upgrade-limit-msg.visible { display: block; }

  .footer-free-badge {
    color: #ff5252;
    border: 1px solid #ff5252;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    margin-top: 6px;
    display: inline-block;
  }
  .footer-upgrade-bar {
    display: inline-block;
    background: var(--accent);
    color: #0f0f0f;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
    cursor: pointer;
    text-decoration: none;
  }
  .footer-premium-badge {
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    margin-top: 6px;
    display: inline-block;
  }

  .update-btn {
    display: block;
    width: 100%;
    padding: 13px 16px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: 12px;
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 16px;
    animation: updatePulse 2s ease-in-out infinite;
  }
  @keyframes updatePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200,241,53,0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(200,241,53,0); }
  }


  /* Mobile bottom navigation */
  .bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(var(--safe-bottom) + 6px);
    z-index: 900;
  }

  .bottom-nav-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-width: 480px;
    margin: 0 auto;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px 6px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
  }

  .bottom-nav-item .nav-icon { font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center; }
  .bottom-nav-item.active { color: var(--accent); background: var(--surface2); }
  .bottom-nav-item svg { display: block; }

  @media (max-width: 600px) {
    .bottom-nav { display: block; }
    .tabs { display: none; }
    .about-btn { display: none; }
    #view-info .about-back { display: none; }
    #view-info .about-logo { margin-top: 0; }
    #view-info { padding: 0 24px calc(var(--safe-bottom) + 80px); }
    #view-info > * { max-width: 640px; margin-left: auto; margin-right: auto; }
    .view > .stats-header:first-child { display: none; }

    header {
      position: sticky;
      top: 0;
      z-index: 100;
      background: var(--bg);
      padding: calc(var(--safe-top) + 8px) 0 10px;
      margin: calc(-1 * var(--safe-top) - 24px) -16px 16px;
      padding-left: 16px;
      padding-right: 16px;
      border-bottom: 1px solid var(--border);
    }
    .running-indicator { display: none !important; }
    .bottom-nav-item { font-size: 10px; padding: 6px 2px 5px; }
  }

  /* Toast notification */
  #appToast {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--accent);
    color: #0f0f0f;
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 12px;
    max-width: calc(100vw - 40px);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9999;
  }
  #appToast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  /* Place cards */
  .place-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
    cursor: pointer;
    transition: border-color 0.2s;
  }
  .place-card:hover { border-color: var(--accent); }
  .place-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }
  .place-card-photo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
  }
  .place-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    color: var(--accent);
  }
  .place-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
  }
  .place-card-address {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
  }
  .place-card-stats {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
  }
  .place-card-stats strong {
    font-family: 'DM Mono', monospace;
    color: var(--accent);
  }
  .place-card-active {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(200,241,53,0.15);
  }
  .place-card-active .place-card-name::before {
    content: '● ';
    color: var(--accent);
    font-size: 10px;
  }

  /* Place filter tabs */
  #placeFilterTabs {
    display: none;
    grid-template-columns: repeat(4, 1fr);
  }
  #placeFilterTabs.visible {
    display: grid;
  }
  .place-filter {
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
  }
  .place-filter.active {
    background: var(--accent2);
    color: #0f0f0f;
  }
  .place-filter:hover:not(.active) {
    color: var(--text);
  }

  /* Place tracking toggle */
  .place-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
  }
  .place-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  .place-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: 0.2s;
  }
  .place-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--muted);
    border-radius: 50%;
    transition: 0.2s;
  }
  .place-toggle input:checked + .place-toggle-slider {
    background: var(--accent2);
    border-color: var(--accent2);
  }
  .place-toggle input:checked + .place-toggle-slider::before {
    transform: translateX(20px);
    background: #0f0f0f;
  }

  /* Route cards */
  .route-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
    cursor: pointer;
    transition: border-color 0.2s;
  }
  .route-card:hover { border-color: var(--accent2); }
  .route-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
  }
  .route-card-subject {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
  }
  .route-card-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--muted);
  }
  .route-card-stats strong {
    font-family: 'DM Mono', monospace;
    color: var(--accent2);
  }

  /* Route & Place Detail Modal – fullscreen on mobile */
  @media (max-width: 600px) {
    #routeDetailModal .route-detail-modal,
    #placeDetailModal .place-detail-modal {
      max-width: 100%;
      width: 100%;
      height: 100%;
      max-height: 100vh;
      border-radius: 0;
      padding: 16px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      animation: none;
    }
    #routeDetailModal,
    #placeDetailModal {
      padding: 0;
    }
  }

  /* Place detail stats table */
  .place-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }
  .place-stats-table th {
    background: var(--surface2);
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
    padding: 8px 10px;
    text-align: left;
    position: sticky;
    top: 0;
  }
  .place-stats-table td {
    padding: 7px 10px;
    border-top: 1px solid var(--border);
    color: var(--text);
  }
  .place-stats-table td:last-child {
    font-family: 'DM Mono', monospace;
    color: var(--accent);
  }
