:root { --kmt-green:#315b43; --kmt-cream:#faf8f3; --kmt-ink:#243127; --kmt-line:#d7cfc3; }
.kmt-gate { position:fixed; inset:0; z-index:9999; background:rgba(36,49,39,.55); display:flex; align-items:flex-end; justify-content:center; padding:16px; }
.kmt-gate-card { background:var(--kmt-cream); color:var(--kmt-ink); width:min(560px,100%); max-height:min(92vh,840px); overflow:auto; border-radius:18px; padding:22px 22px 18px; box-shadow:0 16px 40px rgba(0,0,0,.2); font-family:Georgia,"Times New Roman",serif; }
.kmt-gate-card h2 { font-size:1.7rem; line-height:1.2; margin:0 0 10px; }
.kmt-gate-card p, .kmt-gate-card li, .kmt-page p, .kmt-page li { font-size:1.12rem; line-height:1.45; }
.kmt-gate-card label { display:flex; gap:10px; align-items:flex-start; margin:12px 0; font-size:1.05rem; }
.kmt-gate-card input[type=checkbox] { width:22px; height:22px; margin-top:2px; flex:0 0 auto; }
.kmt-gate-card a, .kmt-page a { color:var(--kmt-green); }
.kmt-btn { display:inline-block; background:var(--kmt-green); color:#fff; border:0; border-radius:12px; padding:14px 18px; font-size:1.1rem; font-weight:700; cursor:pointer; text-decoration:none; text-align:center; }
.kmt-btn[disabled] { opacity:.45; cursor:not-allowed; }
.kmt-btn.secondary { background:#fff; color:var(--kmt-green); border:2px solid var(--kmt-green); }
.kmt-page { background:var(--kmt-cream); color:var(--kmt-ink); min-height:100vh; margin:0; font-family:Georgia,"Times New Roman",serif; }
.kmt-wrap { max-width:740px; margin:0 auto; padding:24px 18px 64px; }
.kmt-page header { display:flex; justify-content:space-between; gap:12px; align-items:center; padding-bottom:16px; border-bottom:1px solid var(--kmt-line); margin-bottom:24px; }
.kmt-page h1 { font-size:2rem; line-height:1.2; margin:0 0 12px; }
.kmt-page h2 { font-size:1.4rem; margin:28px 0 8px; }
.kmt-page .brand { color:var(--kmt-green); font-weight:700; text-decoration:none; font-size:1.15rem; }
.kmt-toc { display:flex; flex-wrap:wrap; gap:8px 14px; margin:16px 0 28px; }
.kmt-toc a { font-size:1rem; }
.kmt-note { background:#fff; border:1px solid var(--kmt-line); border-radius:12px; padding:14px 16px; }
.kmt-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
.kmt-chapter { background:#fff; border:1px solid var(--kmt-line); border-radius:14px; padding:14px; margin:12px 0; }
.kmt-chapter audio { width:100%; margin-top:8px; }
.kmt-muted { color:#5c675f; }
@media (min-width:700px){ .kmt-gate { align-items:center; } }

/* Readable, high-contrast extras for every age */
body, .kmt-page, .app-shell { -webkit-text-size-adjust: 100%; }
.kmt-page, .kmt-gate-card { font-size: 1.15rem; line-height: 1.5; }
.kmt-page h1 { font-size: 2.05rem; }
button, .kmt-btn, a.primary, a.secondary, .primary, .secondary {
  min-height: 48px;
}
.kmt-btn, .kmt-gate-card label { line-height: 1.4; }

/* Mae helper */
#mae-root { position: relative; z-index: 9998; font-family: Georgia, "Times New Roman", serif; }
#mae-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 9998;
  width: 64px; height: 64px; border-radius: 50%;
  background: #315b43; color: #faf8f3; border: 3px solid #faf8f3;
  box-shadow: 0 8px 24px rgba(36,49,39,.35);
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#mae-toggle:focus-visible { outline: 3px solid #1d3a28; outline-offset: 3px; }
#mae-panel {
  position: fixed; right: 16px; bottom: 92px; z-index: 9998;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  background: #faf8f3; color: #1d241f;
  border: 2px solid #315b43; border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
#mae-panel[hidden] { display: none !important; }
#mae-header { background: #315b43; color: #faf8f3; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#mae-header h2 { margin: 0; font-size: 1.2rem; }
#mae-close, #mae-send {
  min-height: 44px; min-width: 44px; border: 0; border-radius: 10px;
  background: #faf8f3; color: #315b43; font-weight: 700; cursor: pointer; font-size: 1rem;
}
#mae-log { overflow: auto; padding: 12px; flex: 1; background: #fff; }
.mae-msg { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; font-size: 1.05rem; line-height: 1.45; }
.mae-msg.mae-bot { background: #e8f0ea; color: #1d241f; }
.mae-msg.mae-user { background: #315b43; color: #faf8f3; margin-left: 24px; }
.mae-msg a { color: inherit; text-decoration: underline; font-weight: 700; }
.mae-choices { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; background: #fff; }
.mae-choices button {
  background: #fff; color: #1d3a28; border: 2px solid #315b43;
  border-radius: 999px; padding: 8px 12px; font-size: 1rem; font-weight: 700;
  cursor: pointer; min-height: 44px;
}
.mae-choices button:focus-visible, #mae-close:focus-visible, #mae-send:focus-visible { outline: 3px solid #1d3a28; outline-offset: 2px; }
#mae-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid #d7cfc3; background: #faf8f3; }
#mae-input {
  flex: 1; min-height: 48px; font-size: 1.05rem; border: 2px solid #315b43;
  border-radius: 10px; padding: 8px 10px; font-family: inherit; color: #1d241f; background: #fff;
}
@media (max-width: 520px) {
  #mae-panel { right: 8px; left: 8px; width: auto; bottom: 88px; }
  #mae-toggle { right: 12px; bottom: 12px; }
}
