/* Bismillah
   Atkinson Hyperlegible, drawn by the Braille Institute so I/l/1 and O/0
   cannot be mistaken for one another. Carried here rather than shared, so
   this folder is complete on its own. Licence in OFL.txt. */

@font-face {
  font-family: 'YD Text';
  font-weight: 400;
  font-display: swap;
  src: url('yd-text-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: 'YD Text';
  font-weight: 400;
  font-display: swap;
  src: url('yd-text-400-latinext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'YD Text';
  font-weight: 700;
  font-display: swap;
  src: url('yd-text-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: 'YD Text';
  font-weight: 700;
  font-display: swap;
  src: url('yd-text-700-latinext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


/* ================= TOKENS ================= */
:root{
  --yd-font: 'YD Text', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --yd-r-sm: 10px;
  --yd-r-md: 14px;
  --yd-r-lg: 20px;
  --yd-r-pill: 999px;

  --yd-gap: 14px;
  --yd-pad: 20px;

  --yd-top: 58px;
  --yd-rail: 218px;
  --yd-panel: 292px;
  --yd-status: 30px;

  --yd-t: .16s cubic-bezier(.4,0,.2,1);
}

/* ---------- DARK (default) ---------- */
:root, :root[data-theme="dark"]{
  /* Tells the browser this page handles light and dark itself. Without it a
     browser set to darken pages automatically repaints the background behind
     our back, and the light theme comes out with a near black body while
     every token still says cream. It also makes scrollbars and form controls
     follow the theme instead of the system. */
  color-scheme: dark;

  --yd-bg:        #0E0E0F;
  --yd-surface:   #161618;
  --yd-surface-2: #1D1D20;
  --yd-border:    #2A2A2E;
  --yd-border-hi: #3A3A40;
  --yd-text:      #EDEBE8;
  --yd-text-dim:  #97938D;
  --yd-text-faint:#5E5B57;

  --yd-accent:    #D8B56B;
  --yd-accent-hi: #E8C983;
  --yd-accent-lo: #9C7C33;
  --yd-on-accent: #17140C;

  --yd-lift:   0 5px 0 var(--yd-accent-lo), 0 12px 20px rgba(0,0,0,.50);
  --yd-lift-a: 0 1px 0 var(--yd-accent-lo), 0 4px 10px rgba(0,0,0,.45);
  --yd-card:   0 1px 0 rgba(255,255,255,.03) inset;
  /* The line that marks a thing as hovered or focused. Gold sits well on
     near black, so here it is the accent. See the light theme. */
  --yd-edge:   var(--yd-accent);
  --yd-ring:   0 0 0 3px rgba(216,181,107,.28);
  --yd-dot:    rgba(255,255,255,.06);
}

/* ---------- LIGHT ---------- */
:root[data-theme="light"]{
  color-scheme: light;

  --yd-bg:        #F5F3EF;
  --yd-surface:   #FFFFFF;
  --yd-surface-2: #EFECE5;
  --yd-border:    #DFDAD1;
  --yd-border-hi: #C9C2B6;
  --yd-text:      #1A1917;
  --yd-text-dim:  #6C6862;
  --yd-text-faint:#9A958D;

  --yd-accent:    #CBA65A;
  --yd-accent-hi: #DEBB72;
  --yd-accent-lo: #8E6C26;
  --yd-on-accent: #1A1408;

  --yd-lift:   0 5px 0 var(--yd-accent-lo), 0 10px 18px rgba(80,62,20,.22);
  --yd-lift-a: 0 1px 0 var(--yd-accent-lo), 0 4px 8px rgba(80,62,20,.18);
  --yd-card:   0 1px 2px rgba(60,50,30,.05);
  /* Gold on cream is the worst of both: too pale to see at a hairline and
     too warm to pass as quiet. A plain dark line does the job. */
  --yd-edge:   var(--yd-text);
  --yd-ring:   0 0 0 3px rgba(26,25,23,.16);
  --yd-dot:    rgba(0,0,0,.07);
}

/* ================= SHELL ================= */
*{ box-sizing:border-box; }
html,body{ margin:0; height:100%; }
body{
  background:var(--yd-bg); color:var(--yd-text);
  font-family:var(--yd-font); font-weight:400; font-size:14px; line-height:1.55;
  -webkit-font-smoothing:antialiased; overflow:hidden;
  transition:background var(--yd-t), color var(--yd-t);
}
h1,h2,h3{ margin:0; font-weight:500; letter-spacing:-.01em; }
p{ margin:0; }
::-webkit-scrollbar{ width:9px; height:9px; }
::-webkit-scrollbar-thumb{ background:var(--yd-border-hi); border-radius:var(--yd-r-pill); }
::-webkit-scrollbar-track{ background:transparent; }

.yd-shell{ height:100%; display:flex; flex-direction:column; }
.yd-mid{ flex:1; display:flex; min-height:0; }
.yd-sp{ flex:1; }

.yd-top{
  height:var(--yd-top); flex:none; display:flex; align-items:center; gap:14px;
  padding:0 18px; background:var(--yd-surface); border-bottom:1px solid var(--yd-border);
}
.yd-brand{ display:flex; align-items:baseline; gap:9px; min-width:0; }
.yd-brand .mark{ align-self:center; flex:none; }
.yd-brand .name{ font-weight:500; font-size:15px; letter-spacing:.01em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.yd-brand .by{ font-size:11.5px; font-weight:300; color:var(--yd-text-faint);
  white-space:nowrap; letter-spacing:.02em; }
.yd-brand .by b{ font-weight:500; color:var(--yd-text-dim); }
.yd-menu{ display:flex; gap:2px; margin-left:10px; }
.yd-menu button{ font:400 13px/1 var(--yd-font); padding:8px 12px; border:0;
  border-radius:var(--yd-r-sm); background:transparent; color:var(--yd-text-dim);
  cursor:pointer; transition:var(--yd-t); }
.yd-menu button:hover{ background:var(--yd-surface-2); color:var(--yd-text); }

.yd-rail{ width:var(--yd-rail); flex:none; padding:14px 12px; overflow:auto;
  background:var(--yd-bg); border-right:1px solid var(--yd-border);
  display:flex; flex-direction:column; gap:3px; }
.yd-rail .grp{ font-size:10px; font-weight:500; letter-spacing:.16em; text-transform:uppercase;
  color:var(--yd-text-faint); padding:14px 10px 7px; }
.yd-nav{ display:flex; align-items:center; gap:11px; width:100%;
  font:400 13.5px/1 var(--yd-font); text-align:left; padding:11px 12px; border:0;
  border-radius:var(--yd-r-sm); background:transparent; color:var(--yd-text-dim);
  cursor:pointer; transition:var(--yd-t); }
.yd-nav svg{ flex:none; opacity:.85; }
.yd-nav:hover{ background:var(--yd-surface); color:var(--yd-text); }
.yd-nav[aria-current="true"]{ background:var(--yd-surface); color:var(--yd-accent); font-weight:500; }
.yd-nav[aria-current="true"] svg{ opacity:1; }

.yd-main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.yd-bar{ flex:none; display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:12px 18px; border-bottom:1px solid var(--yd-border); background:var(--yd-bg); }
.yd-stage{ flex:1; min-height:0; overflow:auto; padding:clamp(18px,3vw,34px);
  display:grid; place-items:center;
  background:
    radial-gradient(circle at 1px 1px, var(--yd-dot) 1px, transparent 0) 0 0/22px 22px,
    var(--yd-bg); }

.yd-panel{ width:var(--yd-panel); flex:none; overflow:auto; padding:var(--yd-pad);
  background:var(--yd-surface); border-left:1px solid var(--yd-border);
  display:flex; flex-direction:column; gap:20px; }
.yd-sec-h{ display:flex; align-items:center; gap:10px;
  font-size:10px; font-weight:500; letter-spacing:.16em; text-transform:uppercase;
  color:var(--yd-text-faint); margin-bottom:12px; }
.yd-sec-h::after{ content:""; flex:1; height:1px; background:var(--yd-border); }

.yd-status{ height:var(--yd-status); flex:none; display:flex; align-items:center; gap:12px;
  padding:0 18px; font-size:11.5px; color:var(--yd-text-faint);
  background:var(--yd-surface); border-top:1px solid var(--yd-border); }
.yd-status .dot{ width:6px; height:6px; border-radius:50%; background:var(--yd-accent); flex:none; }

/* ================= COMPONENTS ================= */
.yd-btn{
  font-family:inherit; font-size:14px; font-weight:500; line-height:1;
  display:inline-flex; align-items:center; justify-content:center; gap:9px;
  padding:13px 22px; border:0; border-radius:var(--yd-r-md);
  color:var(--yd-on-accent);
  background:linear-gradient(180deg, var(--yd-accent-hi), var(--yd-accent));
  box-shadow:var(--yd-lift); cursor:pointer; min-height:44px;
  transition:transform var(--yd-t), box-shadow var(--yd-t), filter var(--yd-t);
}
.yd-btn:hover{ filter:brightness(1.05); }
.yd-btn:active{ transform:translateY(4px); box-shadow:var(--yd-lift-a); }
.yd-btn:focus-visible{ outline:0; box-shadow:var(--yd-lift), var(--yd-ring); }
.yd-btn[disabled]{ opacity:.38; pointer-events:none; }
.yd-btn.wide{ width:100%; }
.yd-btn.sm{ padding:10px 16px; font-size:13px; min-height:38px;
  box-shadow:0 4px 0 var(--yd-accent-lo), 0 8px 14px rgba(0,0,0,.4); }
.yd-btn.icon{ padding:0; width:44px; border-radius:var(--yd-r-pill); }

.yd-btn2{
  font-family:inherit; font-size:14px; font-weight:400; line-height:1;
  display:inline-flex; align-items:center; justify-content:center; gap:9px;
  padding:13px 20px; border-radius:var(--yd-r-md); min-height:44px;
  color:var(--yd-text); background:var(--yd-bg);
  border:1px solid var(--yd-border-hi); cursor:pointer; transition:var(--yd-t);
}
.yd-btn2:hover{ background:var(--yd-surface-2); border-color:var(--yd-edge); color:var(--yd-edge); }
.yd-btn2:active{ transform:translateY(1px); }
.yd-btn2.sm{ padding:10px 14px; font-size:13px; min-height:38px; }
/* square, so the pair reads as one control rather than two words missing */
.yd-btn2.icon{ padding:0; width:44px; flex:none; }
.yd-btn2[disabled]{ opacity:.38; pointer-events:none; }

.yd-btn3{ font-family:inherit; font-size:13.5px; font-weight:400; min-height:44px;
  padding:13px 10px; border:0; background:transparent;
  color:var(--yd-text-dim); cursor:pointer; transition:var(--yd-t); }
.yd-btn3:hover{ color:var(--yd-accent); }

.yd-field{ display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.yd-lab{ font-size:11.5px; font-weight:400; color:var(--yd-text-dim); letter-spacing:.02em;
  display:flex; justify-content:space-between; gap:8px; }
.yd-lab b{ font-weight:500; color:var(--yd-accent); }
.yd-in, .yd-sel{
  font-family:inherit; font-size:14px; color:var(--yd-text);
  padding:12px 14px; border-radius:var(--yd-r-sm); min-height:44px;
  background:var(--yd-bg); border:1px solid var(--yd-border);
  transition:var(--yd-t); width:100%;
}
.yd-sel{ appearance:none; cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);
  background-position:calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size:5px 5px,5px 5px; background-repeat:no-repeat; }
.yd-in::placeholder{ color:var(--yd-text-faint); }
.yd-in:focus, .yd-sel:focus{ outline:0; border-color:var(--yd-edge); box-shadow:var(--yd-ring); }

.yd-range{ -webkit-appearance:none; appearance:none; width:100%; height:4px; margin:11px 0;
  border-radius:var(--yd-r-pill);
  background:var(--yd-surface-2); border:1px solid var(--yd-border); cursor:pointer; }
.yd-range::-webkit-slider-thumb{ -webkit-appearance:none; width:20px; height:20px; border-radius:50%;
  background:var(--yd-accent); border:0; box-shadow:0 3px 0 var(--yd-accent-lo), 0 5px 10px rgba(0,0,0,.4); }
.yd-range::-moz-range-thumb{ width:20px; height:20px; border:0; border-radius:50%;
  background:var(--yd-accent); box-shadow:0 3px 0 var(--yd-accent-lo); }
.yd-range:focus-visible{ outline:0; box-shadow:var(--yd-ring); }

.yd-tog{ display:flex; align-items:center; gap:11px; cursor:pointer; font-size:13.5px;
  color:var(--yd-text-dim); min-height:40px; }
.yd-tog input{ position:absolute; opacity:0; pointer-events:none; }
.yd-tog i{ width:44px; height:25px; border-radius:var(--yd-r-pill); background:var(--yd-surface-2);
  border:1px solid var(--yd-border); position:relative; transition:var(--yd-t); flex:none; }
.yd-tog i::after{ content:""; position:absolute; top:3px; left:3px; width:17px; height:17px;
  border-radius:50%; background:var(--yd-text-faint); transition:var(--yd-t); }
.yd-tog input:checked + i{ background:var(--yd-accent); border-color:var(--yd-accent-lo); }
.yd-tog input:checked + i::after{ left:22px; background:var(--yd-on-accent); }

.yd-seg{ display:inline-flex; padding:4px; gap:3px; border-radius:var(--yd-r-md); max-width:100%;
  background:var(--yd-surface-2); border:1px solid var(--yd-border); }
.yd-seg button{ font-family:inherit; font-size:13px; font-weight:400; padding:9px 16px; border:0;
  flex:1 1 auto; white-space:nowrap; border-radius:var(--yd-r-sm);
  background:transparent; color:var(--yd-text-dim); cursor:pointer; transition:var(--yd-t); }
.yd-seg button:hover{ color:var(--yd-text); }
.yd-seg button[aria-pressed="true"]{ background:var(--yd-accent); color:var(--yd-on-accent); font-weight:500; }

/* Same recipe as the tag on the site's front page: dim text, a plain surface
   behind it, an ordinary border. A chip is a label, and a label does not need
   to shout in the brand colour to be read. */
.yd-chip{ display:inline-block; font-size:10px; font-weight:500; letter-spacing:.1em; text-transform:uppercase;
  padding:5px 10px; border-radius:var(--yd-r-pill);
  color:var(--yd-text-dim);
  background:var(--yd-surface-2);
  border:1px solid var(--yd-border); }

.yd-card{ padding:var(--yd-pad); border-radius:var(--yd-r-lg);
  background:var(--yd-surface); border:1px solid var(--yd-border);
  box-shadow:var(--yd-card); transition:var(--yd-t); }
.yd-card:hover{ border-color:var(--yd-border-hi); }

.yd-switch{ display:inline-flex; align-items:center; gap:2px; flex:none;
  padding:3px; border-radius:var(--yd-r-pill);
  background:var(--yd-surface-2); border:1px solid var(--yd-border); }
.yd-switch button{ display:grid; place-items:center; width:34px; height:28px; padding:0;
  border:0; border-radius:var(--yd-r-pill); background:transparent;
  color:var(--yd-text-faint); cursor:pointer; transition:var(--yd-t); }
.yd-switch button:hover{ color:var(--yd-text-dim); }
.yd-switch button[aria-pressed="true"]{ background:var(--yd-accent); color:var(--yd-on-accent); }

/* The way back to the site. A pill of its own rather than a third button
   inside the theme switch, because it is not a third theme — pressing it
   leaves the page. 36px, not 34: the switch beside it is a 28px button in 3px
   of padding inside a 1px border, and the two line up at the shoulders. */
.yd-back{ display:grid; place-items:center; width:36px; height:36px; flex:none;
  border-radius:var(--yd-r-pill); text-decoration:none; cursor:pointer;
  background:var(--yd-surface-2); border:1px solid var(--yd-border);
  color:var(--yd-text-faint); transition:var(--yd-t); }
.yd-back:hover{ color:var(--yd-text); border-color:var(--yd-border-hi); }
.yd-back:focus-visible{ outline:0; box-shadow:var(--yd-ring); }


/* ================= APP PIECES (same tokens only) ================= */
.hint{ font-size:11px; font-weight:300; line-height:1.45; color:var(--yd-text-faint); }

.yd-menuwrap{ position:relative; }
.yd-pop{ position:absolute; top:calc(100% + 8px); left:0; z-index:60; min-width:236px;
  padding:6px; border-radius:var(--yd-r-md); background:var(--yd-surface);
  border:1px solid var(--yd-border-hi); display:none; flex-direction:column; gap:2px; }
.yd-pop.on{ display:flex; }
.yd-pop button{ font:400 13.5px/1 var(--yd-font); text-align:left; padding:11px 12px; border:0;
  border-radius:var(--yd-r-sm); background:transparent; color:var(--yd-text-dim);
  cursor:pointer; transition:var(--yd-t); min-height:40px; }
.yd-pop button:hover{ background:var(--yd-surface-2); color:var(--yd-text); }
.yd-pop button[disabled]{ opacity:.38; pointer-events:none; }

/* help */
.scrim{ position:fixed; inset:0; z-index:90; background:rgba(0,0,0,.55);
  display:none; place-items:center; padding:20px; }
.scrim.on{ display:grid; }
.helpbox{ width:min(560px,100%); max-height:82vh; overflow:auto; }
.helpbox h2{ font-size:16px; margin-bottom:6px; }
.helpbox p{ font-size:13px; font-weight:300; color:var(--yd-text-dim); line-height:1.6; }
.helpbox dl{ margin:14px 0 0; display:grid; grid-template-columns:auto 1fr; gap:8px 14px;
  font-size:13px; color:var(--yd-text-dim); }
.helpbox dt{ color:var(--yd-text); font-weight:400; white-space:nowrap; }
.helpbox dd{ margin:0; font-weight:300; }

/* ================= MAZE MAKER ================= */
[hidden]{ display:none !important; }
:root{ --yd-panel:320px; }
.mz-stage{ position:relative; padding:0; display:block; overflow:hidden; }
#mzCanvas{ position:absolute; inset:0; width:100%; height:100%; display:block; }
.mz-badge{ position:absolute; left:14px; top:14px; pointer-events:none; font-size:12px; font-variant-numeric:tabular-nums;
  padding:6px 10px; border-radius:var(--yd-r-pill); background:color-mix(in srgb, var(--yd-surface) 90%, transparent); border:1px solid var(--yd-border-hi); color:var(--yd-text-dim); }
.mz-busy{ position:absolute; inset:0; display:none; place-items:center; pointer-events:none; }
.mz-busy span{ font-size:13px; padding:10px 16px; border-radius:var(--yd-r-pill); background:var(--yd-surface); border:1px solid var(--yd-border-hi); }
.mz-stage.is-busy .mz-busy{ display:grid; }
.mz-row{ display:flex; gap:8px; align-items:end; }
.mz-row > *{ flex:1 1 0; min-width:0; }
.mz-mini{ font-size:11px; color:var(--yd-text-faint); display:block; margin-bottom:5px; }
.mz-in{ min-height:40px !important; padding:9px 10px !important; font-variant-numeric:tabular-nums; }
.mz-slider .yd-lab b{ font-variant-numeric:tabular-nums; color:var(--yd-text); font-weight:500; }
.mz-slider .yd-range{ margin:8px 0 4px; }
.mz-seg{ display:grid; width:100%; }
.mz-seg button{ padding:9px 2px; font-size:12.5px; }
.mz-sw{ display:flex; flex-wrap:wrap; gap:7px; align-items:center; margin-top:6px; }
.mz-sw button{ width:28px; height:28px; border-radius:50%; cursor:pointer; padding:0; border:1px solid var(--yd-border-hi); box-shadow:inset 0 0 0 3px var(--yd-surface); }
.mz-sw button[aria-pressed="true"]{ border:2px solid var(--yd-edge); }
.mz-sw input{ width:84px; min-height:30px !important; padding:5px 8px !important; font-size:12.5px !important; }
.mz-info{ font-size:12.5px; color:var(--yd-text-dim); font-variant-numeric:tabular-nums; margin-top:8px; }
@media (max-width:1000px){ .yd-menu{ display:none; } :root{ --yd-panel:290px; } }
@media (max-width:860px){
  html,body{ height:auto; overflow:visible; }
  .yd-shell{ height:auto; min-height:100%; }
  .yd-mid{ flex-direction:column; }
  :root{ --yd-panel:auto; }
  .mz-stage{ flex:none; height:60vh; min-height:340px; }
  .yd-panel{ width:100%; border-left:0; border-top:1px solid var(--yd-border); overflow:visible; }
}
@media (max-width:460px){
  .yd-top{ padding:0 12px; gap:8px; }
  .yd-brand{ flex-direction:column; gap:0; align-items:flex-start; }
  .yd-brand .mark{ display:none; }
  .yd-bar{ padding:10px 12px; }
  .yd-status{ height:auto; padding:8px 12px; flex-wrap:wrap; }
}
@media (prefers-reduced-motion:reduce){ *{ transition:none !important; } }
