/* GoldTrack Australia
 *
 * Designed for a phone held at arm's length in bright sun, by someone wearing
 * gloves. That drives most of what follows: large tap targets, high contrast,
 * no thin grey-on-grey text, and colour never used as the only signal — every
 * status carries a word as well as a hue.
 *
 * Palette is quartz reef and ironstone rather than the obvious gold gradient:
 * pale quartz, oxidised red, and the deep brown of weathered ore. Gold itself
 * is used once, on the score, so it means something when it appears.
 */

:root {
  --ink:        #1a1512;
  --ink-soft:   #4a3f38;
  --paper:      #f5f1e8;
  --paper-2:    #ebe4d6;
  --line:       #d6cbb6;

  --gold:       #b8862b;
  --quartz:     #fbfaf7;
  --ironstone:  #8c3f24;

  --green:      #2f6b3a;
  --green-bg:   #e4efe2;
  --amber:      #9a6410;
  --amber-bg:   #faeed6;
  --grey:       #5b5750;
  --grey-bg:    #e9e6df;
  --red:        #8f2020;
  --red-bg:     #f7e2e0;

  --radius: 10px;
  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:      #f2ede3;
    --ink-soft: #b9ae9e;
    --paper:    #171310;
    --paper-2:  #221c17;
    --line:     #3a3129;
    --quartz:   #100d0b;
    --green-bg: #17301a;
    --amber-bg: #33240a;
    --grey-bg:  #262320;
    --red-bg:   #3a1614;
    --green:    #7cc389;
    --amber:    #e0a63c;
    --grey:     #a49c90;
    --red:      #e8867e;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink);
  color: var(--paper);
  border-bottom: 3px solid var(--gold);
}
@media (prefers-color-scheme: dark) {
  .bar { background: var(--paper-2); color: var(--ink); }
}

.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; letter-spacing: .01em;
}
.brand em { font-style: normal; opacity: .62; font-weight: 400; }

/* A gold pan, not an emoji — a flat ellipse with a rim highlight. */
.pan {
  width: 22px; height: 15px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 32% 30%, var(--gold) 0 38%, #6d4d15 100%);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.35), 0 0 0 1.5px var(--gold);
  flex: none;
}

.ghost {
  min-height: var(--tap);
  padding: 0 16px;
  border: 1.5px solid currentColor;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ghost:hover { background: rgba(184,134,43,.18); }
.ghost:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ghost[aria-busy="true"] { opacity: .55; }

/* ---------- layout ---------- */
main {
  flex: 1;
  display: grid;
  grid-template-rows: minmax(240px, 42vh) 1fr;
  min-height: 0;
}
@media (min-width: 900px) {
  main { grid-template-rows: 1fr; grid-template-columns: 1fr minmax(380px, 34vw); }
}

/* ---------- map ---------- */
#mapwrap {
  position: relative;
  background: var(--quartz);
  border-bottom: 1px solid var(--line);
  touch-action: none;
  overflow: hidden;
}
@media (min-width: 900px) { #mapwrap { border-bottom: 0; border-right: 1px solid var(--line); } }

#map { display: block; width: 100%; height: 100%; cursor: crosshair; }

#crosshair {
  position: absolute; inset: 0;
  margin: auto;
  width: 26px; height: 26px;
  pointer-events: none;
}
#crosshair::before, #crosshair::after {
  content: ""; position: absolute; background: var(--ironstone);
}
#crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
#crosshair::after  { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }

#scalebar {
  position: absolute; left: 12px; bottom: 12px;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 600 12px/1 ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

#loading {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  padding: 7px 14px;
  background: var(--ink); color: var(--paper);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
}

/* ---------- results panel ---------- */
#panel { overflow-y: auto; padding: 16px 16px 40px; min-height: 0; }
#panel > * + * { margin-top: 14px; }

.empty h1 { font-size: 1.15rem; margin: 0 0 8px; text-wrap: balance; }
.empty p { margin: 0 0 8px; color: var(--ink-soft); }
.fine { font-size: .85rem; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
}
.card > h2 {
  margin: 0;
  padding: 11px 14px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-bottom: 1px solid var(--line);
}
.card .body { padding: 14px; }
.card .body > * + * { margin-top: 10px; }

/* Status: a stripe AND a word. Colour is never the only signal. */
.status {
  display: flex; align-items: baseline; gap: 10px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 6px solid currentColor;
}
.status .word { text-transform: uppercase; letter-spacing: .06em; font-size: .82rem; }
.status .said { font-weight: 500; color: var(--ink); }

.s-green { color: var(--green); background: var(--green-bg); }
.s-amber { color: var(--amber); background: var(--amber-bg); }
.s-grey  { color: var(--grey);  background: var(--grey-bg);  }
.s-red   { color: var(--red);   background: var(--red-bg);   }

/* The score is the one place gold appears. */
.score {
  display: flex; align-items: baseline; gap: 12px;
  font-variant-numeric: tabular-nums;
}
.score b { font-size: 2.6rem; line-height: 1; color: var(--gold); font-weight: 750; }
.score .of { color: var(--ink-soft); font-size: .9rem; }
.score .means { flex: 1 1 100%; color: var(--ink); }

.meter { height: 7px; border-radius: 999px; background: var(--grey-bg); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); }

.conf {
  font-size: .85rem; color: var(--ink-soft);
  border-left: 3px solid var(--line); padding-left: 10px;
}
.conf strong { color: var(--ink); }
.conf ul { margin: 6px 0 0; padding-left: 18px; }
.conf li { margin: 3px 0; }

.finding { border-top: 1px solid var(--line); padding-top: 10px; }
.finding h3 { margin: 0 0 4px; font-size: .95rem; }
.finding p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.finding dl {
  margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr;
  gap: 3px 12px; font-size: .84rem;
}
.finding dt { color: var(--ink-soft); }
.finding dd { margin: 0; }
.finding a { color: var(--ironstone); font-weight: 600; }

/* Hazards get the loudest treatment in the app. It is the only thing here
   that can kill someone. */
.hazard {
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--red-bg);
  padding: 14px;
}
.hazard h2 { margin: 0 0 6px; font-size: 1rem; color: var(--red); }
.hazard p { margin: 6px 0 0; font-size: .88rem; }

.notice {
  font-size: .84rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
.notice strong { color: var(--ink); }

.attrib { font-size: .75rem; color: var(--ink-soft); }

.err {
  border: 2px solid var(--amber);
  background: var(--amber-bg);
  border-radius: var(--radius);
  padding: 14px;
}
.err h2 { margin: 0 0 6px; font-size: 1rem; color: var(--amber); }

/* Footer. Sits below the panel on a phone and below the whole grid on desktop,
   so the coverage limits are always reachable without being in the way of the
   map. Deliberately not hidden behind a link: "this cannot say prohibited" is
   the kind of thing a user must be able to stumble across. */
.foot {
  grid-column: 1 / -1;
  padding: 16px 16px max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-size: .84rem;
  color: var(--ink-soft);
}
.foot p { margin: 0 0 8px; max-width: 70ch; }
.foot p:last-child { margin-bottom: 0; }
.foot strong { color: var(--ink); }
.foot a { color: var(--ironstone); font-weight: 600; }

@media (min-width: 900px) {
  main { grid-template-rows: 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
