  :root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #242836;
    --text: #e8eaed;
    --text-muted: #9aa0a6;
    --accent: #5c7cfa;
    --border: #2d3142;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --radius: 12px;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  }

  @media (prefers-color-scheme: light) {
    :root {
      --bg: #f0f2f5;
      --surface: #ffffff;
      --surface-hover: #f5f6f8;
      --text: #1a1a1a;
      --text-muted: #5f6368;
      --border: #e0e3e7;
      --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    }
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
  }

  .page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
  }

  header {
    text-align: center;
    margin-bottom: 2.5rem;
  }

  .greeting {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
  }

  .datetime {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.35rem;
  }

  .search-wrap {
    display: block;
    max-width: 560px;
    margin: 1.5rem auto 0;
  }

  .search-wrap input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    box-shadow: var(--shadow);
    transition: border-color 0.15s, box-shadow 0.15s;
  }

  .search-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
  }

  .error-banner {
    background: #3d1f1f;
    color: #ffb4b4;
    border: 1px solid #6b2c2c;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
  }

  @media (prefers-color-scheme: light) {
    .error-banner {
      background: #fde8e8;
      color: #9b1c1c;
      border-color: #f5c6c6;
    }
  }

  .error-banner strong {
    display: block;
    margin-bottom: 0.35rem;
  }

  .collections {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 42rem;
    margin: 0 auto;
  }

  .collection {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .collection-picker {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
  }

  .collection-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: clamp(0.875rem, 2vw, 1.25rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
  }

  .collection-trigger:hover,
  .collection-trigger:focus-visible {
    background: var(--surface-hover);
    color: var(--text);
    outline: none;
  }

  .collection-trigger:disabled {
    opacity: 0.6;
    cursor: wait;
  }

  .collection-trigger-label {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
  }

  .collection-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    align-self: center;
    opacity: 0.85;
  }

  .collection-name {
    max-width: min(20rem, 70vw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .collection-chevron {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0.55;
    flex-shrink: 0;
  }

  .collection-trigger[aria-expanded="true"] .collection-chevron {
    transform: rotate(-135deg) translateY(1px);
  }

  .collection-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    list-style: none;
    min-width: min(18rem, calc(100vw - 2rem));
    max-width: 22rem;
    max-height: min(20rem, 50vh);
    overflow-y: auto;
    margin: 0;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .collection-menu[hidden] {
    display: none;
  }

  .collection-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.1s;
  }

  .collection-option:hover,
  .collection-option:focus-visible {
    background: var(--surface-hover);
    outline: none;
  }

  .collection-menu li.is-active .collection-option {
    font-weight: 600;
  }

  .collection-option-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    opacity: 0.85;
  }

  .collection-option-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .collection-option-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  .collection-loading {
    animation: pulse 1.2s ease-in-out infinite;
  }

  @keyframes pulse {
    50% { opacity: 0.45; }
  }

  .collection-error {
    color: #ffb4b4;
  }

  @media (prefers-color-scheme: light) {
    .collection-error {
      color: #9b1c1c;
    }
  }

  .bookmark-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.35rem 0.65rem;
    padding: 0.25rem 0;
  }

  @media (min-width: 520px) {
    .bookmark-grid {
      grid-template-columns: repeat(5, 1fr);
    }
  }

  @media (min-width: 720px) {
    .collections {
      max-width: 36rem;
    }

    .bookmark-grid {
      grid-template-columns: repeat(6, 1fr);
    }
  }

  .bookmark-grid li {
    min-width: 0;
  }

  .bookmark-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 14px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bookmark-app:hover,
  .bookmark-app:focus-visible {
    outline: none;
    transform: scale(1.06);
  }

  .bookmark-app:active {
    transform: scale(0.94);
    opacity: 0.85;
  }

  .app-icon {
    width: 3.75rem;
    height: 3.75rem;
    border-radius: 22%;
    overflow: hidden;
    background: var(--surface);
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.12),
      0 4px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
  }

  @media (prefers-color-scheme: dark) {
    .app-icon {
      box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.25);
    }
  }

  .app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: var(--border);
  }

  .app-label {
    font-size: 0.6875rem;
    line-height: 1.25;
    text-align: center;
    max-width: 4.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    text-shadow: 0 1px 2px color-mix(in srgb, var(--bg) 40%, transparent);
  }

  .empty-state {
    padding: 2rem 1.15rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
  }

  footer {
    text-align: center;
    margin-top: 2.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  footer a,
  footer button.footer-link {
    color: var(--accent);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: inherit;
    cursor: pointer;
  }

  footer a:hover,
  footer button.footer-link:hover {
    text-decoration: underline;
  }

  footer button.footer-link:disabled {
    opacity: 0.6;
    cursor: wait;
    text-decoration: none;
  }
