/* ========================================
   IRON & DICE — homepage stylesheet
   ======================================== */
html,
body {
    cursor: url("images/pointer.png") 1 1, auto;
}
@font-face {
    font-family: "GoldBoxGames";
    src: url("fonts/GoldBoxGames.ttf") format("truetype");
    font-display: swap;
}



:root {
    --void: #06080b;
    --inset: #10151d;
    --inset-2: #171e28;
    --stone-dark: #34383d;
    --stone: #62666a;
    --stone-light: #9a9da0;
    --mortar: #17191c;
    --ivory: #f0ead8;
    --muted: #bbb8ae;
    --cyan: #70e8df;
    --gold: #e4b84b;
    --red: #c83b32;
    --green: #61794d;
    --shadow: rgba(0, 0, 0, .72);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ivory);
    font-family: "GoldBoxGames", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.55;
    background-color: var(--void);
    background-image:
        
        url("images/dungeon wall.png");
    background-repeat: repeat;
    image-rendering: pixelated;
}

.screen { padding: 34px 16px; }

.slab {
    position: relative;
    width: min(1040px, 100%);
    margin: 0 auto;
}

@media (hover: hover) and (pointer: fine) {
    .slab {
        width: 1040px;
    }

    body {
        overflow-x: auto;
    }
}

.panel { border-radius: 0; }

/* Header */
.panel-title {
    position: relative;
    padding: 20px 18px 0px;
    text-align: center;
    background: linear-gradient(180deg, #121722 0%, #090d14 100%);
    border: 4px solid var(--stone-dark);
    border-top-color: var(--stone-light);
    border-left-color: #7d8185;
    border-right-color: #25282c;
    border-bottom-color: #1a1c20;
    box-shadow: inset 0 0 0 3px #05070a, 0 10px 30px var(--shadow);
}

.panel-title::after {
    content: "";
    position: absolute;
    inset: 7px;
    pointer-events: none;
}

.site-logo {
    display: block;
    width: 100%;
    max-width: 480px;
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 3px 0 #000) drop-shadow(0 0 10px rgba(228, 184, 75, .18));
}


/* Side logos are hidden unless enough room is available */
.title-side-logo {
    display: none;
}

.site-tagline {
    margin: 8px 0 0;
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* Shared carved-stone frame */
.panel-nav,
.panel-main {
    border: 5px solid var(--stone-dark);
    border-top-color: var(--stone-light);
    border-left-color: #7d8185;
    border-right-color: #25282c;
    border-bottom-color: #1b1e21;
    background:
        linear-gradient(135deg, rgba(255,255,255,.08), transparent 28%),
        linear-gradient(180deg, #696d70, #4b4f53);
    box-shadow:
        inset 0 0 0 2px var(--mortar),
        inset 0 0 24px rgba(0,0,0,.35),
        0 12px 34px var(--shadow);
}



/* Navigation */
.panel-nav {
    margin: 12px auto;
    padding: 13px 38px;
}

.panel-nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.panel-nav a,
.actionButton,
.scoreButton {
    color: var(--ivory);
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .03em;
    text-decoration: none;
    text-shadow: 2px 2px 0 #111;
}

.panel-nav a {
    display: inline-block;
    padding: 6px 10px;
    border: 2px solid transparent;
}

.panel-nav a:hover,
.panel-nav a:focus-visible { color: var(--gold); }

.panel-nav a.active {
    color: var(--cyan);
    background: var(--inset);
    border-top-color: #20242a;
    border-left-color: #20242a;
    border-right-color: #8b8e90;
    border-bottom-color: #8b8e90;
}

/* Main display */
.panel-main {
    position: relative;
    min-height: 420px;
    padding: 38px 58px 46px;
    font-size: 18px;
}

.panel-main::before {
    content: "";
    position: absolute;
    inset: 18px;
    z-index: 0;
    background:
        radial-gradient(circle at 50% 0%, rgba(70, 91, 120, .13), transparent 48%),
        linear-gradient(180deg, var(--inset-2), var(--inset));
    border: 4px solid #25292e;
    border-top-color: #171a1f;
    border-left-color: #171a1f;
    border-right-color: #8c8f91;
    border-bottom-color: #8c8f91;
    box-shadow: inset 0 0 26px rgba(0,0,0,.72);
}


.panel-main > ul:not(.class-list) {
    margin-left: 0;
    padding-left: 20px;
    list-style: none;
}

.panel-main > ul:not(.class-list) li {
    position: relative;
}

.panel-main > ul:not(.class-list) li::before {
    content: "*";
    position: absolute;
    left: -22px;
    color: var(--gold);
}

.panel-main > ul.spell-list li::before {
    content: none;
}





.panel-main > * { position: relative; z-index: 1; }

.panel-main h2,
.panel-main h3 {
    color: var(--gold);
    text-align: center;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #000;
}

.panel-main h2 {
    margin: 0 0 26px;
    font-size: 26px;
    letter-spacing: .05em;
}

.panel-main h3 {
    margin: 30px 0 18px;
    color: var(--cyan);
    font-size: 20px;
}

.panel-main h3.spell-school {
    margin: 0px 0 18px;
    color: #ee6d62;
    font-size: 16px;
}

.panel-main p { margin: 0 0 14px;
text-align: center;}
.panel-main a { color: var(--cyan); }
.panel-main a:hover { color: var(--gold); }

.panel-main li a {
    text-decoration: none;
}


hr {
    height: 4px;
    margin: 24px 0;
    border: 0;
    background: linear-gradient(90deg, transparent, #71757a 15%, #282b30 50%, #71757a 85%, transparent);
}

/* Footer */
.panel-footer {
    padding: 28px 58px 18px;
    color: #888b8e;
    font-size: 15px;
    text-align: center;
    text-shadow: 1px 1px 0 #000;
}



/* Tables */

.table-wrap { width: 100%; margin: 22px 0 32px; overflow-x: auto; }
.rule-table { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: .95rem; }
.rule-table th, .rule-table td { padding: 7px 9px; border: 1px solid #777b7e; text-align: center; }
.rule-table thead th, .rule-table tbody th[scope="row"] { color: var(--cyan); background: #252b34; }
.rule-table td { color: var(--ivory); background: #343941; }
.rule-table tbody tr:nth-child(even) td { background: #2c3138; }

/* Generator components */
.abilityRow {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 10px 0;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(122,126,130,.35);
}

.abilityName { width: 180px; color: var(--cyan); font-weight: bold; }
.scoreOption { padding: 2px 5px; cursor: pointer; }
.scoreOption:hover { color: var(--gold); }
.selectedScore { color: var(--red); text-shadow: 1px 1px 0 #000; }

.classCard {
    margin-bottom: 14px;
    padding: 14px;
    color: var(--ivory);
    background: #292e35;
    border: 3px solid #25282c;
    border-top-color: #767a7e;
    border-left-color: #767a7e;
    box-shadow: inset 0 0 14px rgba(0,0,0,.34);
}

.classCard:hover { border-color: var(--gold); }
.classCard.unavailable { opacity: .42; filter: grayscale(1); }

.actionButton,
.scoreButton {
    display: block;
    min-width: 220px;
    margin: 18px auto;
    padding: 10px 18px;
    cursor: pointer;
    background: linear-gradient(#555b61, #34393f);
    border: 3px solid #24272a;
    border-top-color: #92969a;
    border-left-color: #92969a;
    box-shadow: 3px 4px 0 rgba(0,0,0,.5);
}

.scoreButton { min-width: 0; margin: 12px 0; }
.actionButton:hover, .scoreButton:hover { color: var(--gold); }
.actionButton:active, .scoreButton:active {
    transform: translate(2px, 2px);
    border-top-color: #24272a;
    border-left-color: #24272a;
    border-right-color: #92969a;
    border-bottom-color: #92969a;
    box-shadow: 1px 2px 0 rgba(0,0,0,.55);
}

.textField,
.dropDown,
select,
.customDropDownDisplay,
.customDropdownDisplay {
    width: min(320px, 100%);
    padding: 9px 11px;
    color: var(--ivory);
    font: inherit;
    font-size: 18px;
    background: #10141a;
    border: 3px solid #25282c;
    border-top-color: #090b0e;
    border-left-color: #090b0e;
    border-right-color: #777b7f;
    border-bottom-color: #777b7f;
    border-radius: 0;
    outline: none;
}

.textField:focus,
.dropDown:focus,
select:focus { color: var(--cyan); border-right-color: var(--cyan); border-bottom-color: var(--cyan); }

.dropDown, select { appearance: none; cursor: pointer; }

.customDropDown, .customDropdown { position: relative; width: min(320px, 100%); }
.customDropDownDisplay, .customDropdownDisplay { cursor: pointer; }
.customDropDownList, .customDropdownList {
    display: none;
    color: var(--ivory);
    background: #171c23;
    border: 2px solid #777b7f;
    border-top: 0;
}
.customDropdownList .equipmentOption { padding: 8px 10px; cursor: pointer; }
.customDropdownList .equipmentOption:hover { color: var(--gold); background: #292f37; }

.selectedSkill { color: var(--ivory); background: var(--green); }

#statusMessage {
    position: fixed;
    top: 42%;
    left: 50%;
    z-index: 9999;
    padding: 16px 30px;
    color: var(--cyan);
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    transition: opacity .2s;
    background: #11161d;
    border: 4px solid #777b7f;
    border-right-color: #25282c;
    border-bottom-color: #25282c;
    box-shadow: 0 12px 30px rgba(0,0,0,.72);
}

/* Classes page */
.class-list {
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: center;
}

.class-list a {
    text-decoration: none;
   
}

.class-list-entry {
    text-align: center;
}

.class-list-image {
    display: block;
    width: 140px;
    max-width: 100%;
    height: auto;
    margin: 12px auto 50px;
}

.class-list-link {
    display: inline-block;
    
}

.class-name {
    font-size: 42px !important;
}

/* Spell entry */

.spell-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.spell-list a {
    text-decoration: none;
}

.panel-main > ul.spell-list li::before {
    content: none;
}

.spell-list a {
    text-decoration: none;
}

.spell-entry {
    margin-top: 30px;
}

.spell-entry > h3 {
    margin: 0 0 16px;
}

.spell-panel {
    margin-top: 14px;
    padding: 14px;
    background: #202630;
    border: 3px solid #25282c;
    border-top-color: #777b7f;
    border-left-color: #777b7f;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, .36);
}

.spell-panel h4 {
    margin: 0 0 12px;
    padding-bottom: 7px;
    color: var(--gold);
    font-size: 18px;
    border-bottom: 2px solid #4e545b;
}

.spell-stats {
    display: grid;
    grid-template-columns: minmax(160px, .7fr) minmax(0, 1.3fr);
    column-gap: 14px;
    margin: 0;
}

.spell-stats dt,
.spell-stats dd {
    margin: 0;
    padding: 7px 8px;
    border-bottom: 1px solid #3d444d;
}

.spell-stats dt {
    color: var(--cyan);
    font-weight: bold;
}

.spell-stats dd {
    color: var(--ivory);
}

.spell-stats dt:last-of-type,
.spell-stats dd:last-of-type {
    border-bottom: 0;
}

.spell-description p:last-child {
    margin-bottom: 0;
}

.back-link {
    display: block;
    width: fit-content;
    margin: 0 auto;
    text-decoration: none;
}


/* skills entry */
.panel-main > ul.skill-list {
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: center;
}

.skill-list a {
    text-decoration: none;
}

.panel-main > ul.skill-list li::before {
    content: none;
}


/* Wide windows only */
@media (min-width: 1100px) {
    .title-side-logo {
        display: block;
        position: absolute;
        top: 50%;
        width: 135px;
        max-height: 72%;
        object-fit: contain;
        transform: translateY(-50%);
        pointer-events: none;
        z-index: 2;
    }

    .tgs-logo {
        left: 65px;
        width: 145px;
    }

    .d6-logo {
        right: 65px;
        width: 130px;
    }
    
    .credits-trigger {
    display: block;
    position: absolute;
    top: 50%;
    left: 65px;
    transform: translateY(-50%);
    z-index: 10;
}

.credits-trigger .credits-logo {
    display: block;
    position: static;
    width: 145px;
    max-height: 150px;
    transform: none;
    object-fit: contain;
    pointer-events: auto;
}
}

@media (max-width: 768px) {
    .equipment-table {
        min-width: 850px;
        font-size: 10px;
    }

    .table-wrap {
        overflow-x: auto;
    }
}


@media (max-width: 768px) {
    .screen { padding: 10px 8px; }
    .panel-title { padding: 24px 16px 18px; }
    .site-logo { max-width: 340px; }
    .panel-nav { padding: 12px 8px; }
    .panel-nav ul {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    gap: 10px 18px;
}
    .panel-nav a {
    display: block;
    padding: 5px 6px;
    font-size: 10px;
    text-align: center;
}



.spell-stats {
    grid-template-columns: 1fr;
}

.spell-stats dt {
    padding-bottom: 1px;
    border-bottom: 0;
}

.spell-stats dd {
    padding-top: 1px;
}


    .panel-main { min-height: 360px; padding: 32px 30px 38px; font-size: 12px; line-height: 1.45; }
    .panel-main::before { inset: 10px; }
    .panel-main h2 { font-size: 16px; }
    .panel-main h3 { font-size: 14px; }
    .panel-footer { padding: 18px 10px 10px; font-size: 11px; }
    .actionButton, .scoreButton { min-width: 180px; padding: 8px 10px; font-size: 13px; }
    .textField, .dropDown, select,
    .customDropDownDisplay, .customDropdownDisplay { font-size: 13px; }
    .abilityRow { gap: 10px; }
    .abilityName { width: 110px; }
    #diceContainer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; justify-items: center; }
    .replacementContainer { margin-top: 18px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}



@media (max-width: 950px) {
    .creature-columns {
        grid-template-columns: 1fr;
    }

    .trait-card {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .creature-columns {
        grid-template-columns: 1fr;
    }

    /* Stack Combat labels above their values */
    .combat-block .stat-list {
        grid-template-columns: 1fr;
    }

    .combat-block .stat-list dt {
        padding-bottom: 1px;
        border-bottom: 0;
    }

    .combat-block .stat-list dd {
        padding-top: 1px;
        overflow-wrap: anywhere;
    }

    .traits-grid,
    .ability-grid {
        grid-template-columns: 1fr 1fr;
    }

    .archive-quote {
        padding: 14px;
    }

    .archive-quote cite {
        text-align: left;
    }
}

@media (max-width: 460px) {
    .stat-list,
    .combat-block .stat-list {
        grid-template-columns: 1fr;
    }
    .combat-block h4 {
    font-size: 14px;
    line-height: 1.3;
}

    .stat-list dt {
        padding-bottom: 1px;
        border-bottom: 0;
    }

    .stat-list dd {
        padding-top: 1px;
        overflow-wrap: anywhere;
    }

    .traits-grid,
    .ability-grid,
    .secondary-stats {
        grid-template-columns: 1fr;
    }
}

* {
    cursor: url("images/pointer.png") 1 1, auto !important;
}




@media (max-width: 768px) {
    .class-name {
        font-size: 16px !important;
    }

    .panel-main > p:first-of-type {
    font-size: inherit;
    text-align: left;
}

    .rule-table {
        width: 100%;
        table-layout: fixed;
        font-size: 6px;
    }

    .rule-table th,
    .rule-table td {
        padding: 4px 2px;
        overflow-wrap: anywhere;
    }

    
}

/* Mobile nes controller */
.mobile-controller[hidden] {
    display: none;
}

.mobile-controller {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 100000;

    display: flex;
    align-items: center;
    gap: 38px;

    width: min(360px, calc(100% - 24px));
    padding: 28px 24px 22px;

    background: #aaa8a3;
    border: 5px solid #34383d;
    border-top-color: #d3d1cb;
    border-left-color: #c2c0ba;
    box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.65);

    transform: translateX(-50%);
}

#controller-close {
    position: absolute;
    top: 5px;
    right: 7px;

    padding: 2px 6px;
    color: #222;
    font: inherit;
    background: transparent;
    border: 0;
}

.controller-dpad {
    display: grid;
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(3, 38px);
}

.controller-dpad button {
    color: #ddd;
    font-size: 15px;
    background: #242424;
    border: 2px solid #080808;
}

.controller-dpad button:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
}

.controller-dpad button:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}

.controller-dpad button:nth-child(3) {
    grid-column: 2;
    grid-row: 3;
}

.controller-dpad button:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
}

.controller-actions {
    display: flex;
    gap: 14px;
    transform: rotate(-12deg);
}

.controller-actions button {
    width: 48px;
    height: 48px;

    color: var(--ivory);
    font: inherit;
    font-size: 16px;

    background: #9f1e2b;
    border: 4px solid #67101a;
    border-radius: 50%;
    box-shadow: 2px 3px 0 #333;
}

@media (min-width: 769px) {
    .mobile-controller {
        display: none !important;
    }
}




.controller-dpad button,
.controller-actions button {
    touch-action: manipulation;
    user-select: none;
}

.controller-dpad button:active,
.controller-actions button:active {
    transform: translate(2px, 2px);
    box-shadow: none;
    filter: brightness(0.75);
}

.secret-message[hidden] {
    display: none;
}

.secret-message {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 100000;

    padding: 18px 24px;
    color: var(--gold);
    font-size: 18px;
    text-align: center;

    background: #171c23;
    border: 4px solid #777b7f;
    box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.7);

    transform: translate(-50%, -50%);
}