/* Create By Asking: the working tools on the family pages (times tables game, word search maker,
   Christmas countdown, chore chart). Loaded after style.css and tools.css; reuses the dark .tool-shell look. */

.tool-shell textarea { background: rgba(255, 255, 255, 0.08); border: 1.5px solid transparent; color: #fff; border-radius: 10px; padding: 10px 12px; font: inherit; min-width: 0; resize: vertical; }
.tool-shell textarea:focus { outline: none; border-color: #FFC93C; }
.tool-shell label { display: grid; gap: 6px; font-size: var(--step--1); color: #CBBFE8; }
.f-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.f-row > span { font: 600 0.68rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #A597CC; margin-right: 4px; }
.f-print { display: none; }
.tool-shell [hidden] { display: none !important; }

/* ---------- times tables game ---------- */
.tt { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
.tt-stage { position: relative; display: grid; gap: 14px; justify-items: center; min-height: 430px; background: rgba(255, 255, 255, 0.03); border-radius: 14px; padding: 18px 14px; }
.tt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.tt-stats .score { padding: 8px 10px; text-align: center; }
.tt-stats .score strong { font-size: 1.6rem; }
.tt-time { width: 100%; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.tt-time span { display: block; height: 100%; width: 100%; background: #5BD48F; border-radius: 99px; }
.tt-time span.low { background: #FF7A62; }
.tt-q { font: 800 clamp(2.6rem, 9vw, 4rem)/1 var(--display); color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; text-align: center; padding: 6px 0; }
.tt-q b { display: inline-block; min-width: 1.6em; border-bottom: 4px solid #FFC93C; color: #FFC93C; }
.tt-q.right b { color: #5BD48F; border-color: #5BD48F; }
.tt-q.wrong b { color: #FF7A62; border-color: #FF7A62; }
.tt-fb { min-height: 1.4em; font-weight: 600; color: #CBBFE8; text-align: center; }
.tt-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 320px); }
.tt-pad button { border: 0; border-radius: 14px; min-height: 56px; background: rgba(255, 255, 255, 0.1); color: #fff; font: 800 1.5rem/1 var(--display); cursor: pointer; touch-action: manipulation; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25); }
.tt-pad button:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.tt-pad .ok { background: #5BD48F; color: #1C0F3F; }
.tt-pad .del { background: rgba(255, 255, 255, 0.05); font-size: 1.2rem; }
.tt-side { display: grid; gap: 16px; align-content: start; }
.tt-tables { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tt-tables .chip-dark { padding: 9px 0; text-align: center; font-variant-numeric: tabular-nums; }
.tt-stars { font-size: 2.4rem; letter-spacing: 6px; margin: 4px 0; }
.tt-stars i { font-style: normal; opacity: 0.25; filter: grayscale(1); }
.tt-stars i.on { opacity: 1; filter: none; }
.tt-miss { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tt-miss li { background: rgba(255, 122, 98, 0.18); color: #FFD3C9; border-radius: 8px; padding: 4px 8px; font: 600 0.85rem/1.2 var(--mono); }
.tt .game-overlay > div { max-width: 360px; }
.tt .game-overlay h3 { color: #FFC93C; }
.tt .game-overlay { background: rgba(15, 8, 39, 0.9); }
.tt .game-overlay .f-row { justify-content: center; }
.tt-pop { animation: tt-pop 0.35s ease; }
@keyframes tt-pop { 40% { transform: scale(1.12); } }
@media (max-width: 820px) { .tt { grid-template-columns: 1fr; } .tt-tables { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 420px) { .tt-tables { grid-template-columns: repeat(4, 1fr); } .tt-pad button { min-height: 52px; } }

/* ---------- word search maker ---------- */
.ws { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
.ws-board { display: grid; gap: 12px; }
.ws-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ws-head h3 { font-size: var(--step-2); }
.ws-head span { font: 600 0.8rem/1 var(--mono); color: #FFC93C; }
.ws-grid { --n: 12; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; background: rgba(255, 255, 255, 0.04); border-radius: 12px; padding: 8px; touch-action: none; user-select: none; -webkit-user-select: none; max-width: 560px; width: 100%; margin-inline: auto; }
.ws-cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 6px; font: 700 clamp(0.72rem, 2.6vw, 1.15rem)/1 var(--mono); color: #F2ECFF; cursor: pointer; }
.ws-grid[style*="--n:15"] .ws-cell, .ws-grid[style*="--n: 15"] .ws-cell { font-size: clamp(0.62rem, 2.2vw, 1rem); }
.ws-cell.sel { background: #FFC93C; color: #1C0F3F; }
.ws-cell.found { color: #1C0F3F; }
.ws-cell.ans { box-shadow: inset 0 0 0 2px #FF9ED2; }
.ws-words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font: 600 0.9rem/1.3 var(--mono); color: #fff; }
.ws-words li.done { color: #7E71A8; text-decoration: line-through; }
.ws-msg { min-height: 1.3em; text-align: center; color: #FFE08F; font-size: var(--step--1); }
.ws-side { display: grid; gap: 14px; align-content: start; }
.ws-side .btn { justify-content: center; }
.ws-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.ws-btns .btn { padding-inline: 8px; }
@media (max-width: 860px) { .ws { grid-template-columns: 1fr; } }

/* ---------- Christmas countdown ---------- */
.xmas { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, #2B1858 0%, var(--screen) 70%); }
.xmas > *:not(.xmas-snow):not(.xmas-pop) { position: relative; z-index: 1; }
.xmas-snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.xmas-top { display: grid; justify-items: center; gap: 14px; text-align: center; padding-top: 6px; }
.xmas-sleeps { font: 800 clamp(1.3rem, 4.4vw, 2rem)/1.15 var(--display); color: #fff; }
.xmas-sleeps b { color: #FFC93C; }
.xmas-clock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: min(100%, 560px); }
.xmas-clock .score { text-align: center; padding: 12px 6px; }
.xmas-clock .score strong { font-size: clamp(1.8rem, 7vw, 3rem); color: #FFC93C; }
.xmas-clock .score span { margin-top: 4px; }
.xmas-cal { display: grid; gap: 10px; }
.xmas-cal p { color: #CBBFE8; font-size: var(--step--1); }
.xmas-doors { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.xmas-door { position: relative; aspect-ratio: 1; border: 0; border-radius: 10px; cursor: pointer; font: 800 clamp(1rem, 3vw, 1.5rem)/1 var(--display); color: #fff; background: #B3243F; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), inset 0 -4px 0 rgba(0, 0, 0, 0.2); }
.xmas-door:nth-child(3n) { background: #1F7A4D; }
.xmas-door:nth-child(4n+1) { background: #6C3FC7; }
.xmas-door.today { box-shadow: inset 0 0 0 3px #FFC93C, 0 0 18px rgba(255, 201, 60, 0.5); }
.xmas-door.open { background: rgba(255, 255, 255, 0.08); color: #A597CC; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08); font-size: 1rem; }
.xmas-door.open::after { content: "✓"; position: absolute; top: 4px; right: 6px; font-size: 0.7rem; color: #5BD48F; }
.xmas-door.locked { cursor: default; }
.xmas-door.shake { animation: xmas-shake 0.45s; }
@keyframes xmas-shake { 20%, 60% { transform: translateX(-4px) rotate(-2deg); } 40%, 80% { transform: translateX(4px) rotate(2deg); } }
.xmas-pop { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(15, 8, 39, 0.8); padding: 16px; }
.xmas-pop[hidden] { display: none; }
.xmas-card { background: #FFF8E8; color: #1C0F3F; border-radius: 16px; padding: 22px 22px 18px; max-width: 380px; text-align: center; display: grid; gap: 10px; animation: xmas-flip 0.5s ease; }
.xmas-card .eyebrow { color: #B3243F; }
.xmas-card h3 { color: #1C0F3F; font-size: var(--step-2); }
.xmas-card p { font-size: var(--step-0); }
.xmas-card em { color: #1F7A4D; font-style: normal; font-weight: 700; }
.xmas-card .btn { justify-self: center; background: #1C0F3F; color: #fff; }
@keyframes xmas-flip { from { transform: perspective(600px) rotateY(-80deg); opacity: 0; } }
@media (max-width: 640px) { .xmas-doors { grid-template-columns: repeat(6, minmax(0, 1fr)); } .xmas-clock { gap: 6px; } }
@media (max-width: 380px) { .xmas-doors { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .xmas-card, .xmas-door.shake, .tt-pop { animation: none; } }

/* ---------- chore chart ---------- */
.ch-kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ch-kid { text-align: left; border: 0; border-radius: 12px; padding: 12px; background: rgba(255, 255, 255, 0.06); color: #fff; cursor: pointer; display: grid; gap: 6px; box-shadow: inset 0 0 0 2px transparent; font: inherit; }
.ch-kid[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 2px var(--kid); }
.ch-kid strong { font: 800 var(--step-1)/1.1 var(--display); display: flex; justify-content: space-between; gap: 8px; }
.ch-kid strong small { font: 600 0.8rem/1.4 var(--mono); color: #CBBFE8; }
.ch-kid em { font-style: normal; font-size: 0.78rem; color: #CBBFE8; }
.ch-kid .track span { background: var(--kid); }
.ch-kid.add { place-content: center; text-align: center; color: #CBBFE8; border: 1.5px dashed rgba(255, 255, 255, 0.2); background: none; font-weight: 600; }
.ch-table-wrap { overflow-x: auto; background: rgba(255, 255, 255, 0.03); border-radius: 12px; }
.ch-table { border-collapse: separate; border-spacing: 4px; width: 100%; }
.ch-table th { font: 600 0.7rem/1 var(--mono); color: #A597CC; padding: 6px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.ch-table th.is-today { color: #FFC93C; }
.ch-table td.ch-name { text-align: left; color: #fff; font-weight: 600; font-size: var(--step--1); padding: 0 6px; min-width: 130px; }
.ch-name span { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ch-cell { width: 100%; min-width: 38px; height: 42px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.08); cursor: pointer; font-size: 1.35rem; line-height: 1; touch-action: manipulation; }
.ch-cell:hover { background: rgba(255, 255, 255, 0.16); }
.ch-cell.on { background: rgba(255, 201, 60, 0.18); }
.ch-cell.on span { display: inline-block; animation: ch-pop 0.35s ease; }
td.is-today .ch-cell { box-shadow: inset 0 0 0 2px #FFC93C; }
@keyframes ch-pop { 0% { transform: scale(0.2); } 70% { transform: scale(1.25); } }
.ch-del { border: 0; background: none; color: #A597CC; cursor: pointer; font-size: 1rem; padding: 0 2px; }
.ch-del:hover { color: #FF7A62; }
.ch-settings { display: grid; grid-template-columns: 1.2fr 0.6fr 1.6fr auto; gap: 8px; align-items: end; }
.ch-settings label input { width: 100%; }
.ch-add { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-add input { flex: 1 1 200px; }
.ch-goal { display: flex; justify-content: space-between; gap: 10px; font-size: var(--step--1); color: #CBBFE8; flex-wrap: wrap; }
.ch-goal b { color: #fff; }
.ch-goal.won b { color: #5BD48F; }
.ch-confetti { position: absolute; pointer-events: none; font-size: 1.6rem; animation: ch-fall 1.4s ease-out forwards; z-index: 5; }
@keyframes ch-fall { to { transform: translate(var(--dx), 160px) rotate(var(--r)); opacity: 0; } }
#chore-tool { position: relative; }
@media (max-width: 640px) { .ch-settings { grid-template-columns: 1fr 1fr; } .ch-settings label:nth-child(3) { grid-column: 1 / -1; } .ch-table { table-layout: fixed; border-spacing: 3px; } .ch-table td.ch-name, .ch-table thead th:first-child { width: 30%; min-width: 0; padding: 0 2px; } .ch-table th { font-size: 0.6rem; letter-spacing: 0; } .ch-cell { min-width: 0; height: 38px; font-size: 1.05rem; } }

/* ---------- printing (word search and chore chart) ---------- */
@page chores { size: A4 landscape; margin: 12mm; }
@media print {
  body.f-printing > *:not(.f-print) { display: none !important; }
  body.f-printing { background: #fff; color: #000; }
  body.f-printing .f-print { display: block; font-family: "Figtree", Arial, sans-serif; color: #000; }
  .f-sheet { break-after: page; text-align: center; }
  .f-sheet:last-child { break-after: auto; }
  .f-sheet h1 { font: 800 24pt/1.1 "Bricolage Grotesque", Arial, sans-serif; margin: 0 0 4mm; }
  .f-sheet p { margin: 0 0 6mm; font-size: 11pt; }
  .f-wsgrid { border-collapse: collapse; margin: 0 auto 8mm; }
  .f-wsgrid td { width: var(--c); height: var(--c); text-align: center; font: 700 calc(var(--c) * 0.55)/1 "JetBrains Mono", "Courier New", monospace; border: 0.3mm solid #bbb; }
  .f-wsgrid td.a { background: #d6d6d6; font-weight: 900; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .f-wslist { columns: 3; list-style: none; padding: 0; margin: 0 auto; max-width: 160mm; text-align: left; font: 600 13pt/1.6 "Figtree", Arial, sans-serif; }
  .f-wslist li::before { content: "☐ "; }
  .f-chores { page: chores; }
  .f-chtable { border-collapse: collapse; width: 100%; margin-bottom: 6mm; }
  .f-chtable th, .f-chtable td { border: 0.4mm solid #444; padding: 2mm; font-size: 12pt; }
  .f-chtable td { height: 13mm; text-align: center; font-size: 16pt; }
  .f-chtable td:first-child { text-align: left; font-size: 12pt; width: 45mm; }
  .f-chgoal { text-align: left; font-size: 12pt; }
}
