/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff002b;
    --secondary-color: #004e89;
    --accent-1: #00043a;
    --accent-2: #a29c9b;
    --heading-font: 'Eater', system-ui;
    --body-font: 'Funnel Display', sans-serif;
}

body {
    font-family: var(--body-font);
    background-image: url('images/berrington-background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background-color: rgba(0, 4, 58, 0.95);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(255, 0, 43, 0.3);
}

.logo img {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 0, 43, 0.5));
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--accent-2);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
    width: 80%;
}

nav a:hover,
nav a.active {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 0, 43, 0.5);
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

h1 {
    font-family: var(--heading-font);
    font-size: 4rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 3rem;
    text-shadow: 0 0 20px rgb(0, 0, 0),
                 0 0 40px rgba(255, 0, 43, 0.5);
    letter-spacing: 3px;
}

/* Character Forms Section */
.character-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.character-card {
    background: linear-gradient(135deg, rgba(0, 4, 58, 0.9) 0%, rgba(0, 78, 137, 0.85) 100%);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(255, 0, 43, 0.3);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6),
                0 0 40px rgba(255, 0, 43, 0.5);
}

.character-card h2 {
    font-family: var(--heading-font);
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 15px rgba(255, 0, 43, 0.6);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent-2);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input,
.stat input {
    width: 100%;
    padding: 0.8rem;
    background-color: rgba(0, 4, 58, 0.7);
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    color: #fff;
    font-family: var(--body-font);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.stat input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(0, 4, 58, 0.9);
    box-shadow: 0 0 15px rgba(255, 0, 43, 0.4);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-2);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat input {
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
}

/* Submit Button */
button[type="submit"] {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #cc0023 100%);
    color: #fff;
    font-family: var(--body-font);
    font-weight: 700;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 0, 43, 0.4);
}

button[type="submit"]:hover {
    background: linear-gradient(135deg, #cc0023 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 43, 0.6);
}

button[type="submit"]:active {
    transform: translateY(0);
}

/* Footer */
footer {
    background-color: rgba(0, 4, 58, 0.95);
    padding: 1.5rem;
    text-align: center;
    border-top: 3px solid var(--primary-color);
    box-shadow: 0 -4px 10px rgba(255, 0, 43, 0.3);
}

footer p {
    font-family: var(--body-font);
    color: var(--accent-2);
    font-size: 1rem;
    letter-spacing: 1px;
}

.form-status,
#roll-result {
    display: block;
    margin-top: 1rem;
    color: var(--accent-2);
    font-weight: 700;
}

.dice-panel {
    max-width: 900px;
    margin: 3rem auto 0;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 2px solid var(--accent-2);
    border-radius: 16px;
    background: rgba(0, 4, 58, 0.92);
    box-shadow: 0 10px 30px rgba(255, 0, 43, 0.24);
}

.dice-panel h2 { margin: 0; color: #fff; }
.panel-kicker { margin: 0; color: var(--primary-color); font-weight: 800; text-transform: uppercase; letter-spacing: 2px; }
.dice-controls { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 1rem; align-items: end; margin-top: 1.5rem; }
.dice-controls label { color: #fff; font-weight: 700; }
.dice-controls input,
.dice-controls select { width: 100%; margin-top: .4rem; padding: .8rem; border-radius: 8px; }
#roll-button { padding: .9rem 1.5rem; border: 0; border-radius: 8px; color: white; background: var(--primary-color); font: inherit; font-weight: 800; cursor: pointer; }

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    h1 {
        font-size: 2.5rem;
    }

    .character-forms {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dice-controls { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .logo img {
        height: 60px;
    }

    h1 {
        font-size: 2rem;
    }

    .character-card h2 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dice-controls { grid-template-columns: 1fr; }
}
