/* Underhill Adventures – clean tool pages (teacher.html, story-builder.html). Builds on style.css. */
.tool-main section:not(.panel) { padding: 0; }
.tool-body { background-image: none; background-color: #F7F4EC; }
.tool-header { background: rgba(255, 253, 247, .92); border-bottom: 1px solid rgba(36, 80, 58, .12); position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.tool-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.tool-header .brand img { height: 40px; width: auto; }
.tool-header nav { display: flex; gap: 6px; flex-wrap: wrap; }
.tool-header nav a { text-decoration: none; font-weight: 700; color: var(--forest); padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.tool-header nav a:hover, .tool-header nav a[aria-current="page"] { background: #EAF1EA; }
.tool-main { width: min(1120px, 100% - 32px); margin: 0 auto; padding: 36px 0 64px; }
.tool-main:focus { outline: none; }
.tool-title { font-size: clamp(2rem, 4.2vw, 2.9rem); letter-spacing: -.01em; margin-bottom: .25em; }
.tool-lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; margin-bottom: 28px; }
.panel { background: #fff; border-radius: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 28px rgba(36,80,58,.07); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 1.35rem; margin-bottom: .35em; }
.panel p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
/* Switch */
.switch-row { display: flex; align-items: flex-start; gap: 18px; justify-content: space-between; }
.switch-row .txt { max-width: 66ch; }
.switch { flex: none; position: relative; width: 64px; height: 38px; border-radius: 999px; border: 2px solid var(--forest); background: #EDEBE3; cursor: pointer; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .18s; }
.switch[aria-checked="true"] { background: var(--forest); }
.switch[aria-checked="true"]::after { left: 29px; }
.switch .st { position: absolute; font-size: .7rem; font-weight: 800; top: 9px; }
.switch .st-on { left: 9px; color: #fff; } .switch .st-off { right: 7px; color: var(--forest-deep); }
.switch[aria-checked="true"] .st-off, .switch[aria-checked="false"] .st-on { display: none; }
.state-line { font-weight: 800; margin-top: 8px; }
.state-line.on { color: var(--forest); } .state-line.off { color: var(--muted); }
/* Buttons in tools */
.tbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; font: 700 1rem var(--font-body); border: 2px solid var(--forest); background: #fff; color: var(--forest); cursor: pointer; text-decoration: none; }
.tbtn:hover { background: #EAF1EA; }
.tbtn.primary { background: var(--forest); color: #fff; }
.tbtn.primary:hover { background: var(--forest-deep); }
.tbtn.danger { border-color: #8E2F1E; color: #8E2F1E; }
.tbtn.danger:hover { background: #FBEAE6; }
.tbtn[disabled] { opacity: .5; cursor: not-allowed; }
/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 0 0 20px; }
.stat { background: #fff; border-radius: 18px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(36,80,58,.06); }
.stat dt { font-size: .92rem; color: var(--muted); font-weight: 700; }
.stat dd { margin: 4px 0 0; font: 600 1.6rem var(--font-display); color: var(--forest); }
/* Table */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid #E6E1D3; background: #fff; }
.table-wrap:focus-visible { outline: 3px solid var(--forest); }
table.results { border-collapse: collapse; width: 100%; min-width: 880px; font-size: .97rem; }
table.results caption { text-align: left; padding: 14px 16px; font-weight: 800; color: var(--forest); }
table.results th, table.results td { padding: 10px 12px; text-align: left; border-top: 1px solid #EEE9DC; vertical-align: top; }
table.results thead th { background: #F6F3EA; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: #4A473C; border-top: 0; }
table.results th[scope="row"] { font-weight: 800; color: var(--ink); }
.skill-cell { white-space: nowrap; }
.stars3 { color: #8F5A0E; letter-spacing: 1px; font-size: 1.05rem; }
.stars3 .off { color: #C9C2AE; }
.na { color: #77735F; }
.example-banner { display: flex; gap: 12px; align-items: center; background: #FFF4D6; border: 2px dashed #8F5A0E; color: #5E3B07; border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; font-weight: 700; }
.badge-example { display: inline-block; background: #8F5A0E; color: #fff; border-radius: 6px; padding: 1px 7px; font-size: .75rem; font-weight: 800; letter-spacing: .05em; margin-left: 6px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
/* Dialog */
dialog.confirm { border: 0; border-radius: 20px; padding: 24px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog.confirm::backdrop { background: rgba(24, 56, 41, .45); }
dialog.confirm h2 { font-size: 1.3rem; }
/* Forms */
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 800; margin-bottom: 6px; color: var(--forest-deep); }
.field textarea, .field input[type=text] { width: 100%; font: 1.1rem/1.5 var(--font-body); padding: 14px 16px; border-radius: 14px; border: 2px solid #CFC8B3; background: #fff; color: var(--ink); }
.field textarea { min-height: 110px; resize: vertical; }
.field textarea:focus, .field input:focus { border-color: var(--forest); outline: 3px solid var(--forest); outline-offset: 2px; }
.counter { font-size: .9rem; color: var(--muted); text-align: right; margin-top: 4px; }
.seg { display: flex; gap: 10px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.seg legend { font-weight: 800; margin-bottom: 8px; color: var(--forest-deep); padding: 0; }
.seg label { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 18px 8px 10px; border-radius: 14px; border: 2px solid #CFC8B3; background: #fff; cursor: pointer; font-weight: 700; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { border-color: var(--forest); background: #EAF1EA; box-shadow: inset 0 0 0 1px var(--forest); }
.seg label:has(input:checked)::after { content: "✓"; color: var(--forest); font-weight: 900; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--forest); outline-offset: 3px; box-shadow: 0 0 0 6px #FBE7B6; }
.seg img { width: 40px; height: 40px; object-fit: contain; }
.demo-badge { display: inline-flex; align-items: center; gap: 8px; background: #FFF4D6; color: #5E3B07; border: 2px solid #8F5A0E; padding: 6px 14px; border-radius: 999px; font-weight: 800; margin-bottom: 16px; }
.live-badge { background: #EAF1EA; color: var(--forest-deep); border-color: var(--forest); }
.msg { border-radius: 14px; padding: 12px 16px; margin: 0 0 14px; font-weight: 700; }
.msg.warn { background: #FFF4D6; color: #5E3B07; }
.msg.ok { background: #EAF1EA; color: var(--forest-deep); }
.preview-card { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: center; }
.preview-card img { width: 180px; height: 110px; object-fit: cover; border-radius: 14px; }
@media (max-width: 640px) {
  .tool-main { padding-top: 22px; }
  .panel { padding: 18px; }
  .switch-row { flex-direction: column; }
  .preview-card { grid-template-columns: 1fr; }
  .preview-card img { width: 100%; height: 140px; }
}
@media print {
  .tool-header, .no-print, .example-banner .tbtn { display: none !important; }
  .tool-body { background: #fff; }
  .panel, .stat, .table-wrap { box-shadow: none; border: 1px solid #999; }
  table.results { min-width: 0; font-size: 10pt; }
  .tool-main { width: 100%; padding: 0; }
}

/* Teacher support settings */
.preset-row .tbtn[aria-pressed="true"] { background: var(--forest); color: #fff; }
.lock-row { display: inline-flex; gap: 10px; align-items: center; font-weight: 700; min-height: 44px; cursor: pointer; }
.lock-row input { width: 22px; height: 22px; accent-color: var(--forest); }
.sub-title { font-size: 1.15rem; margin: 24px 0 6px; }
.small { font-size: .9rem; margin: 4px 0 0; }
.kids { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.kids li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 12px; border: 1px solid #E6E1D3; border-radius: 14px; background: #fff; }
.kids li strong { font-size: 1.05rem; }
.kids .muted { font-size: .9rem; }
#kid-form .field input { max-width: 260px; }
/* Small screens: the header scrolls away with the page, so it never covers content or the focused control. */
@media (max-width: 700px) { .tool-header { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: #FFFDF7; } }
