/* ===== CSS Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-elevated: #222636;
  --bg-input: #141722;
  --border: #2a2e3e;
  --border-focus: #FF6B2B;
  --text: #e8eaf0;
  --text-muted: #8b8fa3;
  --text-dim: #5c6078;
  --accent: #FF6B2B;
  --accent-hover: #ff854d;
  --accent-glow: rgba(255,107,43,.15);
  --blue: #4a9eff;
  --blue-dark: #2d7dd2;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 4px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: .2s ease;
}
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, canvas { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header { background: rgba(15,17,23,.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo-text { font-size: 1.1rem; font-weight: 400; letter-spacing: -.01em; }
.logo-text strong { font-weight: 700; }
.main-nav { display: flex; gap: 8px; }
.nav-link { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: .9rem; font-weight: 500; transition: all var(--transition); }
.nav-link:hover { color: var(--text); background: var(--bg-elevated); }
.mobile-menu-btn { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; }
.mobile-menu-btn span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }

/* ===== Hero ===== */
.hero { padding: 80px 0 60px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -200px; left: 50%; transform: translateX(-50%); width: 800px; height: 800px; background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%); pointer-events: none; }
.hero-content { position: relative; max-width: 700px; margin: 0 auto; }
.hero-badge { display: inline-block; padding: 6px 16px; background: var(--accent-glow); border: 1px solid rgba(255,107,43,.3); border-radius: 100px; color: var(--accent); font-size: .8rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 24px; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; margin-bottom: 16px; }
.hero-sub { font-size: 1.15rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 32px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 48px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; }
.hero-stat { text-align: center; }
.hero-stat-num { display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.hero-stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; cursor: pointer; border: none; transition: all var(--transition); font-family: var(--font); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text); border-color: var(--text-dim); }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { width: 28px; height: 28px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .75rem; transition: all var(--transition); }
.btn-icon:hover { background: var(--bg-elevated); color: var(--text); }

/* ===== Sections ===== */
section { padding: 64px 0; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin-bottom: 12px; }
.section-header p { color: var(--text-muted); max-width: 560px; margin: 0 auto; }

/* ===== Generator ===== */
.generator-section { background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.generator-layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; }
.player-panels { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: start; }
.player-panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.player-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.player-panel-header h3 { font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.vs-badge { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border); font-size: .75rem; font-weight: 800; color: var(--text-muted); margin-top: 48px; flex-shrink: 0; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-input, .form-select { width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; font-family: var(--font); transition: border-color var(--transition); }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8fa3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-field { }
.stat-field label { font-size: .7rem; margin-bottom: 4px; }
.stat-field input { padding: 8px 10px; font-size: .85rem; }
.generator-options { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; height: fit-content; }
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .85rem; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: 0; }
.toggle-input { display: none; }
.toggle-track { width: 40px; height: 22px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 11px; position: relative; flex-shrink: 0; transition: all var(--transition); }
.toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--text-muted); border-radius: 50%; transition: all var(--transition); }
.toggle-input:checked + .toggle-track { background: var(--accent-glow); border-color: var(--accent); }
.toggle-input:checked + .toggle-track::after { transform: translateX(18px); background: var(--accent); }
.generator-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.card-preview-area { grid-column: 1 / -1; }
.preview-label { font-size: .85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card-preview-wrapper { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; overflow: auto; }
#card-canvas { max-width: 100%; height: auto; border-radius: var(--radius-xs); }
.card-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.copy-feedback { margin-top: 8px; font-size: .85rem; color: var(--green); min-height: 20px; }

/* ===== How It Works ===== */
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 48px; }
.step { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; transition: all var(--transition); }
.step:hover { border-color: var(--accent); transform: translateY(-2px); }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; margin-bottom: 16px; }
.step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step p { font-size: .9rem; color: var(--text-muted); line-height: 1.6; }
.tips-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 32px; }
.tips-block h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.tips-block ul { list-style: none; }
.tips-block li { padding: 8px 0; padding-left: 24px; position: relative; font-size: .9rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.tips-block li:last-child { border-bottom: none; }
.tips-block li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.historical-context { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.historical-context h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.historical-context p { font-size: .9rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 12px; }
.historical-context p:last-child { margin-bottom: 0; }

/* ===== Examples ===== */
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.example-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; transition: all var(--transition); font-family: var(--font); }
.example-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.example-players { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.example-players strong { color: var(--accent); }
.example-desc { font-size: .85rem; color: var(--text-muted); }

/* ===== FAQ ===== */
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.faq-item summary { padding: 18px 24px; font-weight: 600; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; transition: all var(--transition); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: var(--text-muted); transition: transform var(--transition); }
.faq-item[open] summary::after { content: '−'; color: var(--accent); }
.faq-item summary:hover { background: var(--bg-elevated); }
.faq-item p { padding: 0 24px 18px; color: var(--text-muted); font-size: .9rem; line-height: 1.6; }

/* ===== Footer ===== */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 48px 0 24px; }
.footer-top { display: grid; grid-template-columns: 1fr 2fr; gap: 48px; margin-bottom: 32px; }
.footer-brand p { color: var(--text-muted); font-size: .9rem; margin-top: 8px; max-width: 300px; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.footer-col h4 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 12px; }
.footer-col a { display: block; color: var(--text-muted); font-size: .85rem; padding: 4px 0; transition: color var(--transition); }
.footer-col a:hover { color: var(--text); }
.footer-bottom { padding-top: 24px; border-top: 1px solid var(--border); text-align: center; }
.footer-bottom p { font-size: .8rem; color: var(--text-dim); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .generator-layout { grid-template-columns: 1fr; }
  .player-panels { grid-template-columns: 1fr; }
  .vs-badge { margin: 0 auto; }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .main-nav { display: none; }
  .main-nav.active { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 16px; z-index: 99; }
  .mobile-menu-btn { display: flex; }
  .hero { padding: 48px 0 40px; }
  .hero-stats { gap: 24px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .example-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  section { padding: 48px 0; }
}
@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: center; }
  .card-actions { flex-direction: column; }
  .stat-grid { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: 1fr; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== Focus Styles ===== */
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Selection ===== */
::selection { background: var(--accent); color: white; }

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .generator-section, .hero-badge, .hero-actions, .hero-stats, .card-actions, .how-it-works, .examples-section, .faq-section { display: none; }
  .hero { padding: 20px 0; }
  body { background: white; color: black; }
  #card-canvas { border: 1px solid #ccc; }
}


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