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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --border: #475569;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--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: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

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

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Hero */
.hero {
    padding: 80px 0;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

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

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

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
    width: 100%;
}

/* Sections */
section {
    padding: 64px 0;
}

section h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    text-align: center;
}

/* Setup section */
.setup-section {
    background: var(--bg-secondary);
}

.setup-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    align-items: start;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.size-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.size-btn:hover,
.size-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.setup-help {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
}

.setup-help h3 {
    margin-bottom: 16px;
    color: var(--accent);
}

.setup-help ol {
    margin-bottom: 24px;
    padding-left: 20px;
}

.setup-help li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.tip-box {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--accent);
    padding: 16px;
    border-radius: 0 8px 8px 0;
    font-size: 0.875rem;
}

/* Bracket section */
.bracket-section {
    background: var(--bg-primary);
}

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

.bracket-header h2 {
    margin: 0;
    text-align: left;
}

.bracket-progress {
    display: flex;
    align-items: center;
    gap: 16px;
}

.round-indicator {
    font-weight: 600;
    color: var(--accent);
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}

.matchup-area {
    max-width: 600px;
    margin: 0 auto 48px;
}

.matchup-card {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.matchup-item {
    flex: 1;
    padding: 32px 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.matchup-item:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

.matchup-item.winner {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.matchup-item.loser {
    opacity: 0.5;
}

.item-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.vs {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.reason-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reason-input label {
    font-weight: 600;
    color: var(--text-secondary);
}

.reason-input input {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
}

/* Bracket visual */
.bracket-visual {
    display: flex;
    justify-content: center;
    gap: 48px;
    overflow-x: auto;
    padding: 24px 0;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bracket-match {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px;
    min-width: 140px;
    text-align: center;
}

.bracket-match .team {
    padding: 8px;
    border-radius: 4px;
    font-size: 0.875rem;
}

.bracket-match .team.winner {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.bracket-match .team.loser {
    opacity: 0.5;
}

/* Results section */
.results-section {
    background: var(--bg-secondary);
    text-align: center;
}

.winner-display {
    margin-bottom: 48px;
}

.winner-crown {
    font-size: 4rem;
    margin-bottom: 16px;
}

.winner-display h3 {
    font-size: 2.5rem;
    color: var(--success);
    margin-bottom: 8px;
}

.winner-display p {
    color: var(--text-secondary);
    font-style: italic;
}

.story-output {
    max-width: 700px;
    margin: 0 auto 48px;
    text-align: left;
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius);
    line-height: 1.8;
}

.story-output p {
    margin-bottom: 16px;
}

.share-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* History section */
.history-section {
    background: var(--bg-primary);
}

.history-list {
    display: grid;
    gap: 16px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.history-item-info h4 {
    margin-bottom: 4px;
}

.history-item-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.history-item-actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 48px;
}

/* Examples section */
.examples-section {
    background: var(--bg-secondary);
}

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

.example-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    transition: transform 0.2s;
}

.example-card:hover {
    transform: translateY(-4px);
}

.example-card h3 {
    color: var(--accent);
    margin-bottom: 12px;
}

.example-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Tips section */
.tips-section {
    background: var(--bg-primary);
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.tip-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
}

.tip-card h3 {
    color: var(--accent);
    margin-bottom: 12px;
}

.tip-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Footer */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
}

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

.copyright {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .setup-grid {
        grid-template-columns: 1fr;
    }
    
    .setup-help {
        order: -1;
    }
    
    .matchup-card {
        flex-direction: column;
        gap: 16px;
    }
    
    .vs {
        transform: rotate(90deg);
    }
    
    .bracket-header {
        flex-direction: column;
        text-align: center;
    }
    
    .bracket-header h2 {
        text-align: center;
    }
    
    .share-actions {
        flex-direction: column;
    }
    
    .share-actions .btn {
        width: 100%;
    }
    
    .history-item {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .size-options {
        justify-content: center;
    }
    
    .presets {
        justify-content: center;
    }
}



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