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

    body {
      background: #ffffff;
      font-family: Georgia, serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 24px 20px 40px;
      min-height: 100vh;
    }

    h1 {
      font-size: 2rem;
      font-weight: normal;
      color: #222;
      margin-bottom: 12px;
      letter-spacing: 0.02em;
    }

    /* ── Site header & tab nav ──────────────────────────────────────────────── */

    #site-header {
      width: 100%;
      max-width: 800px;
    }

    #tab-nav {
      display: flex;
      border-bottom: 1.5px solid #d4c9b8;
      margin-bottom: 20px;
    }

    .tab-btn {
      font-family: Georgia, serif;
      font-size: 0.95rem;
      color: #999;
      background: none;
      border: none;
      border-bottom: 2.5px solid transparent;
      margin-bottom: -1.5px;
      padding: 10px 22px;
      cursor: pointer;
      letter-spacing: 0.02em;
      transition: color 0.15s;
    }

    .tab-btn:hover { color: #444; }

    .tab-btn.active {
      color: #222;
      border-bottom-color: #E07850;
    }

    /* ── Tab panels ─────────────────────────────────────────────────────────── */

    .tab-panel {
      display: none;
      width: 100%;
      max-width: 800px;
    }

    .tab-panel.active {
      display: block;
    }

    /* ── Index tab ──────────────────────────────────────────────────────────── */

    #index-list {
      padding: 20px 0 40px;
    }

    .index-category {
      margin-bottom: 28px;
    }

    .index-category-heading {
      font-family: Georgia, serif;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      color: #aaa;
      margin-bottom: 8px;
      padding-bottom: 6px;
      border-bottom: 1px solid #ede8e1;
    }

    .index-entry {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 4px;
      cursor: pointer;
      border-bottom: 1px solid #f5f1eb;
    }

    .index-entry:hover {
      background: #faf7f2;
    }

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

    .index-entry-name {
      font-family: Georgia, serif;
      font-size: 0.95rem;
      color: #333;
      transition: color 0.15s;
    }

    .index-entry:hover .index-entry-name {
      color: #E07850;
    }

    .index-lock {
      margin-left: 6px;
      font-size: 0.8em;
      opacity: 0.6;
    }

    /* ── About tab ──────────────────────────────────────────────────────────── */

    .about-content {
      max-width: 600px;
      margin: 0 auto;
      padding: 28px 0 56px;
    }

    .about-photo {
      display: block;
      width: 220px;
      border-radius: 12px;
      margin: 0 auto 28px;
      box-shadow: 0 2px 14px rgba(60, 40, 20, 0.14);
    }

    .about-heading {
      font-family: Georgia, serif;
      font-size: 1.3rem;
      font-weight: normal;
      color: #2a1f14;
      margin-bottom: 14px;
      letter-spacing: 0.01em;
    }

    .about-heading--section {
      margin-top: 36px;
    }

    .about-content p {
      font-family: Georgia, serif;
      font-size: 0.92rem;
      color: #5a4a38;
      line-height: 1.8;
      margin-bottom: 14px;
    }

    .about-ipa {
      background: #f3f1ee;
      border-radius: 4px;
      padding: 1px 6px;
      font-size: 0.88rem;
      color: #444;
      letter-spacing: 0.03em;
    }

    .about-link {
      color: #E07850;
      text-decoration: none;
    }

    .about-link:hover {
      text-decoration: underline;
    }

    #map-container {
      position: relative;
      width: 100%;
      max-width: 800px;
      aspect-ratio: 4 / 3;
      background: transparent;
      border-radius: 8px;
      overflow: hidden;
      isolation: isolate; /* stacking context so ::before z-index:-1 stays inside */
    }

    /* Full-container parchment background — covers the map area AND the
       top/bottom strips that appear on mobile (where the container is taller
       than the 4:3 SVG).  Defined as a pseudo-element so the SVG pins and
       popup card are unaffected by the filter. */
    #map-container::before {
      content: '';
      position: absolute;
      inset: 0;
      z-index: -1;
      background-color: #ede9e4;
      filter: url(#parchment);
    }

    #map-icon {
      position: absolute;
      top: 10px;
      left: 10px;
      width: 88px;
      pointer-events: none;
      z-index: 5;
      background: transparent;
      border: none;
      box-shadow: none;
    }

    /* Pin styles */
    .pin {
      cursor: pointer;
    }

    .pin circle,
    .pin polygon,
    .pin rect {
      transition: filter 0.15s;
    }

    .pin:hover circle,
    .pin:hover polygon,
    .pin:hover rect {
      filter: brightness(0.78);
    }

    .pin.active circle,
    .pin.active polygon,
    .pin.active rect {
      filter: brightness(0.62);
    }

    .pin text {
      font-size: 13.5px;
    }

    /* Semi-transparent backdrop — only shown when card is opened from Index tab */
    #card-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(60, 40, 20, 0.45);
      z-index: 99;
    }

    #card-backdrop.visible {
      display: block;
    }

    /* Popup card — fixed overlay, positioned by JS (near pin) or centred (index) */
    #card {
      position: fixed;
      width: 256px;
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
      padding: 20px 18px 18px;
      z-index: 100;
      visibility: hidden;
    }

    #card.visible {
      visibility: visible;
    }

    #card-close {
      position: absolute;
      top: 10px;
      right: 12px;
      background: none;
      border: none;
      font-size: 1.3rem;
      color: #bbb;
      cursor: pointer;
      line-height: 1;
      padding: 2px 4px;
    }

    #card-close:hover {
      color: #444;
    }

    #card-name {
      font-size: 1.25rem;
      font-weight: normal;
      color: #222;
      margin-bottom: 8px;
      padding-right: 22px;
    }

    #card-ipa {
      display: inline-block;
      background: #F5ECD7;
      border-radius: 6px;
      padding: 4px 10px;
      font-size: 1rem;
      color: #444;
      margin-bottom: 16px;
      letter-spacing: 0.03em;
    }

    .card-label {
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: #aaa;
      margin-bottom: 4px;
      font-family: sans-serif;
    }

    .card-text {
      font-size: 0.88rem;
      color: #555;
      line-height: 1.6;
      margin-bottom: 14px;
    }

    .card-text:last-child {
      margin-bottom: 0;
    }

    .coming-soon {
      font-size: 0.88rem;
      color: #bbb;
      font-style: italic;
    }

    /* Audio controls */
    #card-audio {
      margin-bottom: 14px;
      padding-bottom: 12px;
      border-bottom: 1px solid #efefef;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .audio-row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .audio-btn {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 5px 12px;
      border-radius: 20px;
      border: 1.5px solid transparent;
      font-size: 0.78rem;
      font-family: sans-serif;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
      white-space: nowrap;
      line-height: 1.4;
    }

    #btn-listen {
      background: #f5f5f5;
      border-color: #ddd;
      color: #444;
    }
    #btn-listen:hover  { background: #eaeaea; }
    #btn-listen.active { background: #E07850; border-color: #E07850; color: #fff; }

    #btn-record {
      background: #fff0f0;
      border-color: #f0c0c0;
      color: #b03020;
    }
    #btn-record:hover  { background: #ffe4e4; }

    #btn-stop-rec {
      background: #c0392b;
      border-color: #c0392b;
      color: #fff;
    }
    #btn-stop-rec:hover { background: #a93226; border-color: #a93226; }

    #btn-playback {
      background: #f0f7ff;
      border-color: #b8d8f5;
      color: #1a6fa0;
    }
    #btn-playback:hover  { background: #e2efff; }
    #btn-playback.active { background: #1a6fa0; border-color: #1a6fa0; color: #fff; }

    #btn-rerecord {
      background: none;
      border-color: #ddd;
      color: #aaa;
    }
    #btn-rerecord:hover { color: #666; border-color: #bbb; }

    #card-map-row {
      margin-top: 10px;
    }

    #btn-find-on-map {
      background: #f5f5f5;
      border-color: #ddd;
      color: #444;
    }
    #btn-find-on-map:hover { background: #eaeaea; }

    #legend {
      display: flex;
      flex-wrap: wrap;
      gap: 10px 28px;
      margin-top: 14px;
      max-width: 800px;
      width: 100%;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
    }

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

    .legend-label {
      font-family: Georgia, serif;
      font-size: 13.5px;
      color: #666;
      letter-spacing: 0.01em;
    }

    /* Onboarding overlay */
    #onboarding-overlay {
      position: fixed;
      inset: 0;
      background: rgba(60, 40, 20, 0.55);
      z-index: 200;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    #onboarding-card {
      background: #faf7f2;
      border: 1px solid #e0d8cc;
      border-radius: 18px;
      padding: 28px 28px 26px;
      max-width: 360px;
      width: 100%;
      box-shadow: 0 10px 48px rgba(60, 40, 10, 0.28);
      text-align: center;
    }

    #ob-icon {
      width: 72px;
      margin: 0 auto 16px;
      display: block;
    }

    #onboarding-card h2 {
      font-size: 1.3rem;
      font-weight: normal;
      color: #2a1f14;
      margin-bottom: 12px;
      line-height: 1.3;
    }

    .ob-intro {
      font-size: 0.88rem;
      color: #5a4a38;
      line-height: 1.7;
      margin-bottom: 20px;
    }

    .ob-legend {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px 12px;
      margin-bottom: 24px;
      text-align: left;
    }

    .ob-legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-family: Georgia, serif;
      font-size: 0.82rem;
      color: #5a4a38;
    }

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

    #btn-lets-go {
      background: #E07850;
      color: #fff;
      border: none;
      border-radius: 24px;
      padding: 11px 0;
      width: 100%;
      font-size: 1rem;
      font-family: Georgia, serif;
      cursor: pointer;
      transition: background 0.15s;
      letter-spacing: 0.02em;
    }
    #btn-lets-go:hover { background: #c85e32; }

    #feedback-overlay {
      position: fixed;
      inset: 0;
      background: rgba(60, 40, 20, 0.55);
      z-index: 210;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    #feedback-card {
      position: relative;
      background: #faf7f2;
      border: 1px solid #e0d8cc;
      border-radius: 18px;
      padding: 28px 28px 26px;
      max-width: 340px;
      width: 100%;
      box-shadow: 0 10px 48px rgba(60, 40, 10, 0.28);
      text-align: center;
    }

    #feedback-card h2 {
      font-size: 1.3rem;
      font-weight: normal;
      color: #2a1f14;
      margin-bottom: 12px;
      line-height: 1.3;
    }

    #feedback-close {
      position: absolute;
      top: 10px;
      right: 14px;
      background: none;
      border: none;
      color: #a89a86;
      font-size: 1.4rem;
      line-height: 1;
      cursor: pointer;
      padding: 4px;
    }

    .fb-question {
      font-family: Georgia, serif;
      font-size: 0.92rem;
      color: #2a1f14;
      margin: 16px 0 8px;
      text-align: left;
    }

    .fb-yesno {
      display: flex;
      gap: 10px;
      margin-bottom: 4px;
    }

    .fb-choice {
      flex: 1;
      padding: 10px 0;
      border-radius: 20px;
      border: 1px solid #e0d8cc;
      background: #fff;
      font-family: Georgia, serif;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }

    .fb-choice.selected {
      background: #E07850;
      color: #fff;
      border-color: #E07850;
    }

    #fb-feature-text {
      width: 100%;
      border-radius: 10px;
      border: 1px solid #e0d8cc;
      padding: 10px;
      font-family: Georgia, serif;
      font-size: 0.88rem;
      resize: vertical;
      margin-bottom: 16px;
      box-sizing: border-box;
    }

    #btn-fb-submit {
      background: #E07850;
      color: #fff;
      border: none;
      border-radius: 24px;
      padding: 11px 0;
      width: 100%;
      font-size: 1rem;
      font-family: Georgia, serif;
      cursor: pointer;
      transition: background 0.15s;
      letter-spacing: 0.02em;
    }
    #btn-fb-submit:hover:not(:disabled) { background: #c85e32; }
    #btn-fb-submit:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    /* ── Subscribe sheet ────────────────────────────────────────────────── */

    #subscribe-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(60, 40, 20, 0.45);
      z-index: 300;
      display: none;
    }

    #subscribe-backdrop.open { display: block; }

    #subscribe-sheet {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 301;
      transform: translateY(100%);
      transition: transform 0.28s ease;
    }

    #subscribe-sheet.open { transform: translateY(0); }

    #subscribe-inner {
      background: #faf7f2;
      border-radius: 18px 18px 0 0;
      border: 1px solid #e0d8cc;
      border-bottom: none;
      padding: 28px 24px 40px;
      max-width: 480px;
      margin: 0 auto;
      position: relative;
      box-shadow: 0 -6px 32px rgba(60, 40, 10, 0.16);
    }

    #subscribe-close {
      position: absolute;
      top: 14px;
      right: 16px;
      background: none;
      border: none;
      font-size: 1.3rem;
      color: #bbb;
      cursor: pointer;
      line-height: 1;
      padding: 2px 4px;
    }

    #subscribe-close:hover { color: #444; }

    #subscribe-inner h2 {
      font-family: Georgia, serif;
      font-size: 1.15rem;
      font-weight: normal;
      color: #2a1f14;
      margin-bottom: 10px;
    }

    .subscribe-desc {
      font-family: Georgia, serif;
      font-size: 0.88rem;
      color: #5a4a38;
      line-height: 1.7;
      margin-bottom: 20px;
    }

    .subscribe-input-row {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
    }

    #subscribe-code {
      flex: 1;
      font-family: Georgia, serif;
      font-size: 0.95rem;
      padding: 9px 12px;
      border: 1.5px solid #d4c9b8;
      border-radius: 8px;
      background: #fff;
      color: #222;
      outline: none;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    #subscribe-code:focus { border-color: #E07850; }

    #subscribe-submit {
      font-family: Georgia, serif;
      font-size: 0.9rem;
      background: #E07850;
      color: #fff;
      border: none;
      border-radius: 8px;
      padding: 9px 18px;
      cursor: pointer;
      transition: background 0.15s;
      white-space: nowrap;
    }

    #subscribe-submit:hover { background: #c85e32; }

    #subscribe-status {
      font-family: Georgia, serif;
      font-size: 0.84rem;
      min-height: 1.2em;
    }

    .subscribe-status--ok  { color: #2e7d52; }
    .subscribe-status--err { color: #b03020; }

    /* ── Card locked state ───────────────────────────────────────────────── */

    #card-locked-body {
      margin-top: 8px;
      margin-bottom: 6px;
    }

    .card-locked-msg {
      font-size: 0.88rem;
      color: #888;
      line-height: 1.6;
      margin: 0 0 10px;
    }

    .card-locked-free-list {
      font-size: 0.85rem;
      color: #777;
      margin-top: 8px;
      line-height: 1.5;
    }

    .card-locked-link-row { margin: 0; }

    .card-unlock-link {
      background: none;
      border: none;
      color: #E07850;
      font-size: 0.84rem;
      font-family: Georgia, serif;
      cursor: pointer;
      padding: 0;
      text-decoration: underline;
    }

    .card-unlock-link:hover { color: #c85e32; }

    /* ── About tab unlock status ─────────────────────────────────────────── */

    .about-unlock-status {
      font-size: 0.82rem;
      color: #aaa;
      font-style: italic;
      margin-top: 24px;
      margin-bottom: 0;
    }

    .about-access-para { margin-top: 14px; margin-bottom: 0; }

    .about-access-btn {
      background: none;
      border: 1.5px solid #d4c9b8;
      border-radius: 20px;
      padding: 8px 20px;
      font-family: Georgia, serif;
      font-size: 0.85rem;
      color: #888;
      cursor: pointer;
      transition: color 0.15s, border-color 0.15s;
    }

    .about-access-btn:hover { color: #E07850; border-color: #E07850; }

    /* ── Clickable IPA pills ────────────────────────────────────────────── */

    /* The existing #card-ipa background box becomes the shared container.
       Only override display so it spans the full card width. */
    #card-ipa.has-pills {
      display: block;
      border: 1.5px solid #E07850;
      padding: 6px 10px;
    }

    .ipa-pills-container {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.4em;
    }

    /* Pills sit inline in the shared lozenge — no own background/border/padding,
       so they read as plain text except for the active-phoneme highlight. */
    .ipa-pill {
      display: inline-flex;
      align-items: center;
      gap: 0;
      padding: 0;
      background: transparent;
      border: none;
      font: inherit;
      color: inherit;
      letter-spacing: inherit;
      cursor: pointer;
      line-height: inherit;
      user-select: none;
      -webkit-appearance: none;
      appearance: none;
    }

    .ipa-deco {
      color: #000;
      font-weight: 700;
    }

    .ipa-seg {
      border-radius: 2px;
      padding: 0 1px;
      transition: background 0.06s, color 0.06s;
    }

    .ipa-seg.active {
      background: #E07850;
      color: #fff;
    }

    /* ── Mobile layout ──────────────────────────────────────────────────── */
    @media (max-width: 768px) {
      body {
        padding: 16px 0 0;
      }

      #site-header {
        padding: 0 12px;
      }

      h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
      }

      .tab-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
      }

      #tab-nav {
        margin-bottom: 0;
      }

      /* Full-bleed map, sized directly off viewport height so it fills
         roughly 65-70% of the screen on mobile regardless of width */
      #map-container {
        border-radius: 0;
        aspect-ratio: auto;
        height: 68vh;
      }

      #map-container svg {
        display: block;
        width: 100%;
      }

      #legend {
        padding: 0 12px;
      }

      #index-list {
        padding: 16px 12px 40px;
      }

      .about-content {
        padding: 20px 12px 48px;
      }

      /* Preserve mobile legend at current size/family (desktop changed to Georgia 13.5px) */
      .legend-label {
        font-size: 0.78rem;
        font-family: sans-serif;
      }

      /* !important ensures this overrides the SVG font-size presentation attribute */
      .pin text {
        font-size: 16px !important;
      }

      /* Larger circle radius (SVG 2 geometry property) for a more
         comfortable tap target on touch screens */
      .pin circle {
        r: 16;
      }
    }
