:root{
  --bg:#fbfbfb;
  --ink:#111;
  --muted:#585858;
  --rule:#e7e7e7;
  --max:920px;
}

/* =========================
   BASE RESET
========================= */
*{ box-sizing:border-box; }
html,body{ height:100%; }

/* =========================
   IMAGES — RESPONSIVE (LOCKED)
========================= */
img{
  max-width:100%;
  height:auto;
  display:block;
}

/* =========================
   BODY — INTER
========================= */
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  line-height:1.6;
}

/* =========================
   PAGE WRAP
========================= */
.wrap{
  max-width:var(--max);
  margin:0 auto;
  padding:40px 20px 60px;
}

/* =========================
   HEADER / FOOTER
========================= */
.header{
  padding-bottom:18px;
  border-bottom:1px solid var(--rule);
  margin-bottom:28px;
}

.footer{
  border-top:1px solid var(--rule);
  margin-top:42px;
  padding-top:18px;
}

.footer p{ margin:0; }

/* =========================
   HEADINGS — TIFFANY GOTHIC
========================= */
h1,h2{
  font-family:"Tiffany Gothic","Inter",system-ui,sans-serif;
  font-weight:400;
  letter-spacing:0.15px;
}

h1{
  font-size:1.9rem;
  margin:0 0 8px;
}

/* =========================
   TEXT HELPERS
========================= */
.subhead{
  margin:0;
  color:var(--muted);
  max-width:70ch;
}

.section{ margin:28px 0; }

.small{
  font-size:0.92rem;
  color:var(--muted);
}

.tiny{
  font-size:0.85rem;
  color:var(--muted);
  margin-top:8px;
}

/* =========================
   LINKS
========================= */
a{
  color:var(--ink);
  text-decoration:underline;
  text-underline-offset:3px;
}

a:hover{ opacity:0.85; }

/* =========================
   BADGES / UI
========================= */
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid var(--rule);
  background:#fff;
  border-radius:999px;
  font-size:0.95rem;
  text-decoration:none;
  cursor:pointer;
}

.badge[aria-pressed="true"]{
  background:#111;
  color:#fff;
  border-color:#111;
}

/* =========================
   INLINE CODE
========================= */
code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:0.95em;
  background:#f4f4f4;
  border:1px solid var(--rule);
  border-radius:4px;
  padding:2px 6px;
}

/* =========================
   TOOLS BAR
========================= */
.tools{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin:14px 0 18px;
  align-items:center;
}

/* =========================
   SUDOKU TABLE
========================= */
.sudoku{
  border-collapse:collapse;
  margin:10px 0;
  font-family:ui-monospace,"Inter",system-ui,monospace;
  font-size:0.95rem;
}

.sudoku td{
  width:2.2em;
  height:2.2em;
  text-align:center;
  vertical-align:middle;
  border:1px solid var(--rule);
}

.sudoku td.blank{ color:var(--muted); }

.sudoku tr:nth-child(3n) td{ border-bottom-width:2px; }
.sudoku td:nth-child(3n){ border-right-width:2px; }
.sudoku tr:first-child td{ border-top-width:2px; }
.sudoku td:first-child{ border-left-width:2px; }

/* =========================
   IMAGE ROLES
========================= */

/* Main artwork / cover */
.hero-img{
  max-width:100%;
  margin:0 auto 28px;
}

/* Art shown above puzzle */
.art-panel{
  max-width:680px;
  margin:0 auto 32px;
}

/* Small reference or inline visuals */
.img-inline{
  max-width:420px;
  margin:16px 0;
}

/* =========================
   STAGE + CANVAS OVERLAY (LOCKED)
========================= */
.stage{
  border:1px solid var(--rule);
  border-radius:16px;
  overflow:hidden;
  background:var(--bg);
}

/* The transform target for pan/zoom */
.stageInner{
  position:relative;
  display:inline-block;
  transform-origin:0 0;
}

/* Base image defines the natural size */
#baseImage{
  display:block;
  max-width:100%;
  height:auto;
  user-select:none;
  -webkit-user-drag:none;
}

/* Canvas sits on top of the image */
#paint{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  cursor:crosshair;

  /* critical for touch/stylus drawing + pan gestures */
  touch-action:none;
}


/* =========================
   DARK MODE (MANUAL ONLY)
========================= */
html.dark{
  --bg:#0e0e0e;
  --ink:#f2f2f2;
  --muted:#b5b5b5;
  --rule:#2a2a2a;
}

html.dark .badge{
  background:#141414;
}

html.dark code{
  background:#1c1c1c;
  color:#eaeaea;
}

/* =========================
   PRINT STYLES
========================= */
@media print{
  body{
    background:#fff;
    color:#000;
  }

  nav,
  .tools,
  .badge,
  button{
    display:none !important;
  }

  a{
    text-decoration:none;
    color:#000;
  }

  .wrap{
    max-width:100%;
    padding:0;
  }

  .sudoku{
    page-break-inside:avoid;
  }
}