@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Cinzel:wght@400;600;700&family=Share+Tech+Mono&display=swap');

:root {
    --primary-red: #c47c1a;
    --primary-red-hover: #e09a2a;
    --glow-color: rgba(196, 124, 26, 0.5);
    --glass-bg: rgba(20, 12, 4, 0.88);
    --glass-border: rgba(196, 124, 26, 0.25);
    --text-color: #f0deb8;
    --text-muted: #9a7d50;

    --brass: #c47c1a;
    --copper: #b5541e;
    --iron: #3a3028;
    --rust: #8b3a1a;
    --aged-paper: #c8a96e;
    --dark-leather: #1a1008;
    --rivets: #5a4a30;
    --steam-white: rgba(240, 222, 184, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    font-family: 'Libre Baskerville', Georgia, serif;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(139, 58, 26, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(196, 124, 26, 0.12) 0%, transparent 50%),
        radial-gradient(circle at center, #1a0f04 0%, #0a0602 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    padding: 20px;

    /* Riveted metal texture via repeating gradient */
    background-image:
        radial-gradient(ellipse at 20% 80%, rgba(139, 58, 26, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(196, 124, 26, 0.12) 0%, transparent 50%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(196, 124, 26, 0.015) 2px,
            rgba(196, 124, 26, 0.015) 4px
        ),
        radial-gradient(circle at center, #1a0f04 0%, #0a0602 100%);
}

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0f0a04;
    border-left: 1px solid var(--iron);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--brass), var(--copper));
    border-radius: 2px;
    border: 1px solid var(--iron);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, var(--primary-red-hover), var(--brass));
}

/* Decorative corner rivet mixin via pseudo-elements */
.container {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;

    background:
        linear-gradient(135deg, rgba(58, 48, 40, 0.6) 0%, rgba(20, 12, 4, 0.95) 40%),
        var(--glass-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    border-radius: 4px;
    border: 1px solid var(--brass);
    border-top: 2px solid var(--primary-red-hover);
    border-bottom: 2px solid var(--copper);
    box-shadow:
        0 0 0 4px rgba(196, 124, 26, 0.08),
        0 0 0 6px rgba(90, 74, 48, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(240, 222, 184, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);

    animation: fadeIn 1s ease-out;
}

/* Corner rivets */
.container::before,
.container::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--aged-paper), var(--brass) 50%, var(--copper));
    box-shadow:
        0 0 4px rgba(0,0,0,0.6),
        inset 0 1px 1px rgba(255,255,255,0.15);
    border: 1px solid var(--iron);
}
.container::before {
    top: 10px;
    left: 10px;
    box-shadow:
        12px 0 0 0 var(--brass),
        12px 0 0 1px var(--iron),
        0 0 4px rgba(0,0,0,0.6),
        inset 0 1px 1px rgba(255,255,255,0.15);
    /* Simulate 4 corner rivets */
    background:
        radial-gradient(circle at 35% 35%, var(--aged-paper), var(--brass) 50%, var(--copper));
}
/* Extra decorative border band at top */
.container > *:first-child {
    position: relative;
}

/* Decorative gear watermark */
@keyframes gearSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Avatar --- */
.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.2rem;

    border: 3px solid var(--iron);
    outline: 2px solid var(--brass);
    outline-offset: 3px;
    box-shadow:
        0 0 0 6px rgba(20, 12, 4, 0.8),
        0 0 0 8px var(--copper),
        0 0 30px var(--glow-color),
        0 0 60px rgba(196, 124, 26, 0.2),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    filter: sepia(20%) contrast(1.05);
}

.avatar:hover {
    transform: scale(1.06) rotate(1deg);
    box-shadow:
        0 0 0 6px rgba(20, 12, 4, 0.8),
        0 0 0 8px var(--primary-red-hover),
        0 0 40px rgba(224, 154, 42, 0.7),
        0 0 80px rgba(181, 84, 30, 0.4);
    filter: sepia(10%) contrast(1.1) brightness(1.05);
}

.username {
    font-family: 'Cinzel', serif;
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    letter-spacing: 2px;
    background: linear-gradient(to bottom, #f0deb8 0%, var(--brass) 50%, var(--copper) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.bio {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 3px;
    border-top: 1px solid rgba(196, 124, 26, 0.2);
    border-bottom: 1px solid rgba(196, 124, 26, 0.2);
    padding: 6px 0;
    position: relative;
}

.bio::before {
    content: '⚙';
    position: absolute;
    left: 0;
    color: var(--brass);
    font-size: 0.7rem;
    opacity: 0.6;
}
.bio::after {
    content: '⚙';
    position: absolute;
    right: 0;
    color: var(--brass);
    font-size: 0.7rem;
    opacity: 0.6;
}

.description {
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(240, 222, 184, 0.8);
    margin-bottom: 2rem;
    font-style: italic;
}

.links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.links a {
    position: relative;
    background: linear-gradient(160deg, #2a1a06 0%, #1a0e04 40%, #221208 100%);
    color: var(--aged-paper);
    text-decoration: none;
    padding: 1rem 1rem 1rem 1.4rem;
    border-radius: 2px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1.5px;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;

    border: 1px solid rgba(196, 124, 26, 0.3);
    border-left: 3px solid var(--brass);
    border-right: 3px solid var(--copper);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(240, 222, 184, 0.04);
    overflow: hidden;
}

.links a::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(196, 124, 26, 0.08) 40%,
        rgba(240, 222, 184, 0.12) 50%,
        rgba(196, 124, 26, 0.08) 60%,
        transparent 100%
    );
    transition: 0.6s ease;
}

.links a:hover::before {
    left: 100%;
}

/* Steam pipe bolt decoration */
.links a::after {
    content: '◈';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brass);
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
}

.links a:hover::after {
    opacity: 1;
    transform: translateY(-50%) rotate(45deg);
}

.links a:hover {
    background: linear-gradient(160deg, #3d2508 0%, #2a1506 40%, #321a08 100%);
    transform: translateY(-2px) translateX(2px);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(196, 124, 26, 0.25),
        inset 0 1px 0 rgba(240, 222, 184, 0.08);
    border-left-color: var(--primary-red-hover);
    border-right-color: var(--brass);
    color: #f8eacc;
}

.links a:active {
    transform: translateY(0px) translateX(1px);
}

.separator {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-family: 'Share Tech Mono', monospace;
}
.separator::before, .separator::after {
    content: "";
    height: 1px;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--brass));
    margin: 0 10px;
}
.separator::after {
    background: linear-gradient(to left, transparent, var(--brass));
}
.separator::before {
    background: linear-gradient(to right, transparent, var(--brass));
}

.setup-container {
    background:
        repeating-linear-gradient(
            45deg,
            rgba(196, 124, 26, 0.015),
            rgba(196, 124, 26, 0.015) 1px,
            transparent 1px,
            transparent 8px
        ),
        rgba(10, 6, 2, 0.6);
    border: 1px solid rgba(196, 124, 26, 0.2);
    border-left: 2px solid var(--copper);
    border-right: 2px solid var(--copper);
    border-radius: 2px;
    padding: 20px;
    margin-top: 25px;
    text-align: left;
    position: relative;
}

.setup-container::before {
    content: '';
    position: absolute;
    top: -1px; left: 20px; right: 20px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--brass), var(--primary-red-hover), var(--brass), transparent);
}
.setup-container::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 20px; right: 20px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--copper), var(--brass), var(--copper), transparent);
}

.setup-container h3 {
    font-family: 'Cinzel', serif;
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 0.85rem;
    color: var(--aged-paper);
    text-transform: uppercase;
    letter-spacing: 4px;
    border-bottom: 1px solid rgba(196, 124, 26, 0.2);
    padding-bottom: 10px;
}

.specs-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px 15px;
    font-size: 0.9rem;
    align-items: center;
}

.specs-grid .label {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.specs-grid .value {
    color: var(--aged-paper);
    font-family: 'Share Tech Mono', monospace;
    background: rgba(196, 124, 26, 0.06);
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 0.82rem;
    border: 1px solid rgba(196, 124, 26, 0.15);
    border-left: 2px solid var(--brass);
}

/* --- Game Area --- */
.game-wrapper {
    margin: 25px auto 0;
    border: 1px solid rgba(196, 124, 26, 0.25);
    border-left: 2px solid var(--brass);
    border-right: 2px solid var(--brass);
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 18px,
            rgba(196, 124, 26, 0.04) 18px,
            rgba(196, 124, 26, 0.04) 19px
        ),
        rgba(6, 4, 2, 0.8);
    border-radius: 2px;
    padding: 15px;
    max-width: 100%;
}

.game-log {
    border: 1px solid rgba(196, 124, 26, 0.2);
    border-radius: 2px;
    padding: 10px;
    height: 100px;
    overflow-y: auto;
    margin-bottom: 12px;
    background: #060402;
    color: var(--aged-paper);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.82rem;
    text-align: left;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.hidden { display: none; }
.center { text-align: center; }
.gold-txt {
    color: var(--brass);
    text-shadow: 0 0 8px rgba(196, 124, 26, 0.6);
    font-family: 'Cinzel', serif;
}
.red-txt {
    color: var(--copper);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(181, 84, 30, 0.5);
}

button, .link-btn {
    background: linear-gradient(160deg, #2a1a06, #1a0e04);
    color: var(--aged-paper);
    border: 1px solid rgba(196, 124, 26, 0.4);
    border-bottom: 2px solid var(--brass);
    padding: 5px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 1px;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

button:hover, .link-btn:hover {
    background: linear-gradient(160deg, #3d2508, #2a1506);
    border-color: var(--primary-red-hover);
    border-bottom-color: var(--primary-red-hover);
    color: #f8eacc;
    box-shadow: 0 0 10px rgba(196, 124, 26, 0.3), 0 2px 4px rgba(0,0,0,0.6);
    transform: translateY(-1px);
}

button:active, .link-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

footer {
    margin-top: 2.5rem;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: rgba(196, 124, 26, 0.35);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* --- Responsive --- */
@media (max-width: 450px) {
    .specs-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 5px;
    }
    .specs-grid .label {
        text-align: left;
        color: var(--brass);
        font-size: 0.75rem;
        margin-top: 8px;
        text-transform: uppercase;
    }
    .specs-grid .value {
        text-align: left;
        background: transparent;
        padding: 0;
        border: none;
        border-left: none;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes steamRise {
    0% { opacity: 0; transform: translateY(0) scale(1); }
    50% { opacity: 0.4; }
    100% { opacity: 0; transform: translateY(-20px) scale(1.5); }
}
