:root {
    --bg-color: #faf9f6;
    --text-color: #2c2925;
    --primary: #5c4233;
    --primary-hover: #463023;
    --secondary: #8b7355;
    --border-color: #d1c7b7;
    --input-bg: #ffffff;
    
    --font-heading: 'Georgia', serif;
    --font-body: 'Helvetica Neue', Arial, sans-serif;
    --font-handout: 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }

h1, h2, h3 { font-family: var(--font-heading); margin-bottom: 0.5rem; }

/* Header */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
}
.site-header h1 { color: var(--primary); margin: 0; }
.tagline { color: var(--secondary); font-style: italic; }
.site-header nav a { margin-left: 1rem; color: var(--text-color); text-decoration: none; }

/* Hero */
.hero {
    margin-bottom: 2rem;
    text-align: center;
}
.hero p { max-width: 700px; margin: 0 auto; color: #555; }

/* Workspace */
.generator-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .generator-workspace { grid-template-columns: 1fr; }
}

/* Form Controls */
.form-group {
    margin-bottom: 1.5rem;
}
label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary);
}
input[type="text"], select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: var(--font-body);
    background-color: var(--input-bg);
}
.hint {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-family: var(--font-body);
    transition: background 0.2s;
}
.btn.primary {
    background-color: var(--primary);
    color: #fff;
}
.btn.primary:hover { background-color: var(--primary-hover); }
.btn.secondary {
    background-color: #eee;
    color: #333;
    border: 1px solid #ccc;
}
.btn.secondary:hover { background-color: #ddd; }
.btn.small { padding: 0.4rem 1rem; font-size: 0.9rem; }
.btn.outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn.outline:hover { background: var(--primary); color: #fff; }

.action-buttons { display: flex; gap: 1rem; margin-top: 2rem; }

/* Handout Preview */
.preview-panel { display: flex; flex-direction: column; }
.handout-display {
    flex-grow: 1;
    min-height: 300px;
    padding: 2rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-wrap: break-word;
}
.handout-content p {
    font-family: var(--font-handout);
    font-size: 1.2rem;
    white-space: pre-wrap;
}

/* Styles */
.parchment { background: #f4e8d1; color: #4a3623; border: 2px solid #d2b48c; box-shadow: inset 0 0 20px rgba(139, 69, 19, 0.1); }
.runic { background: #333; color: #ccc; border: 2px solid #555; font-family: 'Trattatello', fantasy; }
.letter { background: #fff; color: #222; border: 1px solid #eee; text-align: left; align-items: flex-start; }

.export-controls { display: flex; align-items: center; gap: 1rem; }
.output-hint { font-size: 0.85rem; color: #666; }

/* Guide */
.reference-guide { margin-bottom: 3rem; }
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}
.guide-grid article { background: #fff; padding: 1.5rem; border-radius: 6px; border: 1px solid var(--border-color); }
.guide-grid ul { margin-left: 1.5rem; margin-top: 0.5rem; }

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    color: #666;
    font-size: 0.9rem;
}
.site-footer nav a { margin: 0 0.5rem; color: #666; text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    .handout-display, .handout-display * { visibility: visible; }
    .handout-display {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100vh;
        border: none;
        box-shadow: none;
        background: none;
    }
    .parchment { color: #000; }
    .runic { color: #000; }
}


/* 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;
}
