/* The course editor (#612): on the site's theme. Colours, type, radii and shadows are /tokens.css's
   (Design/Palette.swift's swatches, light and dark); the controls mirror /style.css's shared
   components, sized for a dense app layout. /style.css itself isn't linked: its page layout
   (a scrolling column, big headings, roomy cards) isn't the editor's full-screen map. */
:root {
  /* The editor's older names, pointed at the palette's roles. */
  --green: var(--fairway); --muted: var(--slate); --warn: var(--clay);
  --amber: var(--flag-ink); --amber-text: var(--flag-ink);
  --sel: color-mix(in srgb, var(--flag) 20%, var(--surface));
  --panel-bg: var(--surface);
  --soft: var(--paper);
  /* Map colours: fixed swatches that read on satellite pictures in both colour schemes (the
     fairway and clay's bright dark-mode values, and flag), and the map's glass bars (pine). */
  --dot-mapped: #3DBA6A; --dot-partly: #F5B700; --dot-none: #FF6B6B;
  --glass: rgb(11 36 64 / 0.88); --glass-line: rgb(255 255 255 / 0.12);
}
@media (prefers-color-scheme: dark) {
  :root { --panel-bg: var(--surface); --soft: var(--raised); --sel: color-mix(in srgb, var(--flag) 16%, var(--surface)); --glass: rgb(10 14 20 / 0.88); }
}

* { box-sizing: border-box; }
/* Hidden means hidden, whatever display a control is given below. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: var(--fs-s)/1.5 var(--font-text); color: var(--ink); background: var(--panel-bg); display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; line-height: 1.2; color: var(--ink); }
a { color: var(--fairway); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
::selection { background: color-mix(in srgb, var(--fairway) 28%, transparent); }

/* ---------- Controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-h-s); padding: 6px 14px;
  border: 0; border-radius: 999px; background: var(--raised); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), filter 0.15s var(--ease), transform 0.15s var(--ease); }
button:hover { background: color-mix(in srgb, var(--raised) 70%, var(--line)); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
button:focus-visible { outline: none; box-shadow: var(--focus); }
button.primary { background: var(--fairway); color: var(--on-fairway); }
button.primary:hover { background: var(--fairway); filter: brightness(1.08); }
button.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
button.ghost:hover { background: var(--raised); }
button.ghost:focus-visible { box-shadow: inset 0 0 0 1px var(--line), var(--focus); }
button.small, .small button { min-height: 30px; padding: 4px 12px; font-size: 13px; }
button.link { display: inline; min-height: 0; border: 0; background: transparent; padding: 0; border-radius: 4px; color: var(--fairway); font: inherit; font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; white-space: normal; }
button.link:hover { background: transparent; text-decoration-thickness: 2px; }
button.link:active { transform: none; }
input, select, textarea { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 6px 10px; min-height: 32px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
input[type=checkbox], input[type=radio] { min-height: 0; padding: 0; width: 16px; height: 16px; accent-color: var(--fairway); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--slate) 45%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fairway); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fairway) 28%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--slate) 80%, transparent); }
kbd { font: 600 var(--fs-xs)/1 var(--font-mono); padding: 2px 6px; border-radius: 6px; background: var(--raised); box-shadow: inset 0 -1px 0 var(--line); color: var(--ink); }
:focus-visible { outline: 2px solid var(--fairway); outline-offset: 2px; }
.muted { color: var(--slate); }
.tiny { font-size: var(--fs-xs); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.card { background: var(--soft); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.pill { display: inline-flex; align-items: center; font-size: var(--fs-xs); font-weight: 600; background: var(--raised); border-radius: 999px; padding: 2px 9px; color: var(--slate); white-space: nowrap; }

/* ---------- Header: the site's sticky glass bar, with the search and account ---------- */
.bar { position: relative; z-index: 1100; display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--panel-bg) 80%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; white-space: nowrap; border-radius: 10px; }
.brand img { width: 32px; height: 32px; display: block; }
.brand .wordmark { font-size: 22px; }
.brand .sub { font: 500 16px/1 var(--font-display); color: var(--slate); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line); }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; min-height: 38px; padding: 8px 14px 8px 38px; border-radius: 999px; background-color: var(--raised); border-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235A6573' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 13px 50%; background-size: 16px; }
.search input:hover { border-color: var(--line); }
.search input:focus { background-color: var(--surface); }
#results { position: absolute; z-index: 1000; top: 100%; left: 0; right: 0; margin: 6px 0 0; padding: 6px; list-style: none; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius); max-height: 60vh; overflow: auto; box-shadow: var(--shadow-lift); }
#results li { padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
#results li:hover, #results li.active { background: var(--mint); color: var(--ink); }
#results small { color: var(--slate); white-space: nowrap; font-weight: 400; }
#account { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#account > .muted { font-weight: 600; color: var(--ink); }

/* ---------- Layout: the panel on the left, the map filling the rest ---------- */
.layout { flex: 1; display: flex; min-height: 0; }
#panel { width: 392px; flex: none; overflow: auto; padding: 18px 20px 32px; border-right: 1px solid var(--line); background: var(--panel-bg); }
#panel h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 10px; }
#panel h2 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
#panel ol { padding-left: 20px; }
#panel ol li { margin: 4px 0; }
#panel ol li::marker { color: var(--fairway); font-weight: 700; }
.course-head { display: flex; gap: 8px; align-items: center; }
#course-name { flex: 1; min-width: 0; font: 800 20px/1.2 var(--font-display); letter-spacing: -0.01em; border-color: transparent; background: transparent; padding: 4px 8px; margin-left: -8px; }
#course-name:hover { border-color: var(--line); }
#course-name:focus { border-color: var(--fairway); background: var(--surface); }
#course-summary { margin: 6px 0 12px; }

/* Tables: quiet headers, hairline rows, tabular figures. */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font: 600 11px/1.2 var(--font-text); letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); padding: 8px 4px 6px; }
td { padding: 3px 4px; border-top: 1px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
#holes tbody tr { cursor: pointer; transition: background 0.12s var(--ease); }
#holes tbody tr:hover { background: var(--soft); }
#holes tbody tr.selected { background: var(--sel); box-shadow: inset 3px 0 0 var(--flag); }
#holes td:first-child { font-weight: 700; width: 44px; }
#holes select { padding: 2px 4px; min-height: 28px; }
#holes input { width: 46px; padding: 2px 6px; min-height: 28px; }
.marks { font-size: var(--fs-xs); color: var(--slate); white-space: nowrap; }
.marks .todo { color: var(--amber); font-weight: 600; }
/* Tees: six columns in the panel's width, so the fields are compact and the figures lose their spinners. */
#tees { table-layout: fixed; }
#tees th:nth-child(1) { width: auto; } #tees th:nth-child(2) { width: 84px; } #tees th:nth-child(3) { width: 74px; }
#tees th:nth-child(4) { width: 50px; } #tees th:nth-child(5) { width: 46px; } #tees th:nth-child(6) { width: 30px; }
#tees td { padding: 3px 2px; }
#tees input, #tees select { width: 100%; min-height: 28px; padding: 2px 5px; font-size: 13px; }
#tees input[type=number] { -moz-appearance: textfield; appearance: textfield; text-align: right; }
#tees input[type=number]::-webkit-inner-spin-button, #tees input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#tees td:last-child button { min-height: 26px; width: 26px; padding: 0; }

.publish { margin-top: 20px; padding: 16px; border-radius: var(--radius); background: var(--soft); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.publish #note { width: 100%; }
.publish #publish { min-height: 40px; padding: 8px 22px; font-size: 15px; }
#status { min-height: 1.4em; margin: 4px 0 0; font-weight: 600; }
#status:empty { min-height: 0; }
#status.error, .problems { color: var(--warn); }
.problems { padding-left: 18px; margin: 4px 0; }

/* ---------- The map ---------- */
.map-wrap { flex: 1; position: relative; min-width: 0; background: var(--stage-deep); }
#map { position: absolute; inset: 0; }
#map.leaflet-container { background: var(--stage-deep); font: 13px/1.4 var(--font-text); }
/* Apple's satellite map (imagery.js) sits under Leaflet's panes and only paints: Leaflet keeps
   the clicks, except on Apple's own legal link. Leaflet's corner controls move up clear of
   Apple's logo and legal text. */
.imagery-mapkit { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.imagery-mapkit a { pointer-events: auto; }
.imagery-apple .leaflet-bottom { bottom: 26px; }
.leaflet-control-layers .imagery-off { color: var(--slate); opacity: 0.6; cursor: default; }

/* Leaflet's controls as the site's floating buttons: rounded, raised, the palette's surface. */
.leaflet-bar, .leaflet-touch .leaflet-bar { border: 0 !important; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-lift); }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; background: var(--surface); color: var(--ink); border-bottom-color: var(--line); font: 600 20px/36px var(--font-text); }
.leaflet-bar a:hover, .leaflet-bar a:focus { background: var(--raised); color: var(--ink); }
.leaflet-bar a.leaflet-disabled { background: var(--surface); color: var(--slate); opacity: 0.5; }
.leaflet-control-layers, .leaflet-touch .leaflet-control-layers { border: 0 !important; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
.leaflet-control-layers-toggle { width: 40px; height: 40px; border-radius: 12px; }
.leaflet-touch .leaflet-control-layers-toggle { width: 40px; height: 40px; }
@media (prefers-color-scheme: dark) { .leaflet-control-layers-toggle { filter: invert(1) hue-rotate(180deg) brightness(1.2); background-color: transparent; } }
.leaflet-control-layers-expanded { padding: 10px 14px 10px 10px; font: 14px/1.5 var(--font-text); }
.leaflet-control-layers label { margin: 2px 0; }
.leaflet-control-layers-selector { accent-color: var(--fairway); margin-right: 6px; }
.leaflet-control-scale-line { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--ink); border-color: var(--slate); font: 600 11px/1.4 var(--font-text); }
.leaflet-control-attribution, .leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 78%, transparent); color: var(--slate); font: 11px/1.4 var(--font-text);
  padding: 2px 8px; border-top-left-radius: 8px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.leaflet-control-attribution a { color: var(--ink); }
.leaflet-tooltip { background: var(--surface); color: var(--ink); border: 0; border-radius: 8px; padding: 4px 10px; font: 600 13px/1.4 var(--font-text); box-shadow: var(--shadow-lift); }
.leaflet-tooltip-top::before { border-top-color: var(--surface); }
.leaflet-tooltip-bottom::before { border-bottom-color: var(--surface); }
.leaflet-tooltip-left::before { border-left-color: var(--surface); }
.leaflet-tooltip-right::before { border-right-color: var(--surface); }

/* The drawing tools: a dark glass bar over the picture, the active tool in the bright fairway. */
#tools { position: absolute; z-index: 800; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 160px); gap: 4px; align-items: center; background: var(--glass); padding: 6px; border-radius: 18px;
  border: 1px solid var(--glass-line); box-shadow: 0 10px 30px rgb(0 0 0 / 0.3); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); }
#tools[hidden] { display: none; }
#tools button { white-space: nowrap; background: transparent; color: rgb(255 255 255 / 0.86); min-height: 32px; padding: 5px 12px; font-weight: 600; }
#tools button:hover { background: rgb(255 255 255 / 0.12); color: #fff; }
#tools button.active { background: var(--stage-green); color: var(--stage); }
#tools button:disabled { color: rgb(255 255 255 / 0.4); }
#tools button:focus-visible { box-shadow: 0 0 0 2px var(--stage-green); }
#tools .sep { width: 1px; height: 20px; background: rgb(255 255 255 / 0.2); margin: 0 4px; }
.tool-label { white-space: nowrap; color: #fff; font: 800 15px/1 var(--font-display); padding: 0 10px 0 8px; }
#tools select { background: rgb(255 255 255 / 0.12); color: #fff; border: 0; border-radius: 999px; padding: 4px 10px; min-height: 30px; font-weight: 600; }
#tools select:focus { box-shadow: 0 0 0 2px var(--stage-green); }
#tools select option { color: var(--ink); background: var(--surface); }
#hint { pointer-events: none; position: absolute; z-index: 800; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--glass); color: #fff;
  padding: 8px 16px; border-radius: 16px; max-width: 80%; text-align: center; font-weight: 500; border: 1px solid var(--glass-line);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* Labels on the map: hole numbers as white discs (the flag's yellow when picked), yardages in glass. */
.hole-label { background: #fff; color: #0B2440; border-radius: 50%; width: 22px; height: 22px; line-height: 22px; text-align: center; font: 800 12px/22px var(--font-display); box-shadow: 0 1px 4px rgb(0 0 0 / 0.5); }
.hole-label.selected { background: #F5B700; }
.yards-label { background: rgb(11 36 64 / 0.85); color: #fff; border-radius: 999px; padding: 1px 8px; font: 700 12px/1.5 var(--font-display); white-space: nowrap; box-shadow: none; border: 0; }
.yards-label::before { display: none; }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: var(--radius-l); background: var(--surface); color: var(--ink); max-width: min(440px, calc(100vw - 32px)); padding: 24px 26px;
  box-shadow: var(--shadow-lift); }
dialog[open] { animation: dialog-in 0.3s var(--ease) both; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
dialog::backdrop { background: rgb(6 12 22 / 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 10px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
dialog p { margin: 8px 0; }
dialog label { display: block; margin: 12px 0; font-weight: 600; }
dialog label input, dialog label select { display: block; width: 100%; margin-top: 6px; min-height: 40px; font-weight: 400; }
dialog > .row:last-child { margin: 18px 0 0; }
#qr { display: flex; justify-content: center; margin: 16px 0; }
#qr svg, #qr img { width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
.code { font: 700 1.8rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-align: center; margin: 6px 0; color: var(--ink); }
#signin-status { text-align: center; }
#history-list { list-style: none; padding: 0; max-height: 50vh; overflow: auto; margin: 12px 0; }
#history-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
#history-list li:first-child { border-top: 0; }
#history-list strong { font-family: var(--font-display); }
#history-list small { color: var(--slate); display: block; }

@media (max-width: 820px) {
  .layout { flex-direction: column-reverse; }
  #panel { width: auto; height: 45%; border-right: 0; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgb(0 0 0 / 0.08); }
  .brand .sub { display: none; }
  /* The search gets a row of its own, and the buttons wrap rather than run off a phone's screen. */
  .bar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 14px; }
  .search { order: 1; flex-basis: 100%; max-width: none; }
  #account { flex-wrap: wrap; justify-content: flex-end; }
  /* The tools sit between Leaflet's zoom buttons and its layers button rather than over them. */
  #tools { flex-wrap: wrap; left: 56px; right: 60px; width: auto; max-width: none; transform: none; justify-content: center; top: 10px; }
  #tools button { padding: 4px 10px; }
  .map-tip { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; }
}
@media (max-width: 560px) {
  /* A phone: the logo and Add a course, then the account in one row, then the search. The tools
     are one row that scrolls sideways, so the picture stays in view. */
  #add-course { margin-left: auto; }
  #account { order: 1; flex-basis: 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; }
  #account > .muted, #account .rank-progress { display: none; }
  #account button:last-child { margin-left: auto; }
  .search { order: 2; }
  #tools { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; border-radius: 999px; }
  #tools::-webkit-scrollbar { display: none; }
  #tools button, #tools select, .tool-label { flex: none; }
}
@media (max-width: 420px) {
  .brand img { width: 28px; height: 28px; }
  .brand .wordmark { font-size: 19px; }
  #account button { padding: 4px 10px; font-size: 13px; }
}
@media (min-width: 1800px) {
  #panel { width: 440px; padding: 22px 26px 36px; }
}

/* ---------- Signed out: the sign-in screen instead of the editor ---------- */
body.locked .layout, body.locked .search, body.locked #add-course, body.locked #account { display: none; }
body.locked { background: var(--bg); }
#gate[hidden] { display: none; }
#gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px;
  background: radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--fairway) 10%, transparent), transparent 70%); }
.gate-card { max-width: 520px; background: var(--surface); border-radius: var(--radius-xl); padding: clamp(28px, 5vw, 48px); box-shadow: var(--shadow-lift);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.gate-card img { width: 64px; height: 64px; border-radius: 15px; box-shadow: var(--shadow); }
.gate-card h1 { font-size: clamp(30px, 5vw, 40px); font-weight: 800; letter-spacing: -0.02em; margin: 18px 0 10px; }
.gate-card p { font-size: 17px; line-height: 1.55; color: var(--ink); }
.gate-card p.tiny { font-size: var(--fs-s); color: var(--slate); }
.gate-card button.primary { min-height: 48px; padding: 12px 24px; font-size: 17px; margin: 6px 0; }

/* ---------- Tees ---------- */
.tee-dot { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #0B2440; box-shadow: 0 1px 4px rgb(0 0 0 / 0.5); }
.tee-colour { width: 86px; padding: 2px 4px; border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.tee-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; border: 1px solid var(--line); vertical-align: -1px; }
dialog.wide { max-width: min(860px, calc(100vw - 32px)); }
.card-scroll { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
#card-table input { width: 64px; padding: 2px 6px; min-height: 28px; text-align: right; }
#card-table td:first-child { font-weight: 700; }
#card-table tr.sum td { font-weight: 700; border-top: 2px solid var(--line); }
#card-table th { position: sticky; top: 0; background: var(--surface); }

/* Pasting a scorecard */
#paste-dialog label { margin: 14px 0 6px; font-weight: 600; }
#paste-text { display: block; width: 100%; min-height: 120px; resize: vertical; font: 12px/1.45 var(--font-mono); padding: 8px 10px; }
#paste-dialog h3 { font-size: 16px; margin: 16px 0 6px; }
#paste-result .card-scroll { max-height: 40vh; }
#paste-dialog { max-width: min(1000px, calc(100vw - 32px)); }
#paste-table th, #paste-table td { padding: 4px 6px; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#paste-table th[scope="row"] { position: sticky; left: 0; background: var(--surface); color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; }
#paste-table thead th { position: sticky; top: 0; background: var(--surface); }
#paste-table thead th:first-child { left: 0; z-index: 1; }
#paste-table td.missing { color: var(--warn); font-weight: 700; }
#paste-table td.total { font-weight: 700; border-left: 2px solid var(--line); }
#paste-table .pill { margin-left: 6px; }
.checks { padding-left: 18px; margin: 4px 0; color: var(--fairway); }

/* Holes drawn without a line of play: the app can't measure them. */
.marks .noline { color: var(--warn); font-weight: 600; }
#noline-dialog { max-width: min(480px, calc(100vw - 32px)); }

/* ---------- Complete holes, the checklist and drafts ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#holes td.status-cell { width: 20px; padding-right: 0; }
#holes td.hole-number { font: 800 15px/1 var(--font-display); width: 36px; }
#holes td:first-child { font-weight: 400; width: 20px; }
.hole-status { font-weight: 700; white-space: nowrap; }
.hole-status.complete { color: var(--fairway); }
.hole-status.progress { color: var(--amber); }
.hole-status.empty { color: var(--slate); }
.marks .todo { color: var(--amber); }

#progress { margin: 6px 0 12px; }
.progress-text { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; }
#progress-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--fairway), var(--putting)); border-radius: inherit; transition: width 0.3s var(--ease); }
@media (prefers-reduced-motion: reduce) { #progress-fill { transition: none; } }

#checklist .check-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#checklist .check-head strong { font: 800 16px/1.2 var(--font-display); }
.checklist { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checklist li { display: flex; gap: 5px; align-items: baseline; }
.checklist .mark { font-weight: 700; width: 12px; text-align: center; }
.checklist li.done .mark { color: var(--fairway); }
.checklist li.missing { color: var(--slate); }
.checklist li.missing .mark { color: var(--amber); }
.next-step { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.next-step p { margin: 4px 0; }
.next-step .row { margin: 8px 0 2px; }
.complete-note { color: var(--fairway); font-weight: 600; margin: 8px 0 2px; }

.banner { border: 1px solid color-mix(in srgb, var(--fairway) 45%, transparent); background: color-mix(in srgb, var(--mint) 60%, var(--surface)); }
.banner p { margin: 4px 0; }
.banner .moved { color: var(--amber-text); }
#publish { max-width: 100%; text-align: left; white-space: normal; }
#publish-reason { margin: 0 0 6px; }
#draft-status { margin: 6px 0 0; min-height: 1.2em; }
.publish > :last-child { margin-bottom: 0; }
#draft-status.error, #booking-note.error { color: var(--warn); }
.booking-url { width: 100%; box-sizing: border-box; }

/* ---------- Points, ranks and locks ---------- */
button.rank-badge { color: var(--fairway); background: var(--mint); box-shadow: none; }
button.rank-badge:hover { background: color-mix(in srgb, var(--mint) 80%, var(--fairway)); }
button.review-badge { background: color-mix(in srgb, var(--flag) 22%, transparent); color: var(--flag-ink); box-shadow: none; }
.rank-progress { display: inline-block; width: 64px; height: 6px; background: var(--raised); border-radius: 999px; overflow: hidden; }
.rank-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--fairway), var(--putting)); border-radius: inherit; }
.padlock { margin-left: 4px; font-size: 11px; font-weight: 600; color: var(--amber-text); white-space: nowrap; cursor: help; }
.lock-note { color: var(--amber-text); margin: 6px 0; }
#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 2000; background: var(--fairway); color: var(--on-fairway);
  font: 800 17px/1.2 var(--font-display); padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow-lift); animation: toast-in 0.35s var(--spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } }
#toast[hidden] { display: none; }
#leaderboard-dialog { width: min(480px, calc(100vw - 32px)); max-width: none; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--raised); }
.segmented.row { display: flex; width: fit-content; margin: 12px 0; }
.segmented button { background: transparent; color: var(--slate); box-shadow: none; }
.segmented button:hover { background: transparent; color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.leaderboard { list-style: none; padding: 0; margin: 8px 0; max-height: 50vh; overflow: auto; }
.leaderboard li { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 8px; align-items: baseline; padding: 9px 4px; border-top: 1px solid var(--line); }
.leaderboard li:first-child { border-top: 0; }
.leaderboard li.muted { display: block; }
.leaderboard .position { color: var(--slate); font: 800 15px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.leaderboard .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
dialog label.check input { display: inline; width: 16px; min-height: 0; margin: 0; }

/* ---------- What's mapped: the coverage card on the welcome panel (coverage.js). Dot colours match the map's. ---------- */
#coverage h2 { margin-top: 0; }
#coverage h3 { font-size: 14px; margin: 14px 0 2px; }
#coverage p { margin: 4px 0; }
.coverage-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--raised); margin: 10px 0; gap: 2px; }
.coverage-bar span { display: block; height: 100%; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.3); flex: none; }
.dot.mapped, .coverage-bar .mapped { background: var(--dot-mapped); }
.dot.partly, .coverage-bar .partly { background: var(--dot-partly); }
.dot.none, .coverage-bar .none { background: var(--dot-none); }
.legend { border: 0; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 4px; }
.legend label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.legend .count { color: var(--slate); font-variant-numeric: tabular-nums; }
.nearby { list-style: none; padding: 0; margin: 6px 0 0; }
.nearby li.muted { padding: 4px 0; }
.nearby button.link { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px; margin: 0 -8px;
  width: calc(100% + 16px); border-radius: var(--radius-s); text-decoration: none; color: var(--ink); }
.nearby button.link:hover, .nearby button.link:focus-visible { background: var(--surface); box-shadow: var(--shadow); }
.nearby .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nearby small { white-space: nowrap; font-weight: 400; }
.course-head #close-course { flex: none; }

/* Suggested lines of play */
.marks .suggested { color: var(--water); font-weight: 600; }
#suggestions p { margin: 4px 0; }

/* The scorecard grid */
#card-table { width: auto; }
#card-table th[scope="col"] { text-align: right; padding: 8px 8px 6px; white-space: nowrap; }
#card-table th[scope="col"]:first-child { text-align: left; }
#card-table td { padding: 2px 6px; }
#card-table th[scope="row"] { color: var(--ink); font-size: 13px; padding: 2px 14px 2px 8px; text-transform: none; letter-spacing: 0; }
#card-table input.bad { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
#card-table tr.sum th, #card-table tr.sum td { font-weight: 700; border-top: 2px solid var(--line); }
.error-line { margin: 6px 0; color: var(--fairway); }
.error-line.error { color: var(--warn); }
#card-warnings { max-height: 18vh; overflow: auto; }
.card-add input { flex: 1; min-width: 160px; }

/* ---------- Outlining from the picture (#189): a crosshair to aim with, a pulse where you clicked, the
   status over the map and the first-time tip. ---------- */
.leaflet-container.outline-tool, .leaflet-container.outline-tool .leaflet-interactive { cursor: crosshair; }
.outline-pulse { position: relative; width: 36px; height: 36px; }
.outline-pulse::before, .outline-pulse::after { content: ""; position: absolute; border-radius: 50%; }
.outline-pulse::before { inset: 13px; background: #F5B700; box-shadow: 0 0 0 2px #0B2440, 0 1px 4px rgb(0 0 0 / 0.5); }
.outline-pulse::after { inset: 0; border: 3px solid #F5B700; animation: outline-pulse 1.2s ease-out infinite; }
.outline-pulse.waiting::before { background: #fff; }
.outline-pulse.waiting::after { animation: none; opacity: 0.7; border-style: dashed; border-color: #fff; }
@keyframes outline-pulse { from { transform: scale(0.35); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.map-status { position: absolute; z-index: 850; bottom: 76px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  background: var(--fairway); color: var(--on-fairway); font-weight: 600; padding: 10px 18px; border-radius: 999px; max-width: min(640px, 86%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3); pointer-events: none; transition: opacity 0.2s var(--ease); }
.map-status:not(.show) { opacity: 0; visibility: hidden; }
.map-status.busy { background: var(--glass); color: #fff; border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.map-status.error { background: var(--clay); color: #fff; }
.map-status .spinner { display: none; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgb(255 255 255 / 0.3);
  border-top-color: #fff; animation: spin 0.8s linear infinite; }
.map-status.busy .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Reduced motion: a still ring and a still spinner (the words say it's working), and nothing slides in. */
@media (prefers-reduced-motion: reduce) {
  .outline-pulse::after { animation: none; opacity: 0.9; transform: none; }
  .map-status .spinner { animation: none; border-color: #fff; border-style: dotted; }
  dialog[open], #toast { animation: none; }
  button, input, select, textarea, #holes tbody tr { transition: none; }
}
.map-tip { position: absolute; z-index: 860; top: 66px; right: 12px; width: 310px; background: var(--surface); color: var(--ink); border-radius: var(--radius);
  padding: 14px 16px 6px; box-shadow: var(--shadow-lift); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.map-tip[hidden] { display: none; }
.map-tip h2 { font-size: 16px; margin: 0 0 6px; }
.map-tip ul { margin: 0; padding-left: 18px; }
.map-tip li { margin: 4px 0; }
.map-tip li::marker { color: var(--fairway); }
details.help { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--soft); }
details.help summary { cursor: pointer; font-weight: 600; color: var(--fairway); }
details.help p { margin: 8px 0; }

/* ---------- Suggested changes and area managers (community editing, phase 3) ---------- */
dialog h3 { margin: 18px 0 4px; font-size: 16px; }
dialog textarea { display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; }
.changes { list-style: none; padding: 0; margin: 6px 0; max-height: 40vh; overflow: auto; }
.changes > li { padding: 12px 14px; margin: 8px 0; border-radius: var(--radius); background: var(--soft); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.changes > li.muted { border: 0; background: transparent; padding: 4px 0; }
.changes .what { margin: 6px 0 0 0; padding-left: 18px; }
.changes .note { font-style: italic; margin: 6px 0 0; }
.changes .row { margin-top: 8px; margin-bottom: 0; }
.changes .warn { color: var(--warn); }
.review-badge { font-weight: 600; }

/* The logo (Design/Brand, #257) is styled in /tokens.css. */
