/* Legacy (pre-redesign) stylesheet, scoped under #legacy-root so it cannot restyle the new UI.
   Generated mechanically from the original: every selector is prefixed, :root/body map to
   #legacy-root. Host-integration overrides are at the bottom. Delete with the legacy app. */
  #legacy-root {
    --bg: #f5f4f2;
    --panel: rgba(255,255,255,0.82);
    --panel2: rgba(240,239,237,0.80);
    --line: rgba(200,198,194,0.60);
    --text: #1a1917;
    --muted: #8a8884;
    --accent: #2e6b4f;
    --accent2: #3d8263;
    --pos: #0d6e3a;
    --neg: #b02a1e;
    --warn: #b8860b;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 20px rgba(0,0,0,.07);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --radius: 12px;
    --radius-sm: 8px;
    --golf-ball: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2011%2011'%20shape-rendering='crispEdges'%3E%3Cg%20fill='%23fdfdfd'%3E%3Crect%20x='3'%20y='0'%20width='5'%20height='1'/%3E%3Crect%20x='2'%20y='1'%20width='7'%20height='1'/%3E%3Crect%20x='1'%20y='2'%20width='9'%20height='1'/%3E%3Crect%20x='1'%20y='3'%20width='9'%20height='1'/%3E%3Crect%20x='0'%20y='4'%20width='11'%20height='1'/%3E%3Crect%20x='0'%20y='5'%20width='11'%20height='1'/%3E%3Crect%20x='0'%20y='6'%20width='11'%20height='1'/%3E%3Crect%20x='1'%20y='7'%20width='9'%20height='1'/%3E%3Crect%20x='1'%20y='8'%20width='9'%20height='1'/%3E%3Crect%20x='2'%20y='9'%20width='7'%20height='1'/%3E%3Crect%20x='3'%20y='10'%20width='5'%20height='1'/%3E%3C/g%3E%3Cg%20fill='%23c3c8c4'%3E%3Crect%20x='3'%20y='2'%20width='1'%20height='1'/%3E%3Crect%20x='6'%20y='2'%20width='1'%20height='1'/%3E%3Crect%20x='2'%20y='4'%20width='1'%20height='1'/%3E%3Crect%20x='5'%20y='4'%20width='1'%20height='1'/%3E%3Crect%20x='8'%20y='4'%20width='1'%20height='1'/%3E%3Crect%20x='4'%20y='6'%20width='1'%20height='1'/%3E%3Crect%20x='7'%20y='6'%20width='1'%20height='1'/%3E%3Crect%20x='3'%20y='8'%20width='1'%20height='1'/%3E%3Crect%20x='6'%20y='8'%20width='1'%20height='1'/%3E%3C/g%3E%3C/svg%3E");
  }
  #legacy-root, #legacy-root * { box-sizing: border-box; }
  #legacy-root {
    margin: 1;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased;
    background-color: #a8d8f0;
    background-size: cover; background-position: center; background-attachment: fixed;
  }
  #legacy-root::before {
    content: ''; position: fixed; inset: 0; z-index: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.38) 0%, rgba(0,0,0,0.18) 40%, rgba(0,0,0,0.32) 100%);
    pointer-events: none;
  }
  #legacy-root header, #legacy-root nav, #legacy-root main, #legacy-root .side-box { position: relative; z-index: 1; }
  #legacy-root #toast { position: relative; z-index: 1; }
  #legacy-root header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 28px; border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.78);
    position: sticky; top: 0; z-index: 20; backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
  }
  #legacy-root .brand { display: flex; align-items: center; gap: 10px; }
  #legacy-root .brand h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -.2px; color: var(--text); }
  #legacy-root .brand .dot {
    width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #c8e6c9, #4caf7a 45%, #1b5e3a 75%);
    box-shadow: 0 1px 4px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.25);
  }
  #legacy-root .profile { display: flex; align-items: center; gap: 10px; font-size: 13px; }
  #legacy-root .hcp-badge { background: var(--accent); color: #fff; padding: 3px 10px; border-radius: 20px; font-weight: 600; font-size: 12px; }
  #legacy-root .profile-name { font-weight: 600; font-size: 13px; color: var(--text); }
  #legacy-root .profile-menu { position: relative; display: inline-flex; align-items: center; }
  #legacy-root .profile-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; border: none;
    transition: background .15s;
    flex-shrink: 0;
  }
  #legacy-root .profile-icon:hover { background: var(--accent2); }
  #legacy-root .profile-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    min-width: 160px; z-index: 50; display: none;
    overflow: hidden;
  }
  #legacy-root .profile-menu:hover .profile-dropdown, #legacy-root .profile-menu:focus-within .profile-dropdown { display: block; }
  #legacy-root .profile-dropdown-header {
    padding: 10px 14px; border-bottom: 1px solid var(--line);
    font-size: 11px; color: var(--muted);
  }
  #legacy-root .profile-dropdown-header strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 1px; }
  #legacy-root .profile-dropdown button {
    width: 100%; text-align: left; padding: 10px 14px;
    background: none; border: none; cursor: pointer;
    font-size: 14px; color: var(--neg); font-family: inherit;
    transition: background .1s;
  }
  #legacy-root .profile-dropdown button:hover { background: var(--panel2); }
  #legacy-root nav {
    display: flex; gap: 0; padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky; top: 53px; z-index: 15;
  }
  #legacy-root nav button {
    background: none; border: none; color: var(--muted); padding: 12px 16px; cursor: pointer;
    font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent;
    letter-spacing: -.1px; transition: color .15s;
  }
  #legacy-root nav button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
  #legacy-root nav button:hover { color: var(--text); }
  #legacy-root main { padding: 24px 28px 60px; max-width: 1140px; margin: 0 auto; }
  /* Dashboard is a wide bento layout — let it use much more of the screen */
  #legacy-root main:has(#view-dash.active) { max-width: 1720px; }
  #legacy-root .view { display: none; }
  #legacy-root .view.active { display: block; animation: fade .18s ease; }
  @keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

  #legacy-root .panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  }
  #legacy-root .panel + .panel { margin-top: 16px; }
  #legacy-root h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; letter-spacing: -.2px; }
  #legacy-root h3 { font-size: 11px; font-weight: 600; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
  #legacy-root label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 500; letter-spacing: .1px; }
  #legacy-root input, #legacy-root select, #legacy-root textarea {
    background: var(--panel2); border: 1px solid var(--line); color: var(--text);
    border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
    font-family: inherit; width: 100%; transition: border-color .15s;
  }
  #legacy-root input:focus, #legacy-root select:focus, #legacy-root textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46,107,79,.1);
  }
  #legacy-root .grid { display: grid; gap: 12px; }
  #legacy-root .meta-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  #legacy-root button.btn {
    background: var(--accent); color: #fff; border: none; padding: 9px 16px;
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s, opacity .15s; letter-spacing: -.1px;
  }
  #legacy-root button.btn:hover { background: var(--accent2); }
  #legacy-root button.btn.ghost {
    background: transparent; border: 1px solid var(--line); color: var(--text);
  }
  #legacy-root button.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(46,107,79,.04); }
  #legacy-root button.btn.danger { background: transparent; border: 1px solid #f0d0cc; color: var(--neg); }
  #legacy-root button.btn.danger:hover { background: rgba(192,57,43,.06); }
  #legacy-root button.btn:disabled { opacity: .45; cursor: not-allowed; }
  #legacy-root .row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
  #legacy-root .spacer { flex: 1; }

  #legacy-root table.holes { width: 100%; border-collapse: collapse; font-size: 13px; }
  #legacy-root table.holes th {
    text-align: center; color: var(--muted); font-weight: 600; padding: 8px 6px;
    border-bottom: 1px solid var(--line); font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  }
  #legacy-root table.holes td { padding: 4px 5px; text-align: center; border-bottom: 1px solid var(--line); }
  #legacy-root table.holes input, #legacy-root table.holes select { padding: 6px 6px; text-align: center; }
  #legacy-root table.holes .hnum { font-weight: 700; color: var(--accent); width: 30px; font-size: 12px; }
  #legacy-root .w-score input, #legacy-root .w-putts input, #legacy-root .w-pen input, #legacy-root .w-yds input { width: 56px; }
  #legacy-root .w-drive input { width: 56px; }
  #legacy-root .w-par select { width: 60px; }
  #legacy-root .w-fw select { width: 92px; }
  #legacy-root .chk { width: 16px; height: 16px; accent-color: var(--accent); }
  #legacy-root .shot-toggle { cursor: pointer; color: var(--muted); user-select: none; font-size: 14px; }
  #legacy-root .shot-toggle:hover { color: var(--accent); }
  #legacy-root tr.shots-row td { background: var(--panel2); padding: 10px 14px; text-align: left; }
  #legacy-root .shot-line { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
  #legacy-root .shot-line select, #legacy-root .shot-line input { width: auto; }
  #legacy-root .shot-line .s-dist { width: 80px; } #legacy-root .shot-line .s-club { width: 90px; }
  #legacy-root .totals { display: flex; gap: 24px; margin-top: 14px; font-size: 13px; color: var(--muted); }
  #legacy-root .totals b { color: var(--text); font-size: 17px; font-weight: 700; }

  #legacy-root .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }
  #legacy-root .card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s;
  }
  #legacy-root .card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
  #legacy-root .card .top { display: flex; justify-content: space-between; align-items: flex-start; }
  #legacy-root .card .course { font-weight: 600; font-size: 14px; letter-spacing: -.1px; }
  #legacy-root .card .date { color: var(--muted); font-size: 11px; margin-top: 2px; }
  #legacy-root .card .score { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
  #legacy-root .card .to-par { font-size: 12px; text-align: right; }
  #legacy-root .sg-chips { display: flex; gap: 5px; flex-wrap: wrap; margin: 10px 0; }
  #legacy-root .chip {
    font-size: 11px; padding: 3px 8px; border-radius: 20px;
    background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  }
  #legacy-root .card .actions { display: flex; gap: 6px; margin-top: 10px; }
  #legacy-root .card .actions .btn { padding: 6px 12px; font-size: 12px; }

  #legacy-root .pos { color: var(--pos); } #legacy-root .neg { color: var(--neg); } #legacy-root .muted { color: var(--muted); }
  #legacy-root .score-eagle { background: #1565c0; color:#fff; border-radius:50%; width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; }
  #legacy-root .score-birdie { background: var(--pos); color:#fff; border-radius:50%; width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; }
  #legacy-root .score-par { color: var(--text); font-weight: 500; }
  #legacy-root .score-bogey { background: #fcecea; border: 1px solid #e07060; color: var(--neg); border-radius: 4px; padding: 1px 5px; font-weight: 600; font-size: 12px; }
  #legacy-root .score-double { background: var(--neg); color: #fff; border-radius: 4px; padding: 1px 5px; font-weight: 600; font-size: 12px; }
  #legacy-root .score-worse { background: #8b1a1a; color: #fff; border-radius: 4px; padding: 1px 5px; font-weight: 600; font-size: 12px; }
  #legacy-root .tiles { display: grid; grid-template-columns: repeat(auto-fit,minmax(90px,1fr)); gap: 10px; }
  #legacy-root .tile {
    background: var(--panel2); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 12px 12px;
  }
  #legacy-root .tile .v { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
  #legacy-root .tile .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
  #legacy-root .tile .bm-range { font-size: 9px; color: var(--muted); margin-top: 3px; opacity: .7; }
  #legacy-root .tile.bm-good { border-color: #2e9e5e; background: rgba(212,245,226,0.85); }
  #legacy-root .tile.bm-poor { border-color: #e07060; background: rgba(252,206,202,0.85); }
  #legacy-root .tile.bm-ok { border-color: #c8a83a; background: rgba(253,246,220,0.85); }
  #legacy-root .bm-legend { display: inline-flex; gap: 6px; align-items: center; }
  #legacy-root .bm-good-dot, #legacy-root .bm-ok-dot, #legacy-root .bm-poor-dot { display:inline-block; width:6px; height:6px; border-radius:50%; }
  #legacy-root .bm-good-dot { background: #2e9e5e; } #legacy-root .bm-ok-dot { background: #c8a83a; } #legacy-root .bm-poor-dot { background: var(--neg); }


  #legacy-root .sgbar { display: grid; grid-template-columns: 120px 1fr 64px; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
  #legacy-root .sgbar .track { position: relative; height: 18px; background: var(--panel2); border-radius: 5px; border: 1px solid var(--line); }
  #legacy-root .sgbar .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
  #legacy-root .sgbar .fill { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
  #legacy-root .sgbar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }

  /* Dashboard layout: content + card sit side by side, centered as a group.
     Using flex (not viewport-width tricks) keeps the card on the side when the
     page is zoomed, only stacking on genuinely narrow screens. */
  #legacy-root .dash-layout { display: flex; gap: 20px; align-items: flex-start; justify-content: center; }
  #legacy-root .dash-main { width: 100%; max-width: 1060px; min-width: 0; }
  #legacy-root .dash-side { width: 260px; flex: none; }
  @media (max-width: 1000px) {
    #legacy-root .dash-layout { flex-direction: column; align-items: center; }
    #legacy-root .dash-side { width: 100%; max-width: 340px; }
  }

  /* ── Dashboard bento redesign ─────────────────────────────── */
  #legacy-root .dash-wrap { max-width: 1720px; margin: 0 auto; }
  #legacy-root .dash-wrap > * + * { margin-top: 14px; }
  /* clamp the AI coach summary so the bento row stays short */
  #legacy-root #dash-coach-summary {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Hero banner */
  #legacy-root .dash-hero {
    position: relative; overflow: hidden; border-radius: var(--radius);
    padding: 14px 24px; color: #fff; box-shadow: var(--shadow);
    background: linear-gradient(135deg, #35785a 0%, #1f5138 55%, #163b2a 100%);
    border: 1px solid rgba(255,255,255,0.14);
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  }
  #legacy-root .dash-hero::after {
    content: ""; position: absolute; right: -40px; top: -60px; width: 260px; height: 260px;
    background: radial-gradient(circle at center, rgba(255,211,77,0.20), rgba(255,211,77,0) 70%);
    pointer-events: none;
  }
  #legacy-root .dash-hero-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
  #legacy-root .dash-hero-logo {
    flex: none; width: 46px; height: 46px; border-radius: 12px; font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.28);
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
  }
  #legacy-root .dash-hero-title { font-size: 22px; font-weight: 800; letter-spacing: -.4px; line-height: 1; }
  #legacy-root .dash-hero-title span { color: #ffe08a; }
  #legacy-root .dash-hero-sub { font-size: 12.5px; opacity: .88; margin-top: 4px; }
  #legacy-root .dash-hero-tag {
    position: relative; z-index: 1; font-size: 11px; font-weight: 600; letter-spacing: .3px;
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.24);
    padding: 6px 12px; border-radius: 20px; white-space: nowrap;
  }

  /* Bento row: goals | focus | player rating — equal heights */
  #legacy-root .dash-bento { display: grid; grid-template-columns: 1.1fr 0.95fr 1.1fr; gap: 16px; align-items: stretch; }
  #legacy-root .dash-bento > .bento-cell, #legacy-root .dash-bento > #dash-goals { display: flex; min-width: 0; }
  #legacy-root .dash-bento > .bento-cell > .panel, #legacy-root .dash-bento > .bento-cell > .pcard, #legacy-root .dash-bento > #dash-goals > .panel { flex: 1; width: 100%; margin: 0; }
  #legacy-root .dash-bento .pcard { position: static; }

  /* Trends row */
  #legacy-root .dash-trends { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
  #legacy-root .dash-trends > .panel { margin: 0; }

  @media (max-width: 1080px) {
    #legacy-root .dash-bento { grid-template-columns: 1fr 1fr; }
    #legacy-root .dash-trends { grid-template-columns: 1fr; }
  }
  @media (max-width: 720px) {
    #legacy-root .dash-bento { grid-template-columns: 1fr; }
  }

  /* Player card (video-game style) */
  #legacy-root .pcard { position: sticky; top: 16px; border-radius: 16px; overflow: hidden; color: #fff;
    background: linear-gradient(160deg, #35785a 0%, #1f5138 55%, #163b2a 100%);
    box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.16); }
  #legacy-root .pcard-top { display: flex; align-items: center; gap: 14px; padding: 18px 18px 15px;
    background: linear-gradient(160deg, rgba(255,255,255,0.16), rgba(255,255,255,0)); }
  #legacy-root .pcard-ovr { flex: none; width: 66px; height: 66px; border-radius: 50%; text-align: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.14); border: 2px solid rgba(255,255,255,0.65);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
  #legacy-root .pcard-ovr .n { font-size: 27px; font-weight: 800; line-height: 1; }
  #legacy-root .pcard-ovr .l { font-size: 9px; letter-spacing: 1.5px; opacity: .85; margin-top: 2px; }
  #legacy-root .pcard-id { min-width: 0; }
  #legacy-root .pcard-id .nm { font-size: 17px; font-weight: 800; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #legacy-root .pcard-id .sub { font-size: 12px; opacity: .88; margin-top: 3px; }
  #legacy-root .pcard-arch { display: flex; align-items: center; gap: 11px; padding: 11px 18px;
    background: linear-gradient(90deg, rgba(255,211,77,0.22), rgba(255,211,77,0.04));
    border-top: 1px solid rgba(255,255,255,0.14); border-bottom: 1px solid rgba(255,255,255,0.14); }
  #legacy-root .pcard-arch .ae { font-size: 24px; line-height: 1; flex: none; }
  #legacy-root .pcard-arch .at { display: flex; flex-direction: column; min-width: 0; }
  #legacy-root .pcard-arch .an { font-size: 13.5px; font-weight: 800; letter-spacing: .3px; color: #ffe08a; }
  #legacy-root .pcard-arch .ab { font-size: 10.5px; opacity: .82; line-height: 1.35; margin-top: 2px; }
  #legacy-root .pcard-body { padding: 14px 18px 18px; background: rgba(0,0,0,0.14); }
  #legacy-root .pattr { display: grid; grid-template-columns: 88px 1fr 26px; align-items: center; gap: 10px; margin: 10px 0; }
  #legacy-root .pattr .lbl { font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase; opacity: .92; }
  #legacy-root .pattr .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.18); overflow: hidden; }
  #legacy-root .pattr .bar > i { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }
  #legacy-root .pattr .num { text-align: right; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
  #legacy-root .pcard-foot { font-size: 10px; opacity: .7; text-align: center; padding: 0 12px 14px; line-height: 1.4; }


  #legacy-root .coach-block { margin-bottom: 14px; }
  #legacy-root .weak {
    display: flex; gap: 12px; align-items: center; padding: 10px 12px;
    background: #fdf5f4; border: 1px solid #f0c4c1; border-left: 3px solid var(--neg);
    border-radius: var(--radius-sm); margin-bottom: 8px;
  }
  #legacy-root .weak .pri { font-size: 18px; font-weight: 700; color: var(--neg); width: 24px; }
  #legacy-root .drill, #legacy-root .strat {
    padding: 10px 12px; background: var(--panel2);
    border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px;
  }
  #legacy-root .drill .name { font-weight: 600; color: var(--accent); }
  #legacy-root .pill {
    display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 20px;
    background: rgba(46,107,79,.1); color: var(--accent); margin-left: 6px;
    text-transform: uppercase; letter-spacing: .3px; font-weight: 600;
  }
  #legacy-root .empty { color: var(--muted); text-align: center; padding: 48px; font-size: 14px; }
  #legacy-root .toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff; padding: 10px 20px;
    border-radius: 20px; box-shadow: 0 4px 24px rgba(0,0,0,.18);
    opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
    font-size: 13px; font-weight: 500;
  }
  #legacy-root .toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
  #legacy-root .toast.err { background: var(--neg); }

  /* ── Goal completed celebration ─────────────────────── */
  #legacy-root #confetti-canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 90; display: none;
  }
  #legacy-root .congrats-bg {
    position: fixed; inset: 0; z-index: 95;
    display: none; align-items: center; justify-content: center; padding: 24px;
    background: rgba(22,40,30,.55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  }
  #legacy-root .congrats-bg.show { display: flex; animation: congratsFade .25s ease; }
  @keyframes congratsFade { from { opacity: 0; } to { opacity: 1; } }
  #legacy-root .congrats-card {
    position: relative; width: 100%; max-width: 420px; text-align: center;
    color: #fff; border-radius: 22px; padding: 34px 28px 26px;
    background: linear-gradient(160deg, #35785a 0%, #1f5138 55%, #163b2a 100%);
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 24px 70px rgba(0,0,0,.45);
    animation: congratsPop .45s cubic-bezier(.18,.89,.32,1.28);
  }
  @keyframes congratsPop {
    0% { opacity: 0; transform: scale(.7) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
  }
  #legacy-root .congrats-trophy {
    font-size: 60px; line-height: 1; display: inline-block;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.35));
    animation: congratsTrophy 1.6s ease-in-out infinite;
  }
  @keyframes congratsTrophy {
    0%,100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-8px) rotate(4deg); }
  }
  #legacy-root .congrats-title {
    font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin-top: 12px;
  }
  #legacy-root .congrats-title span { color: #ffe08a; }
  #legacy-root .congrats-sub { font-size: 13.5px; opacity: .9; margin-top: 6px; }
  #legacy-root .congrats-goals {
    margin: 18px 0 6px; display: flex; flex-direction: column; gap: 8px;
  }
  #legacy-root .congrats-goal {
    display: flex; align-items: center; gap: 10px; text-align: left;
    background: linear-gradient(90deg, rgba(255,211,77,0.22), rgba(255,211,77,0.05));
    border: 1px solid rgba(255,255,255,0.18); border-radius: 12px;
    padding: 10px 14px; font-size: 14px; font-weight: 700;
    animation: congratsGoalIn .4s ease both;
  }
  @keyframes congratsGoalIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: none; }
  }
  #legacy-root .congrats-goal .ge { font-size: 20px; flex: none; }
  #legacy-root .congrats-actions { display: flex; gap: 10px; margin-top: 18px; }
  #legacy-root .congrats-actions button {
    flex: 1; padding: 11px 14px; border-radius: 12px; cursor: pointer;
    font-size: 13.5px; font-weight: 700; letter-spacing: .2px; transition: transform .12s, filter .12s;
  }
  #legacy-root .congrats-actions button:hover { transform: translateY(-1px); filter: brightness(1.06); }
  #legacy-root .congrats-primary {
    background: #ffe08a; color: #1f3d2c; border: 1px solid rgba(0,0,0,0.08);
  }
  #legacy-root .congrats-secondary {
    background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.28);
  }
  @media (prefers-reduced-motion: reduce) {
    #legacy-root .congrats-bg.show, #legacy-root .congrats-card, #legacy-root .congrats-trophy, #legacy-root .congrats-goal { animation: none; }
  }

  #legacy-root .modal-bg {
    position: fixed; inset: 0; background: rgba(26,25,23,.4);
    display: none; align-items: center; justify-content: center;
    padding: 24px 20px; overflow: hidden; z-index: 40;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  #legacy-root .modal-bg.show { display: flex; }
  #legacy-root .modal {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 16px; padding: 24px; max-width: 820px; width: 100%;
    box-shadow: 0 8px 48px rgba(0,0,0,.14);
    max-height: calc(100vh - 48px); overflow-y: auto;
  }
  #legacy-root .modal .close {
    float: right; cursor: pointer; color: var(--muted); font-size: 20px;
    width: 28px; height: 28px; display: inline-flex; align-items: center;
    justify-content: center; border-radius: 50%; background: var(--panel2);
    line-height: 1; transition: background .15s;
  }
  #legacy-root .modal .close:hover { background: var(--line); }
  /* 8-bit golf ball loader */
  /* small inline ball (buttons, chips) */
  #legacy-root .spinner {
    display: inline-block; width: 15px; height: 15px; vertical-align: middle;
    background-image: var(--golf-ball); background-size: contain;
    background-repeat: no-repeat; background-position: center;
    image-rendering: pixelated; image-rendering: crisp-edges;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
    animation: golf-spin .8s steps(8) infinite;
  }
  @keyframes golf-spin { to { transform: rotate(360deg); } }

  /* block loader: spinning ball + 8-bit progress bar */
  #legacy-root .golf-loader {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 40px 20px; min-height: 55vh; text-align: center;
  }
  #legacy-root .golf-loader .golf-ball {
    width: 44px; height: 44px;
    background-image: var(--golf-ball); background-size: contain;
    background-repeat: no-repeat; background-position: center;
    image-rendering: pixelated; image-rendering: crisp-edges;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.22));
    animation: golf-spin .8s steps(8) infinite;
  }
  #legacy-root .golf-loader .golf-bar {
    width: 180px; height: 12px; padding: 2px;
    background: rgba(0,0,0,.07); border: 2px solid rgba(255,255,255,.95);
    border-radius: 3px; overflow: hidden; image-rendering: pixelated;
    box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  }
  #legacy-root .golf-loader .golf-bar > i {
    display: block; height: 100%; width: 0; border-radius: 1px;
    background: repeating-linear-gradient(90deg,
      #ffffff 0 6px, rgba(255,255,255,.78) 6px 12px);
    animation: golf-fill 1.8s steps(15) infinite;
  }
  @keyframes golf-fill {
    0%   { width: 0; }
    85%  { width: 100%; }
    100% { width: 100%; opacity: 0; }
  }
  #legacy-root .golf-loader .golf-loader-text {
    color: #ffffff; font-size: 13px; font-weight: 300; letter-spacing: .4px;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
  }

  #legacy-root .hint { font-size: 11px; color: var(--muted); line-height: 1.5; }

  /* course autocomplete */
  #legacy-root .autocomplete-wrap { position: relative; }
  #legacy-root .ac-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius-sm); max-height: 240px; overflow-y: auto;
    box-shadow: var(--shadow);
  }
  #legacy-root .ac-item { padding: 9px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line); }
  #legacy-root .ac-item:last-child { border-bottom: none; }
  #legacy-root .ac-item:hover, #legacy-root .ac-item.focused { background: var(--panel2); }
  #legacy-root .ac-item .ac-name { font-weight: 600; font-size: 13px; }
  #legacy-root .ac-item .ac-loc { font-size: 11px; color: var(--muted); margin-top: 1px; }
  #legacy-root .ac-loading { padding: 10px 12px; color: var(--muted); font-size: 12px; }


/* ── Host integration (new shell) ───────────────────────── */
#legacy-root {
  position: relative; min-height: 100vh; color-scheme: light;
  line-height: normal; font-size: 16px;
  background-image: url('/static/img/golf_background.png');
  background-position: center; background-size: cover; background-attachment: fixed;
}
#legacy-root[hidden] { display: none; }
/* The new shell owns navigation and the profile menu. */
#legacy-root > header, #legacy-root > nav { display: none !important; }
/* Keep legacy overlays above the new tab bar / sidebar. */
#legacy-root .modal-bg { z-index: 1200; }
#legacy-root .toast { z-index: 1300; }
#legacy-root #confetti-canvas { z-index: 1350; }
#legacy-root .congrats-bg { z-index: 1400; }
