@font-face {
  font-family: "Aldo the Apache";
  src: url("aldo-the-apache.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

:root {
    --stage: #000000;
    --ink: #f5f5f7;
    --tile-line: #ffffff;
    --tile-line-hover: #ffffff;
    --tile-bg1: #1c1c1e;
    --tile-bg2: #0a0a0a;
    --pill-bg: #ffffff;
    --pill-ink: #15171a;
    --pill-line: rgba(0, 0, 0, 0.08);
    --badge-bg: #f0f0f2;
    --muted: rgba(245, 245, 247, 0.6);
    --tile: min(30vw, 42vh, 340px);
    --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
    color-scheme: dark;
  }
  :root[data-theme="light"] {
    --stage: #e9eaee;
    --ink: #15171a;
    --tile-line: rgba(21, 23, 26, 0.14);
    --tile-line-hover: rgba(21, 23, 26, 0.28);
    --tile-bg1: #f6f6f8;
    --tile-bg2: #dfe1e6;
    --pill-bg: #f6f6f8;
    --pill-ink: #15171a;
    --pill-line: rgba(0, 0, 0, 0.16);
    --badge-bg: #e4e5e9;
    --muted: rgba(21, 23, 26, 0.68);
    color-scheme: light;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  html { background: var(--stage); }
  body {
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--stage);
    color: var(--ink);
    font-family: var(--font-ui);
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
  }
  #cornerIcon {
    position: fixed;
    z-index: 2;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    left: max(16px, env(safe-area-inset-left, 0px));
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: contain;
  }
  main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 3vh, 32px);
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px 8px;
  }
  h1 {
    margin: 0;
    font-family: "Aldo the Apache", cursive;
    font-size: clamp(40px, 6vw, 76px);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 0;
    text-align: center;
  }
  .tiles {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(12px, 2.5vw, 28px);
  }
  .tile {
    display: block;
    width: var(--tile);
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--tile-line);
    border-radius: clamp(16px, 2vw, 26px);
    overflow: hidden;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: linear-gradient(145deg, var(--tile-bg1), var(--tile-bg2));
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  }
  .tile:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--tile-line-hover);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  }
  .tile:active { transform: scale(0.99); }
  .tile:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
  }
  .tile img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
  }
  footer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(16px, env(safe-area-inset-left, 0px));
  }
  .legal {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    text-align: center;
    margin: 0;
    font-family: "Google Sans", "Product Sans", "Roboto", "Helvetica Neue", Arial, sans-serif;
    font-weight: 300;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
  }
  .legal a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .legal a:hover { color: var(--ink); }
  .footerActions {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .pill {
    display: inline-flex;
    align-items: center;
    height: 46px;
    padding: 7px;
    border: 1px solid var(--pill-line);
    border-radius: 999px;
    background: var(--pill-bg);
    color: var(--pill-ink);
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .pill:hover,
  .pill:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  }
  .pill .label {
    display: block;
    max-width: 0;
    margin-left: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s ease, margin-left 0.3s ease, opacity 0.2s ease;
  }
  .pill:hover .label,
  .pill:focus-visible .label {
    max-width: 220px;
    margin-left: 8px;
    opacity: 1;
  }
  .coffeeIcon {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    display: block;
    object-fit: cover;
    border-radius: 50%;
  }
  .badge {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--badge-bg);
    color: #15171a;
  }
  .badge svg {
    width: 17px;
    height: 17px;
    display: block;
  }
  #themeBtn .icon-sun { display: none; }
  :root[data-theme="light"] #themeBtn .icon-sun { display: block; }
  :root[data-theme="light"] #themeBtn .icon-moon { display: none; }
  @media (max-width: 600px) {
    :root { --tile: min(46vw, 34vh, 230px); }
    main { padding-left: 8px; padding-right: 8px; }
    .tiles { gap: 8px; }
    #cornerIcon { width: 40px; height: 40px; }
    .pill { height: 54px; padding: 9px; font-size: 15px; }
    .coffeeIcon,
    .badge { width: 36px; height: 36px; }
    .badge svg { width: 20px; height: 20px; }
  }