/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #0F172A;
    --color-surface: #1E293B;
    --color-surface-hover: #334155;
    --color-text: #F1F5F9;
    --color-text-muted: #94A3B8;
    --color-accent: #FF6B35;
    --color-accent-hover: #FF8A5C;
    --color-success: #10B981;
    --color-border: #334155;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

html {
    scroll-behavior: smooth;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent-hover);
}

/* Header */
.site-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo:hover {
    color: var(--color-text);
}

.main-nav {
    display: flex;
    gap: 24px;
}

.main-nav a {
    color: var(--color-text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

.main-nav a:hover {
    color: var(--color-text);
}

/* Hero */
.hero {
    padding: 80px 0 40px;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--color-text) 0%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Generator Section */
.generator-section {
    padding: 40px 0;
}

.generator-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 1rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: border-color 0.2s;
}

.form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 10px 16px;
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-text-muted);
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 8px 0;
}

.btn-text:hover {
    color: var(--color-text);
}

/* Exercise Result */
.exercise-result {
    margin-top: 32px;
}

.exercise-result.hidden {
    display: none;
}

.exercise-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 600px;
    margin: 0 auto;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.exercise-tag {
    background: var(--color-accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.exercise-time {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.exercise-card h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.exercise-card p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.exercise-constraints {
    margin-bottom: 24px;
}

.exercise-constraints h3,
.exercise-why h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--color-text);
}

.exercise-constraints ul {
    list-style: none;
    padding: 0;
}

.exercise-constraints li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--color-text-muted);
}

.exercise-constraints li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-accent);
}

.exercise-why {
    background: var(--color-bg);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

.exercise-why p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.exercise-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Exercises Section */
.exercises-section {
    padding: 60px 0;
    background: var(--color-surface);
}

.exercises-section h2,
.how-it-works-section h2,
.history-section h2,
.content-section h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    text-align: center;
}

.section-intro {
    text-align: center;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.exercise-preview-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s, border-color 0.2s;
}

.exercise-preview-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-accent);
}

.exercise-preview-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.exercise-preview-card p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.exercise-preview-card .tag {
    display: inline-block;
    background: var(--color-surface);
    color: var(--color-accent);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* How It Works */
.how-it-works-section {
    padding: 60px 0;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.step-card {
    text-align: center;
    padding: 32px 24px;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 16px;
}

.step-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.step-card p {
    color: var(--color-text-muted);
}

/* History Section */
.history-section {
    padding: 60px 0;
    background: var(--color-surface);
}

.history-list {
    max-width: 600px;
    margin: 0 auto 24px;
}

.history-item {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.history-item-info span {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.history-item button {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
}

.history-item button:hover {
    color: var(--color-text);
}

.empty-history {
    text-align: center;
    color: var(--color-text-muted);
    padding: 32px;
}

/* Content Section */
.content-section {
    padding: 60px 0;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.content-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
}

.content-block h2 {
    text-align: left;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.content-block p {
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.content-block p:last-child {
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 48px 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 32px;
}

.footer-brand p {
    color: var(--color-text-muted);
    margin-top: 12px;
}

.footer-links h4 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--color-text);
}

.footer-links a {
    display: block;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--color-text);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-success);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .exercise-actions,
    .hero,
    .generator-section,
    .exercises-section,
    .how-it-works-section,
    .history-section,
    .content-section {
        display: none;
    }
    
    .exercise-card {
        border: 2px solid #000;
        padding: 24px;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .main-nav {
        display: none;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .exercise-actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .generator-card,
    .exercise-card {
        padding: 24px;
    }
    
    .hero {
        padding: 40px 0 24px;
    }
}


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