/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; scroll-behavior: smooth; }
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f4f6f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Skip Link === */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #1e3a5f;
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 1000;
    text-decoration: none;
}
.skip-link:focus { top: 0; }

/* === Header === */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e0e4e8;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1e3a5f;
    font-weight: 700;
    font-size: 1.1rem;
}
.logo-highlight { color: #2c5f2d; }
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.main-nav a {
    text-decoration: none;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
}
.main-nav a:hover { color: #1e3a5f; text-decoration: underline; }

/* === Hero === */
.hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5f2d 100%);
    color: #fff;
    padding: 2.5rem 1rem;
    text-align: center;
}
.hero-content { max-width: 700px; margin: 0 auto; }
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero-subtitle { font-size: 1.1rem; margin-bottom: 0.5rem; opacity: 0.95; }
.hero-note { font-size: 0.85rem; opacity: 0.8; }

/* === Worksheet Layout === */
.worksheet {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.worksheet-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 800px) {
    .worksheet-layout { grid-template-columns: 1fr; }
}

/* === Question Cards === */
.question-card, .result-card, .letter-card {
    background: #fff;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.question-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}
.question-hint {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 0.25rem;
}
.form-select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1rem;
    background: #fff;
    appearance: auto;
}
.form-select:focus {
    outline: 2px solid #1e3a5f;
    outline-offset: 2px;
}
.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: #f7fafc;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s, border-color 0.15s;
}
.option-btn:hover { background: #edf2f7; border-color: #a0aec0; }
.option-btn.selected { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

/* === Result Card === */
.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.result-header h3 { font-size: 1.2rem; }
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge.likely { background: #c6f6d5; color: #22543d; }
.badge.possible { background: #fefcbf; color: #744210; }
.badge.unlikely { background: #fed7d7; color: #822727; }
.result-details { margin-bottom: 1rem; font-size: 0.95rem; }
.result-actions, .letter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* === Buttons === */
.btn {
    padding: 0.6rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: #1e3a5f; color: #fff; }
.btn-primary:hover { background: #162d4a; }
.btn-secondary { background: #edf2f7; color: #1a1a2e; border-color: #cbd5e0; }
.btn-secondary:hover { background: #e2e8f0; }

/* === Letter Editor === */
.letter-instructions { font-size: 0.85rem; color: #718096; margin-bottom: 0.75rem; }
.letter-text {
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 1.25rem;
    min-height: 300px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    background: #fafbfc;
    white-space: pre-wrap;
    margin-bottom: 1rem;
}
.letter-text:focus { outline: 2px solid #1e3a5f; outline-offset: 2px; }

/* === Sidebar === */
.sidebar-card {
    background: #fff;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.sidebar-card h3 { font-size: 1rem; margin-bottom: 0.75rem; color: #1e3a5f; }
.ref-list { list-style: none; padding: 0; }
.ref-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}
.ref-list li:last-child { border-bottom: none; }
.tip-card { background: #fffbeb; border-color: #fbd38d; }

/* === Supporting Content === */
.supporting-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.supporting-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #1e3a5f;
}
.support-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (max-width: 700px) {
    .support-grid { grid-template-columns: 1fr; }
}
.support-block h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #2c5f2d; }
.support-block p, .support-block li { margin-bottom: 0.5rem; font-size: 0.95rem; }
.support-block ul { padding-left: 1.25rem; }

.scenario-walkthrough {
    background: #fff;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.scenario-walkthrough h3 { margin-bottom: 0.75rem; color: #1e3a5f; }

.faq-block { margin-bottom: 2rem; }
.faq-block h3 { margin-bottom: 1rem; color: #1e3a5f; }
.faq-item {
    border-bottom: 1px solid #e0e4e8;
    padding: 0.75rem 0;
}
.faq-item summary {
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}
.faq-item p { margin-top: 0.5rem; font-size: 0.9rem; color: #4a5568; }

/* === Ecosystem Note === */
.ecosystem-note {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1.5rem 1rem;
    background: #edf2f7;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}
.ecosystem-note a { color: #1e3a5f; font-weight: 500; }

/* === Footer === */
.site-footer {
    background: #1a1a2e;
    color: #cbd5e0;
    padding: 1.5rem 1rem;
    margin-top: auto;
    text-align: center;
    font-size: 0.85rem;
}
.footer-inner { max-width: 700px; margin: 0 auto; }
.footer-links { margin-top: 0.5rem; }
.footer-links a { color: #fff; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-version { margin-top: 0.5rem; font-size: 0.75rem; opacity: 0.7; }

/* === Utility === */
.hidden { display: none !important; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* === Responsive fine-tuning === */
@media (max-width: 500px) {
    .hero h1 { font-size: 1.5rem; }
    .hero-subtitle { font-size: 1rem; }
    .question-card, .result-card, .letter-card { padding: 1rem; }
    .btn { padding: 0.5rem 1rem; font-size: 0.9rem; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
