/* StoryForge Tools 2.0.5 — theme-aware platform skin */
.sft2 {
  --sft2-ink: var(--sc-ink, #172033);
  --sft2-muted: var(--sc-muted, #64748b);
  --sft2-paper: var(--sc-paper, #ffffff);
  --sft2-surface: var(--sc-surface, #f5f6f8);
  --sft2-surface-2: var(--sc-surface-2, #eef2f7);
  --sft2-border: var(--sc-border, #e2e8f0);
  --sft2-brand: var(--sc-brand, #6d28d9);
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px 70px;
  color: var(--sft2-ink) !important;
}
.sft2 * { box-sizing: border-box; }
.sft2 a { color: inherit; }

.sft2-hero {
  padding: 48px;
  border: 1px solid var(--sft2-border);
  border-radius: 28px;
  background: var(--sft2-surface);
  color: var(--sft2-ink);
  margin-bottom: 30px;
}
.sft2-hero h1,
.sft2-tool-head h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
  margin: .25em 0;
  color: var(--sft2-ink) !important;
  -webkit-text-fill-color: var(--sft2-ink) !important;
  opacity: 1 !important;
  text-shadow: none !important;
}
.sft2-tool-head p,
.sft2-hero p { color: var(--sft2-muted) !important; }
.sft2-kicker {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--sft2-brand);
}

.sft2-breadcrumb {
  font-size: 14px;
  margin-bottom: 20px;
  color: var(--sft2-muted) !important;
}
.sft2-breadcrumb a {
  color: var(--sft2-brand) !important;
  text-decoration-color: color-mix(in srgb, var(--sft2-brand) 45%, transparent);
}
.sft2-breadcrumb a:hover { color: var(--sft2-ink) !important; }

.sft2-search { display: flex; gap: 10px; align-items: center; margin-top: 24px; }
.sft2-search input {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--sft2-border);
  border-radius: 14px;
  font-size: 17px;
  background: var(--sft2-paper) !important;
  color: var(--sft2-ink) !important;
}
.sft2-search input::placeholder { color: var(--sft2-muted); opacity: .9; }
.sft2-search kbd { white-space: nowrap; }

.sft2-grid,
.sft2-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 22px 0 42px;
}
.sft2-category,
.sft2-card {
  position: relative;
  background: var(--sft2-paper) !important;
  border: 1px solid var(--sft2-border);
  border-radius: 20px;
  padding: 24px;
  text-decoration: none;
  color: var(--sft2-ink) !important;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .06);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.sft2-category:hover,
.sft2-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--sft2-brand) 40%, var(--sft2-border));
  box-shadow: 0 14px 36px rgba(15, 23, 42, .11);
}
.sft2-category > span,
.sft2-card-icon,
.sft2-icon { font-size: 34px; }
.sft2-card > a { color: var(--sft2-ink) !important; text-decoration: none; }
.sft2-card h3 { margin: 12px 36px 8px 0; color: var(--sft2-ink) !important; }
.sft2-card p,
.sft2-category p { color: var(--sft2-muted) !important; min-height: 52px; }

.sft2-fav {
  position: absolute;
  right: 14px;
  top: 14px;
  border: 1px solid var(--sft2-border);
  background: var(--sft2-surface-2) !important;
  color: var(--sft2-ink) !important;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 20px;
  z-index: 2;
}
.sft2-fav.is-fav { color: #b45309 !important; background: #fef3c7 !important; }
.sft2-fav-large { position: static; width: auto; height: auto; padding: 12px 16px; font-size: 15px; }

.sft2-tool-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 30px 0;
  color: var(--sft2-ink) !important;
}
.sft2-engine { margin: 10px 0 35px; }
.sft2-content {
  font-size: 17px;
  line-height: 1.75;
  color: var(--sft2-ink) !important;
  background: var(--sft2-paper) !important;
  border: 1px solid var(--sft2-border);
  border-radius: 22px;
  padding: clamp(22px, 4vw, 48px);
  margin: 34px 0;
}
.sft2-content h2,
.sft2-content h3,
.sft2-content strong { color: var(--sft2-ink) !important; }
.sft2-content p,
.sft2-content li { color: var(--sft2-ink); }
.sft2-content h2 { margin-top: 1.7em; }
.sft2-content details { border-bottom: 1px solid var(--sft2-border); padding: 14px 0; }
.sft2-content summary { font-weight: 700; cursor: pointer; color: var(--sft2-ink) !important; }

/* Explicit fallback for dark themes that do not expose StoryConfessions tokens. */
html[data-theme="dark"] .sft2,
body.dark-mode .sft2,
body.theme-dark .sft2 {
  --sft2-ink: var(--sc-ink, #f3f4f6);
  --sft2-muted: var(--sc-muted, #a9b0bf);
  --sft2-paper: var(--sc-paper, #101116);
  --sft2-surface: var(--sc-surface, #181a21);
  --sft2-surface-2: var(--sc-surface-2, #22252e);
  --sft2-border: var(--sc-border, #2d313c);
  color-scheme: dark;
}

@media (max-width: 700px) {
  .sft2-hero { padding: 28px 20px; }
  .sft2-tool-head { display: block; }
  .sft2-fav-large { margin-top: 12px; }
}

/* 2.0.5 layout hardening: StoryForge may be embedded inside an editorial
 * theme container, so keep application text horizontal and controls intact. */
.sft2 {
  width: min(100%, 1180px);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-wrap: break-word;
  word-break: normal;
}
.sft2 :where(h1,h2,h3,h4,h5,h6,p,a,button,label,summary) {
  word-break: normal !important;
  overflow-wrap: break-word !important;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}
.sft2-tool-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.sft2-tool-head h1 {
  max-width: 18ch;
}
.sft2-fav-large {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: max-content;
}
.sft2-engine,
.sft2-engine .stw-ultimate-wrap,
.sft2-engine .stw-tool-page {
  width: 100%;
  max-width: none;
  min-width: 0;
}
@media (max-width: 700px) {
  .sft2-tool-head h1 { max-width: none; }
  .sft2-fav-large { min-width: 0; }
}
