/* ========== Generator UI (shared) ========== */
:root{
  --brand:#ef7f1a;         /* orange primary */
  --ink:#222;
  --muted:#666;
  --bg:#f9fafb;            /* page */
  --surface:#fff;          /* cards/panels */
  --border:#e7e7e7;        /* thin grey */
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
}

/* ---- Layout ---- */
.wrap{ max-width:980px; margin:28px auto 64px; padding:0 20px; }
.panel{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
  box-shadow:0 3px 24px rgba(0,0,0,.04);
  margin-bottom:12px;
}
.stage{ margin-top:12px; }
.meta{ text-align:center; color:var(--muted); font-size:14px; margin-top:8px; }
.note{ margin-top:10px; font-size:12.5px; color:#777; }

/* ---- Typography ---- */
h1{ margin:0 0 14px; font-size:36px; font-weight:700; }

/* ---- Controls ---- */
.row{ display:flex; flex-wrap:wrap; gap:16px 18px; align-items:center; }
.grid-2col{ display:grid; grid-template-columns:auto 1fr; gap:10px 18px; align-items:center; }
.group-label{ font-weight:600; color:#444; }

input[type="text"], input[type="number"]{
  height:36px; border:1px solid #dedede; border-radius:8px;
  padding:0 10px; font-size:14px; background:#fff; color:var(--ink);
}
input[type="number"]{ width:76px; text-align:center; }

label.cb{ display:inline-flex; gap:8px; align-items:center; cursor:pointer; user-select:none; }
label.cb input{ width:18px; height:18px; }

/* ---- Buttons ---- */
.btn{
  appearance:none;
  border:1px solid #dedede;
  background:#fff; color:#222;
  padding:10px 16px;
  font-weight:600;
  border-radius:8px;
  cursor:pointer;
  min-width:150px;
  text-align:center;
  box-shadow:0 1px 1px rgba(0,0,0,.04);
}
.btn.primary{ background:var(--brand); border-color:var(--brand); color:#fff; }
.btn:active{ transform:translateY(1px) }

/* Toolbar row (primary left, downloads right) */
.toolbar{ display:flex; gap:10px; align-items:center; margin:12px 0 18px; }
.toolbar .spacer{ flex:1 1 auto; }

/* Word/tag pills (for Word Search etc.) */
.words{ display:flex; gap:10px; flex-wrap:wrap; margin-top:6px; }
.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px; background:#f3f6ff; border:1px solid #e2e8ff;
  border-radius:999px; font-weight:700; font-size:13px; color:#1b2a4a;
}
.pill .x{
  width:18px; height:18px; display:grid; place-items:center;
  border:1px solid #cfd7e6; background:#fff; color:#6b7280; border-radius:50%;
  cursor:pointer; font-size:12px; line-height:1;
}

/* Keep label + input on one line, but only for this widget */
.wordsearch-widget .add-word-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}
.wordsearch-widget .add-word-row label {
  margin: 0;            /* avoid label dropping above */
  white-space: nowrap;  /* keep "Add Word:" from wrapping */
}
.wordsearch-widget .add-word-row [data-role="wordInput"] {
  flex: 1;              /* let input take remaining width */
  min-width: 240px;
}

/* NEW: frame that should wrap canvas + legend */
.activity-frame{
  background:#fff;
  border:1px solid var(--border);
  border-radius:6px;
  padding:14px;
}

/* was providing the thin grey border; now it just adds spacing */
.canvas-frame{
  background:#fff;
  border-radius:6px;
  /* REMOVE the border from here */
  /* border:1px solid var(--border);  <-- delete */
  padding:0;              /* keep canvas snug; padding now comes from .activity-frame */
}
canvas{ display:block; max-width:100%; height:auto; margin:0 auto; background:#fff; border-radius:6px; }

/* ---- Unified legend (I-Spy style) ---- */
.legend-band{ border-top:3px solid #111; padding-top:14px; width:680px; max-width:100%; margin:0 auto; }
.legend-title{ font-weight:600; margin-bottom:12px; text-align:left; }
.legend-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap:24px; justify-items:center; align-items:center; width:100%;
}
.legend-item{ display:flex; align-items:center; gap:12px; }
.legend-item img{ width:40px; height:40px; object-fit:contain; filter:contrast(0) brightness(0); }
.legend-item .count{ font-size:22px; font-weight:700; }
.legend-item input[type="text"]{ width:64px; height:44px; font-size:22px; text-align:center; border:2px solid #111; border-radius:8px; }
.legend-word{ font-size:22px; font-weight:700; letter-spacing:.5px; }

/* Utility */
.hide{ display:none !important; }

#board { display:block; background:#fff; border:3px solid #111; }

