/* ==========================================================================
   Free AI Toolkit: ehyong.com/free-ai-tools/
   Built on the site's tokens from style.css. Every selector is prefixed .tk-
   so nothing here can leak into other pages.
   ========================================================================== */

.tk { --tk-gap: clamp(16px, 2.2vw, 28px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Safari and older iOS need the prefixed value for sticky and for form resets.
   Everything below degrades to a normal scrolling column if sticky is absent. */
.tk button, .tk-mini, .tk-chip, .tk-cats button, .tk-btn { touch-action: manipulation; -webkit-tap-highlight-color: rgba(214,174,103,.25); }
.tk img, .tk-pre { max-width: 100%; }
.tk section[id] { scroll-margin-top: calc(var(--header-h, 80px) + 12px); }

.tk-eyebrow { color: var(--gold); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 12px; font-weight: 700; }
.tk-hero h1 { margin: 0 0 14px; max-width: 18ch; }
.tk-lede { margin: 0; max-width: 60ch; color: var(--text-dim); font-size: clamp(15px, 1.7vw, 18px); line-height: 1.6; }
.tk-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 22px 0 0; padding: 0; list-style: none; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.tk-meta b { color: var(--gold); font-weight: 600; }
.tk-muted { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 8px 0 0; }
.tk-h2 { margin: 0 0 10px; }
.tk-sub { margin: 0 0 26px; color: var(--text-dim); max-width: 62ch; line-height: 1.6; }

/* ------------------------------------------------------------ jump cards */
.tk-jump { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 34px; }
.tk-jump a { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-lift); color: var(--text); text-decoration: none; min-height: 44px; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.tk-jump a:hover, .tk-jump a:focus-visible { border-color: var(--gold); background: #101010; transform: translateY(-2px); }
.tk-jump b { font-size: 16px; }
.tk-jump span { color: var(--text-dim); font-size: 13.5px; line-height: 1.45; }
.tk-jump em { font-style: normal; color: var(--gold); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }

/* ------------------------------------------------------------ panel */
.tk-panel { border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--bg-lift); padding: clamp(18px, 3vw, 32px); }
.tk-step { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; font-size: 17px; font-weight: 800; }
.tk-step i { font-style: normal; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--gold); color: #120e06; font-size: 13px; flex-shrink: 0; }

/* ------------------------------------------------------------ tasks */
.tk-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tk-task { position: relative; display: grid; gap: 3px; text-align: left; padding: 14px 14px 13px 46px; min-height: 64px; border-radius: var(--r-sm); border: 1px solid var(--line-soft); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; transition: border-color .15s ease, background .15s ease; }
.tk-task:hover { border-color: var(--line); background: #151515; }
.tk-task:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.tk-task.is-on { border-color: var(--gold); background: linear-gradient(135deg, rgba(240,215,161,.14), rgba(214,174,103,.06)); }
.tk-task-n { position: absolute; left: 14px; top: 15px; font-size: 11.5px; font-weight: 800; color: var(--gold); letter-spacing: .04em; }
.tk-task-l { font-weight: 700; font-size: 15px; line-height: 1.3; }
.tk-task-h { color: var(--text-dim); font-size: 12.5px; line-height: 1.35; }

/* ------------------------------------------------------------ builder layout */
.tk-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--tk-gap); margin-top: 26px; align-items: start; }
.tk-out-col { position: -webkit-sticky; position: sticky; top: calc(var(--header-h, 80px) + 14px); }
@media (max-width: 1080px) { .tk-work { grid-template-columns: 1fr; } .tk-out-col { position: static; } }
@media (hover: none) { .tk-out-col { position: static; } }   /* no sticky panel on touch devices */

.tk-form-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tk-form-top h3 { margin: 0; font-size: 20px; }
.tk-form-tools { display: flex; gap: 8px; flex-wrap: wrap; }

.tk-field { margin: 0 0 14px; }
.tk-field label, .tk-legend { display: block; margin: 0 0 7px; font-weight: 650; font-size: 14.5px; color: var(--text); }
.tk-req { color: var(--gold); font-weight: 600; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; margin-left: 6px; }
.tk-field input, .tk-field textarea, .tk-field select, .tk-search {
  width: 100%; -webkit-appearance: none; border-radius: var(--r-sm); box-sizing: border-box; font: inherit; font-size: 16px; color: var(--text);
  background: #080808; border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-sm);
  padding: 12px 14px; min-height: 46px; transition: border-color .15s ease, box-shadow .15s ease;
}
.tk-field textarea { resize: vertical; line-height: 1.5; min-height: 110px; }
.tk-field select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.tk-field select option { background: #111; color: var(--text); }
.tk-field input::placeholder, .tk-field textarea::placeholder, .tk-search::placeholder { color: rgba(248,244,238,.38); }
.tk-field input:focus, .tk-field textarea:focus, .tk-field select:focus, .tk-search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214,174,103,.2); }

.tk-more { margin: 6px 0 0; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.tk-more > summary { cursor: pointer; list-style: none; font-weight: 700; color: var(--gold-soft); min-height: 44px; display: flex; align-items: center; gap: 8px; }
.tk-more > summary::-webkit-details-marker { display: none; }
.tk-more > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); font-weight: 800; }
.tk-more[open] > summary::before { content: "−"; }
.tk-more-body { padding-top: 8px; }
.tk-group { margin: 0 0 14px; border: 0; padding: 0; }

.tk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-chip-in { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tk-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); color: var(--text-muted); font-size: 14px; cursor: pointer; transition: all .15s ease; user-select: none; }
.tk-chip:hover { border-color: var(--line); color: var(--text); }
.tk-chip-in:checked + .tk-chip { background: linear-gradient(135deg, #f0d7a1, #d6ae67); color: #120e06; border-color: transparent; font-weight: 700; }
.tk-chip-in:focus-visible + .tk-chip { outline: 2px solid var(--gold-soft); outline-offset: 2px; }

.tk-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; color: var(--text-muted); cursor: pointer; min-height: 44px; padding-top: 10px; }
.tk-check input { -webkit-appearance: checkbox; appearance: checkbox; width: 20px; height: 20px; accent-color: var(--gold); margin: 0; flex-shrink: 0; }

/* ------------------------------------------------------------ buttons */
.tk-btn, .tk-mini, .tk-linkbtn { font: inherit; cursor: pointer; }
.tk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 700; font-size: 14.5px; text-decoration: none; transition: all .15s ease; }
.tk-btn:hover { border-color: var(--gold); color: var(--gold-soft); }
.tk-btn--gold { background: linear-gradient(135deg, #f0d7a1, #d6ae67); color: #120e06; border-color: transparent; }
.tk-btn--gold:hover { color: #120e06; filter: brightness(1.06); }
.tk-btn:disabled { opacity: .4; cursor: not-allowed; }
.tk-btn.is-done { background: #2a4a2f; color: #dff5e2; border-color: transparent; }
.tk-btn--sm { min-height: 40px; padding: 0 14px; font-size: 13.5px; }
.tk-mini { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(214,174,103,.08); color: var(--gold-soft); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.tk-mini:hover { background: rgba(214,174,103,.18); }
.tk-mini.is-done { background: #2a4a2f; color: #dff5e2; border-color: transparent; }
.tk-linkbtn { background: none; border: 0; color: var(--gold-soft); text-decoration: underline; text-underline-offset: 3px; padding: 10px 4px; font-weight: 600; }

/* ------------------------------------------------------------ output */
.tk-meter { margin-bottom: 14px; }
.tk-meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .1em; }
.tk-meter-top b { color: var(--gold-soft); }
.tk-meter-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.tk-meter-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d6ae67, #f0d7a1); border-radius: 99px; transition: width .35s ease; }
.tk-frame { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 10px 0 0; padding: 0; }
.tk-frame li { font-size: 12px; padding: 4px 9px; border-radius: 99px; border: 1px dashed rgba(255,255,255,.2); color: rgba(248,244,238,.5); }
.tk-frame li.is-on { border: 1px solid var(--line); color: var(--gold-soft); background: rgba(214,174,103,.08); }
.tk-frame li.is-on::before { content: "✓ "; }
.tk-meter-tip { margin: 10px 0 0; font-size: 14px; color: var(--text); }

.tk-output { min-height: 200px; }
.tk-pre { margin: 0; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; -webkit-overflow-scrolling: touch; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.6; color: #eee7dc; background: #070707; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 16px; max-height: 520px; overflow: auto; }
.tk-empty { display: grid; place-items: center; text-align: center; min-height: 200px; border: 1px dashed rgba(255,255,255,.16); border-radius: var(--r-sm); color: var(--text-dim); padding: 20px; line-height: 1.6; }
.tk-part { margin-top: 14px; }
.tk-part:first-child { margin-top: 0; }
.tk-part-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-weight: 700; font-size: 14px; color: var(--gold-soft); }

.tk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.tk-actions .tk-btn--gold { grid-column: 1 / -1; }
.tk-actions-note { font-size: 12.5px; color: var(--text-dim); margin: 8px 0 0; }

.tk-follow { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.tk-follow li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: #0d0d0d; border: 1px solid var(--line-soft); font-size: 14px; line-height: 1.45; }
.tk-follow-h { margin: 22px 0 0; font-size: 15px; }

/* ------------------------------------------------------------ fixer */
.tk-fix { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--tk-gap); align-items: start; }
@media (max-width: 900px) { .tk-fix { grid-template-columns: 1fr; } }
.tk-verdict { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tk-verdict b { font-size: 22px; color: var(--gold-soft); }
.tk-verdict span { color: var(--text-muted); font-weight: 700; }
.tk-checks { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
.tk-checks li { display: grid; gap: 2px; padding: 9px 12px; border-radius: var(--r-sm); font-size: 14px; }
.tk-checks li.is-ok { background: rgba(80,160,100,.10); color: #bfe3c7; }
.tk-checks li.is-miss { background: rgba(214,174,103,.08); border: 1px solid var(--line); }
.tk-checks li.is-miss b { color: var(--gold-soft); }
.tk-checks li span { color: var(--text-dim); font-size: 13.5px; }

/* ------------------------------------------------------------ library */
.tk-libbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.tk-search { flex: 1 1 260px; max-width: 420px; padding-left: 42px; background-image: radial-gradient(circle at 18px 21px, transparent 6px, var(--gold) 6.5px, var(--gold) 8px, transparent 8.5px); background-repeat: no-repeat; }
.tk-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-cats button { font: inherit; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; }
.tk-cats button[aria-pressed="true"] { background: var(--gold); color: #120e06; border-color: transparent; font-weight: 700; }
.tk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.tk-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--r-md); border: 1px solid var(--line-soft); background: var(--bg-lift); }
.tk-card[hidden] { display: none; }
.tk-card-cat { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.tk-card h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.tk-card h3 a { color: var(--text); text-decoration: none; }
.tk-card h3 a:hover { color: var(--gold-soft); }
.tk-card p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.tk-card-foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.tk-card .tk-pre { max-height: 150px; font-size: 12.5px; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 68%, rgba(0,0,0,.15) 100%);
  mask-image: linear-gradient(180deg, #000 68%, rgba(0,0,0,.15) 100%); }

/* ------------------------------------------------------------ habits + faq */
.tk-habits { counter-reset: h; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tk-habits li { counter-increment: h; padding: 20px; border-radius: var(--r-md); background: var(--bg-lift); border: 1px solid var(--line-soft); }
.tk-habits li::before { content: counter(h, decimal-leading-zero); display: block; color: var(--gold); font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.tk-habits b { display: block; font-size: 16px; margin-bottom: 6px; }
.tk-habits span { color: var(--text-dim); font-size: 14px; line-height: 1.55; }

.tk-faq details { border-bottom: 1px solid var(--line-soft); }
.tk-faq summary { cursor: pointer; padding: 16px 0; font-weight: 700; font-size: 16px; min-height: 44px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.tk-faq summary::-webkit-details-marker { display: none; }
.tk-faq summary::after { content: "+"; color: var(--gold); font-weight: 800; }
.tk-faq details[open] summary::after { content: "−"; }
.tk-faq p { margin: 0 0 16px; color: var(--text-dim); line-height: 1.65; max-width: 70ch; }

/* ------------------------------------------------------------ CTA */
.tk-cta { display: grid; grid-template-columns: minmax(0, 1.4fr) auto; gap: 20px; align-items: center; padding: clamp(22px, 4vw, 40px); border-radius: var(--r-lg); border: 1px solid var(--line); background: radial-gradient(120% 140% at 0% 0%, rgba(214,174,103,.14), transparent 60%), var(--bg-lift); }
.tk-cta h2 { margin: 0 0 8px; }
.tk-cta p { margin: 0; color: var(--text-dim); line-height: 1.6; }
.tk-cta-btns { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 800px) { .tk-cta { grid-template-columns: 1fr; } }
.tk-coffee { margin-top: 14px; font-size: 13.5px; color: var(--text-dim); }
.tk-coffee a { color: var(--gold-soft); }

/* ------------------------------------------------------------ article pages */
/* The site header is fixed, so the first line of a text page needs to clear it. */
.tk-doc-top { padding-top: calc(var(--header-h, 80px) + 26px); }
.tk-crumbs { font-size: 13px; color: var(--text-dim); margin: 0 0 18px; }
.tk-crumbs a { color: var(--gold-soft); text-decoration: none; }
.tk-crumbs a:hover { text-decoration: underline; }
.tk-article { max-width: 780px; }
.tk-answer { font-size: clamp(17px, 1.9vw, 20px); line-height: 1.6; color: var(--text); margin: 0 0 8px; padding: 18px 20px; border-left: 3px solid var(--gold); background: rgba(214,174,103,.06); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.tk-byline { font-size: 13px; color: var(--text-dim); margin: 14px 0 0; }
.tk-byline a { color: var(--gold-soft); }
.tk-article h2 { font-size: clamp(20px, 2.4vw, 26px); margin: 38px 0 12px; }
.tk-article h1 { line-height: 1.15; }
.tk-article p, .tk-article li { color: var(--text-muted); line-height: 1.7; font-size: 16px; }
.tk-box { padding: 18px 20px; border-radius: var(--r-md); background: var(--bg-lift); border: 1px solid var(--line-soft); }
.tk-box--warn { border-color: rgba(214,120,103,.35); background: rgba(214,120,103,.06); }
.tk-box h3 { margin: 0 0 8px; font-size: 15px; color: var(--gold-soft); }
.tk-box p { margin: 0; }
.tk-prompt-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 38px 0 12px; }
.tk-prompt-h h2 { margin: 0; }
.tk-related { list-style: none; padding: 0; display: grid; gap: 8px; }
.tk-related a { display: block; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-soft); color: var(--text); text-decoration: none; min-height: 44px; box-sizing: border-box; }
.tk-related a:hover { border-color: var(--gold); }

/* ------------------------------------------------------------ toast */
.tk-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #f0d7a1; color: #120e06; font-weight: 700; padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 200; max-width: calc(100vw - 32px); text-align: center; font-size: 14px; }
.tk-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .tk-tasks { grid-template-columns: 1fr 1fr; gap: 8px; }
  /* Phone tap targets: 44px minimum on anything that is not inline prose. */
  .tk-mini { min-height: 44px; }
  .tk-crumbs { line-height: 2.4; }
  .tk-crumbs a { display: inline-block; padding: 10px 2px; }
  .tk-card h3 a { display: block; padding: 6px 0; }
  .tk-related a { padding: 14px; }
  .tk-task { padding: 12px 10px 11px; min-height: 76px; }
  .tk-task-n { position: static; }
  .tk-task-l { font-size: 14px; }
  .tk-task-h { display: none; }
  .tk-actions { grid-template-columns: 1fr; }
  .tk-follow li { flex-direction: column; align-items: stretch; }
  .tk-meta { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) { .tk *, .tk-toast { transition: none !important; } }


/* ------------------------------------------------- tablet and touch tuning */
@media (min-width: 601px) and (max-width: 1080px) {
  .tk-tasks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tk-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tk-actions .tk-btn--gold { grid-column: 1 / -1; }
}
/* Landscape phones: keep the task grid usable without a tall scroll. */
@media (max-width: 900px) and (orientation: landscape) {
  .tk-tasks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tk-pre { max-height: 300px; }
}
/* Windows high-contrast and forced-colours mode: keep the state visible. */
@media (forced-colors: active) {
  .tk-task.is-on, .tk-chip-in:checked + .tk-chip, .tk-cats button[aria-pressed="true"] { border: 2px solid ButtonText; }
  .tk-meter-bar i { background: ButtonText; }
}
