:root{
  /* ---- base palette: outlines & ink ---- */
  --ink-900:#0e0f08;--ink-800:#1c1e12;--ink-700:#333524;
  /* ---- Hyrule field greens ---- */
  --grass-100:#cfe9b4;--grass-200:#a3d68a;--grass-300:#6fbb5a;--grass-400:#499d4a;--grass-500:#3d8440;--grass-600:#2f7532;--grass-700:#256026;--grass-800:#1b4a20;
  --grass-bush:#36633d;   /* desaturated bush/tree green from the reference */
  /* ---- earth browns ---- */
  --earth-100:#cbb887;--earth-200:#a8935a;--earth-300:#8c7b48;--earth-400:#7a6339;--earth-500:#674c2c;--earth-600:#4d3820;--earth-700:#37281a;
  /* ---- stone greys ---- */
  --stone-050:#fffaea;--stone-100:#efe3c8;--stone-200:#d6c9a6;--stone-300:#b0a482;--stone-400:#8c8470;--stone-500:#5f6152;--stone-600:#3c3d2c;--stone-700:#252513;
  --slab-300:#7fb39c;--slab-500:#4f856e;--slab-700:#2f5346;   /* mossy stone slabs */
  --roof-300:#ddb5b0;--roof-500:#905554;--roof-700:#6b393a;   /* village roof rose */
  /* ---- dusk purples (night / dark mode) ---- */
  --dusk-100:#b8a8e0;--dusk-200:#8f7cc0;--dusk-300:#6a559c;--dusk-400:#4c3c78;--dusk-500:#382b5c;--dusk-600:#261c42;--dusk-700:#18102c;--dusk-800:#0e0a1c;
  /* ---- triforce gold: accents & primary actions only ---- */
  --gold-100:#fff2b0;--gold-200:#ffe07c;--gold-300:#f5c73c;--gold-400:#d8a220;--gold-500:#a87614;--gold-600:#704c0c;
  /* ---- glyph colors (hearts, rupees, magic) ---- */
  --heart-red:#c2110d;--heart-red-dark:#7a0c08;--heart-empty:#5f6152;
  --rupee-green:#24c52d;--rupee-blue:#3878d8;--rupee-red:#c2110d;--rupee-purple:#a860d0;--rupee-silver:#d8dce4;
  --magic-green:#24c52d;--potion-red:#c2110d;

  /* ---- semantic: surfaces ---- */
  --surface-field:var(--grass-400);        /* the overworld ground */
  --surface-forest:var(--grass-600);
  --surface-path:var(--earth-200);
  --surface-panel:var(--stone-050);        /* parchment panel / item card */
  --surface-panel-alt:var(--stone-100);
  --surface-dialog:#1c1830;                /* ALttP text box interior */
  --surface-dialog-edge:#3c3860;
  --surface-sunken:var(--stone-200);
  --surface-stone:var(--stone-300);
  --surface-slab:var(--slab-500);
  --surface-roof:var(--roof-500);
  --surface-night:var(--dusk-700);

  /* ---- semantic: text ---- */
  --text-body:var(--ink-800);
  --text-muted:var(--stone-500);
  --text-heading:var(--ink-900);
  --text-inverse:var(--stone-050);
  --text-on-dialog:#f4f0e0;
  --text-on-dialog-muted:#a8a4c0;
  --text-accent:var(--gold-500);
  --text-link:var(--grass-700);
  --text-link-hover:var(--gold-500);
  --text-code:var(--earth-600);

  /* ---- semantic: lines & actions ---- */
  --border-outline:var(--ink-900);         /* the chunky 2-3px dark outline, everywhere */
  --border-soft:var(--stone-300);
  --border-inset:#ffffff;
  --action-primary:var(--gold-300);
  --action-primary-hover:var(--gold-200);
  --action-primary-press:var(--gold-400);
  --action-secondary:var(--stone-100);
  --action-secondary-hover:var(--stone-050);
  --focus-ring:var(--gold-200);

  /* ---- semantic: state ---- */
  --state-ready:var(--gold-300);           /* quest ready-to-start glow */
  --state-blocked:var(--heart-red);        /* tael's boundary refusal */
  /* Day values above are sampled from assets/reference-alttp-overworld.png. */
  --state-done:var(--grass-500);
  --state-idle:var(--stone-400);
  --state-drift:var(--rupee-purple);       /* lens: code != deployed */

  /* ---- scene tiles: every tile/sprite paints through these so dusk re-tints the world ---- */
  --tile-ink:var(--border-outline);
  --tile-grass:var(--grass-400);--tile-grass-lt:var(--grass-300);--tile-grass-dk:var(--grass-600);
  --tile-bush:var(--grass-bush);--tile-bush-lt:var(--grass-500);--tile-bush-dk:var(--grass-800);
  --tile-path:var(--earth-300);--tile-path-lt:var(--earth-200);--tile-path-dk:var(--earth-400);
  --tile-cliff:var(--earth-500);--tile-cliff-lt:var(--earth-400);--tile-cliff-dk:var(--earth-700);
  --tile-slab:var(--slab-500);--tile-slab-lt:var(--slab-300);--tile-slab-dk:var(--slab-700);
  --tile-roof:var(--roof-500);--tile-roof-lt:var(--roof-300);--tile-roof-dk:var(--roof-700);
  --tile-wall:var(--stone-100);--tile-wall-dk:var(--stone-300);
  --tile-wood:var(--earth-600);--tile-wood-lt:var(--earth-300);
}

/* Dusk / night — dark mode. Same structure, purple-shifted. */
[data-theme="dusk"]{
  --surface-field:var(--dusk-500);
  --surface-forest:var(--dusk-600);
  --surface-path:var(--dusk-400);
  --surface-panel:var(--dusk-600);
  --surface-panel-alt:var(--dusk-500);
  --surface-dialog:#100c22;
  --surface-dialog-edge:#2e2450;
  --surface-sunken:var(--dusk-700);
  --surface-stone:var(--dusk-400);

  --text-body:#e0d8f4;
  --text-muted:var(--dusk-200);
  --text-heading:#f4eedc;
  --text-inverse:var(--dusk-800);
  --text-accent:var(--gold-200);
  --text-link:var(--gold-200);
  --text-link-hover:var(--gold-100);
  --text-code:var(--dusk-100);

  --border-outline:#0a0714;
  --border-soft:var(--dusk-400);
  --border-inset:var(--dusk-300);
  --action-secondary:var(--dusk-400);
  --action-secondary-hover:var(--dusk-300);
  --state-idle:var(--dusk-300);

  /* night wash: the same world, purple-shifted */
  --tile-ink:#0a0714;
  --tile-grass:#3a5a5e;--tile-grass-lt:#4c7370;--tile-grass-dk:#2a4448;
  --tile-bush:#28444c;--tile-bush-lt:#35595c;--tile-bush-dk:#1a2f38;
  --tile-path:#6e6480;--tile-path-lt:#877c98;--tile-path-dk:#544c66;
  --tile-cliff:#463a60;--tile-cliff-lt:#5c4e78;--tile-cliff-dk:#2e2544;
  --tile-slab:#3f6274;--tile-slab-lt:#567e8c;--tile-slab-dk:#294450;
  --tile-roof:#5e4266;--tile-roof-lt:#7e5f86;--tile-roof-dk:#402c4a;
  --tile-wall:#9a92b4;--tile-wall-dk:#746c94;
  --tile-wood:#3a3050;--tile-wood-lt:#5a4e74;
}
