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

:root {
    --bg-dark: #1a1410;
    --bg-parchment: #f4e4c1;
    --bg-card: #2a1f18;
    --bg-input: #3b2d23;
    --text-primary: #f0e6d3;
    --text-secondary: #b8a58e;
    --text-muted: #7a6a5a;
    --accent-gold: #c9a96e;
    --accent-red: #c44d4d;
    --accent-green: #6b9e6b;
    --accent-blue: #6b8e9e;
    --border-color: #4a3a2e;
    --shadow-soft: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-card: 0 4px 16px rgba(0,0,0,0.4);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-body: 'Georgia', 'Times New Roman', serif;
    --font-heading: 'Georgia', 'Times New Roman', serif;
    --font-mono: 'Courier New', monospace;
    --transition: 0.2s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(ellipse at 20% 20%, rgba(201,169,110,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(201,169,110,0.03) 0%, transparent 50%);
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent-gold);
    color: var(--bg-dark);
    padding: 8px 16px;
    z-index: 1000;
    font-weight: bold;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
    top: 0;
}

/* === Header === */
.site-header {
    background: rgba(26,20,16,0.95);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 1.5rem;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--accent-gold);
    font-weight: bold;
    font-size: 1.2rem;
}
.logo-icon {
    flex-shrink: 0;
}
.logo-text {
    letter-spacing: 0.5px;
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}
.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.main-nav a:hover,
.main-nav a.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

/* === Hero === */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}
.hero-content h1 {
    font-size: 3rem;
    color: var(--accent-gold);
    font-family: var(--font-heading);
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin-top: 0.5rem;
}
.hero-dice {
    opacity: 0.8;
    animation: float 4s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === Section Titles === */
.section-title {
    font-size: 1.8rem;
    color: var(--accent-gold);
    text-align: center;
    margin-bottom: 2rem;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    position: relative;
}
.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--accent-gold);
    margin: 0.5rem auto 0;
    opacity: 0.6;
}

/* === Tracker Section === */
.tracker-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
}
.tracker-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-card);
}

/* === Add Form === */
.add-form {
    margin-bottom: 1.5rem;
}
.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}
.form-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
}
.form-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(201,169,110,0.2);
}
.form-group input::placeholder {
    color: var(--text-muted);
}

/* === Buttons === */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent-gold);
    color: var(--bg-dark);
    font-weight: bold;
    border-color: var(--accent-gold);
}
.btn-primary:hover {
    background: #d4b87a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201,169,110,0.3);
}
.btn-outline {
    background: transparent;
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}
.btn-outline:hover {
    background: rgba(201,169,110,0.1);
}
.btn-danger-outline {
    background: transparent;
    color: var(--accent-red);
    border-color: var(--accent-red);
}
.btn-danger-outline:hover {
    background: rgba(196,77,77,0.1);
}
.btn-dice {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
    padding: 6px 10px;
    font-size: 0.8rem;
    min-width: 36px;
    text-align: center;
}
.btn-dice:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}
.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* === Quick Rolls === */
.quick-rolls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.quick-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 6px;
}

/* === Combat Controls === */
.combat-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.round-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.round-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.round-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-gold);
    font-family: var(--font-mono);
}
.control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* === Initiative List === */
.initiative-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
    gap: 1rem;
}
.combatant-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    flex-wrap: wrap;
}
.combatant-card.active-turn {
    border-color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(201,169,110,0.3);
    background: #3b2a1a;
}
.combatant-card.active-turn::before {
    content: '▶';
    position: absolute;
    left: -18px;
    color: var(--accent-gold);
    font-size: 0.9rem;
}
.combatant-initiative {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--accent-gold);
    font-family: var(--font-mono);
    min-width: 40px;
    text-align: center;
}
.combatant-info {
    flex: 1;
    min-width: 120px;
}
.combatant-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
}
.combatant-hp {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.combatant-hp .hp-current {
    color: var(--accent-green);
    font-weight: bold;
}
.combatant-hp .hp-max {
    color: var(--text-muted);
}
.combatant-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.condition-tag {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(196,77,77,0.2);
    color: var(--accent-red);
    border: 1px solid rgba(196,77,77,0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}
.condition-tag .cond-timer {
    font-weight: bold;
    font-family: var(--font-mono);
}
.combatant-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.hp-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.hp-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.hp-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}
.remove-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.remove-btn:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* === Condition Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-card);
}
.modal-content h3 {
    color: var(--accent-gold);
    margin-bottom: 1rem;
}
.modal-content .form-group {
    margin-bottom: 1rem;
}
.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* === Features Section === */
.features-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}
.feature-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}
.feature-icon {
    margin-bottom: 1rem;
}
.feature-card h3 {
    color: var(--accent-gold);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* === How-To Section === */
.howto-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
}
.howto-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-dark);
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-content h3 {
    color: var(--accent-gold);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}
.step-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === Footer === */
.site-footer {
    margin-top: auto;
    background: rgba(26,20,16,0.95);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    text-align: center;
}
.footer-inner {
    max-width: 600px;
    margin: 0 auto;
}
.footer-brand {
    color: var(--accent-gold);
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.footer-nav {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}
.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}
.footer-nav a:hover {
    color: var(--accent-gold);
}
.footer-copy {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* === About Page === */
.about-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}
.about-page h1 {
    color: var(--accent-gold);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}
.about-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* === Legal Pages === */
.legal-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}
.legal-page h1 {
    color: var(--accent-gold);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}
.legal-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1rem;
    }
    .hero-content h1 {
        font-size: 2.2rem;
    }
    .hero-subtitle {
        max-width: 100%;
        font-size: 1rem;
    }
    .hero-dice {
        display: none;
    }
    .form-row {
        flex-direction: column;
    }
    .form-group {
        min-width: 100%;
    }
    .combat-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .control-buttons {
        justify-content: center;
    }
    .combatant-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .combatant-card.active-turn::before {
        left: -10px;
        top: 50%;
        transform: translateY(-50%);
    }
    .combatant-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .tracker-container {
        padding: 1rem;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .step {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-inner {
        height: auto;
        padding: 0.75rem 0;
        flex-direction: column;
        gap: 0.5rem;
    }
    .main-nav ul {
        gap: 1rem;
    }
    .quick-rolls {
        justify-content: center;
    }
    .round-display {
        align-self: center;
    }
    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}



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