/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400..900&family=Gentium+Plus:ital,wght@0,400;0,700;1,400;1,700&family=Lobster+Two:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {

    /* Fonts */
    /* --primary-font: 'Figtree', sans-serif; */
    --secondary-font: 'Montserrat', sans-serif;


    /* Colors */
    --primary-color: #F7EF99;
    /* light cyan */
    --secondary-color: #ABE188;
    /* light blue */
    --highlight-color: #8B8BAE;
    /* purple/lavender */
    --highlight-color-light: #F1BB87;
    /* dark teal */
    --text-color: #5D675B;
    /* dark teal */

    /* Light border colors for sections */
    --border-light-cyan: rgba(197, 255, 253, 0.3);
    --border-light-blue: rgba(136, 217, 230, 0.3);
    --border-light-purple: rgba(139, 139, 174, 0.3);
    --border-very-light: rgba(197, 255, 253, 0.15);
    /* Maze variables */
    --wall-style: 2px solid black;
    --maze-cell-width: calc(min(80vw, 0.75*50vh)/var(--maze-dimension));

    /* Fable theme styling */
    --fable-primary-color: #8B4513;
    --fable-highlight-color: #DAE6B0;
    --fable-secondary-highlight-color: #DAA520;
    --fable-text-color: black;

    --fable-primary-font: 'Cinzel', 'Times New Roman', serif;
    --fable-text-font: "Gentium Plus", serif;

    --fable-panel-bg: rgba(244, 241, 232, 0.7);
    --fable-modal-bg: rgba(244, 241, 232);
    --fable-panel-border: 1px solid #8b4513;

    --fable-btn-bg: linear-gradient(145deg, #4b6fd1 0%, #2c4079 100%);
    --fable-btn-hover-bg: linear-gradient(145deg, #5CA0FF 0%, #4b6fd1 100%);
    --fable-btn-border: 1px solid #16213e;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--fable-text-font);
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--fable-text-color);
}

h1,
h2,
h3 {
    font-family: var(--fable-primary-font);
    font-weight: 700;
}

h1 {
    font-size: 2rem;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--fable-text-color);
}

h2 {
    font-size: 1rem;
    line-height: 1.3;
    text-transform: uppercase;
}

h3 {
    font-size: 1.5rem;
    line-height: 1.4;
}

p {
    /* font-size: 1rem; */
    line-height: 1.6;
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.6;
}

/* Maze global classes */
.maze-row {
    display: flex;
    justify-content: center;
}

.maze-cell {
    width: var(--maze-cell-width);
    height: var(--maze-cell-width);
}

.maze-path {
    background-color: palevioletred;
}

.maze-solution {
    background-color: lawngreen;
}

.maze-door {
    background: url(../images/door-closed.webp) no-repeat center/contain;
}

.maze-door-open {
    background-color: lightcoral;
    background: url(../images/door-open.webp) no-repeat center/contain;
}

.maze-start {
    background: url(../images/maze-start.png) no-repeat center/contain;
}

.maze-end {
    background: url(../images/checkered-flag.png) no-repeat center/contain;
}

.wall-top {
    border-top: var(--wall-style);
}

.wall-right {
    border-right: var(--wall-style);
}

.wall-bottom {
    border-bottom: var(--wall-style);
}

.wall-left {
    border-left: var(--wall-style);
}

.player-position {
    display: flex;
    justify-content: center;
    align-items: center;
}

.player {
    background-color: blue;
    width: 80%;
    aspect-ratio: 1;
    border-radius: 50%;

}

.section-content {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url(../images/rivendell.webp) no-repeat center/cover;
}

.circle {
    aspect-ratio: 1;
    border-radius: 50%;
}

.btn {
    background: var(--fable-btn-bg);
    border: var(--fable-btn-border);
    border-radius: 1.5rem;
    color: #f4f1e8;
    font-weight: 900;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--fable-btn-hover-bg);
    /* background: linear-gradient(145deg, #ffd700 0%, #daa520 100%); */
    transform: translateY(-2px);
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hide {
    display: none;
}

/* Intro section */
#intro>.container {
    height: 80%;
    width: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#intro .row {
    height: 100%;
    width: 100%;
}

#intro-hero {
    background: url(../images/wizard.webp) no-repeat center/contain;
}

#intro-hero,
#intro-buttons,
#intro-title {
    width: 100%;
    display: flex;
    justify-content: center;
}

#intro-hero,
#intro-buttons {
    height: 40%;
}


#intro-buttons {
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

#intro-buttons>button {
    width: 40%;
    margin: 1rem 0;
}

#intro-buttons>button:first-child {
    width: 80%;
    background: var(--fable-primary-color);
}

#game-settings {
    width: 80%;
    background-color: rgba(218, 230, 176, 0.25);
    border: var(--fable-panel-border);
    border-radius: 0.5rem;
    display: flex;
    justify-content: center;
    flex-direction: column;
    padding: 0.25rem;
    text-align: center;
    font-weight: 600;
    color: white;
}

#game-settings>div:first-of-type {
    display: flex;
    justify-content: space-between;
}

/* Games section */
#game-section>.container {
    height: 80%;
    width: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-section .row {
    height: 100%;
}

#game-section .row>div {
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-section #section-heading {
    height: 10%;
}

#game-section #game-area {
    height: 50%;
}

#game-controls {
    height: 22%;
    margin: 0.5rem 0;
    position: relative;
}

#game-stats,
#game-master-keys {
    height: 14%;
    padding: 0;
}

#game-stats .row {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
}

#game-stats span {
    /* margin: 0.5rem; */
    display: flex;
    justify-content: center;
    height: 20%;
}

#game-controls .btn {
    --btn-height: 30%;
    height: var(--btn-height);
    text-align: center;
    padding: 0;
    margin: 0;
    position: absolute;
}

#game-controls .btn[data-direction="ArrowLeft"] {
    left: 25%;
}

#game-controls .btn[data-direction="ArrowRight"] {
    right: 25%;
}

#game-controls .btn[data-direction="ArrowUp"] {
    top: 5%;
}

#game-controls .btn[data-direction="ArrowDown"] {
    bottom: 5%;
}

/* Master Key Display */
.fa-key.used-key {
    opacity: 30%;
}

#game-stats,
#game-master-keys {
    display: flex;
    flex-direction: column;
}

/* Modal Styles - Testing */
.modal-content {
    border-radius: 1rem;
    border: 3px solid var(--border-light-cyan);
    background: var(--fable-modal-bg);
}

.modal-header {
    padding: 2rem 2rem 1rem;
}

.modal-title {
    font-family: var(--fable-primary-font);
    color: var(--fable-text-color);
    font-weight: 600;
}

.modal-title .fas.fa-leaf {
    color: var(--highlight-color-light);
}

.modal-body {
    padding: 1rem 2rem;
}

.modal-body p {
    font-family: var(--fable-text-font);
    color: var(--fable-text-color);
    line-height: 1.6;
}

.modal-body .lead {
    font-family: var(--fable-primary-font);
    color: var(--fable-text-color);
}

.modal-body .alert {
    background: linear-gradient(135deg, var(--fable-highlight-color) 0%, var(--fable-secondary-highlight-color) 100%);
    border-radius: 15px;
    border: 2px solid var(--fable-primary-color);
}

.modal-body .alert strong,
.modal-body .alert span {
    color: var(--fable-text-color);
}


.modal-footer {
    padding: 1rem 2rem 2rem;
}

.modal-footer .btn {
    background: var(--fable-btn-bg);
    color: white;
    border: var(--fable-btn-border);
    border-radius: 25px;
    padding: 12px 30px;
    font-family: var(--fable-text-font);
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 139, 174, 0.3);
}

.modal-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 139, 174, 0.4);
    background: var(--fable-btn-hover-bg);
}

.modal-footer .trivia-options {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.trivia-options>.btn {
    width: 100%;
    margin: 0.5rem 0;
}

.modal-footer .btn.btn-master-key {
    background: var(--fable-primary-color);
}

/* Wizard Image in Trivia Modal */
.wizard-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.wizard-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--fable-primary-color);
    box-shadow: 0 4px 15px rgba(139, 139, 174, 0.3);
    transition: all 0.3s ease;
}

.wizard-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 139, 174, 0.4);
    border-color: var(--highlight-color-light);
}

/* =================================
   FABLE-INSPIRED THEME
   ================================= */

/* Enable this theme by adding class "fable-theme" to body */
.fable-theme #intro>.container,
.fable-theme #game-section>.container {
    background: rgba(244, 241, 232, 0.1);
    border: 1px solid rgba(139, 69, 19, 0.7);
    backdrop-filter: blur(3px);
    box-shadow:
        0 2px 8px rgba(139, 69, 19, 0.5),
        inset 0 1px 0 rgba(218, 165, 32, 0.5);
    border-radius: 1rem;
    position: relative;
}

/* Medieval heading styling */
.fable-theme #section-heading h2 {
    font-family: var(--fable-primary-font);
    text-shadow: 2px 2px 4px rgba(139, 69, 19, 0.3);
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0;
    position: relative;
}

.fable-theme #section-heading h2::before,
.fable-theme #section-heading h2::after {
    content: '⚜';
    color: #daa520;
    margin: 0 15px;
    font-size: 0.8em;
}

/* Maze area with ornate border */
.fable-theme #maze-area {
    border: 3px solid #8b4513;
    border-radius: 0.5rem;
    box-shadow:
        inset 0 0 15px rgba(139, 69, 19, 0.2),
        0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    padding: 10px;
    background: transparent;
}

.fable-theme #maze-area::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #daa520, #b8860b, #daa520, #b8860b);
    border-radius: 0.5rem;
    z-index: -1;
}

/* Control panel styling */
.fable-theme #game-controls {
    background: var(--fable-panel-bg);
    border: var(--fable-panel-border);
    border-radius: 12px;
    box-shadow:
        inset 0 0 10px rgba(139, 69, 19, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
}



/* Stats and keys panels */
.fable-theme #game-master-keys,
.fable-theme #game-stats {
    background: var(--fable-panel-bg);
    border: var(--fable-panel-border);
    border-radius: 0.5rem;
    box-shadow:
        inset 0 0 8px rgba(139, 69, 19, 0.2),
        0 3px 8px rgba(0, 0, 0, 0.3);
    color: black;
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(139, 69, 19, 0.2);
}

.fable-theme #game-master-keys .fa-key {
    color: #daa520;
    filter: drop-shadow(1px 1px 2px rgba(139, 69, 19, 0.3));
    font-size: 0.8rem;
}

.fable-theme #game-master-keys .fa-key.used-key {
    color: #8b7355;
    opacity: 1;
}

/* Enhanced maze cell styling for fable theme */
.fable-theme .maze-cell {
    border-color: #8b4513 !important;
    border-width: 1px !important;
}

.fable-theme .player {
    background: radial-gradient(circle, #4b6fd1 0%, #365097 70%, #2c4079 100%);
    border: 2px solid #16213e;
    box-shadow:
        0 0 10px rgba(255, 215, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* =================================
   END FABLE THEME
   ================================= */


/* Media queries */
/* Extra small devices */
@media screen and (min-width:768px) {
    body{
        font-size: 1rem;
    }

    #intro-buttons>button,
    #game-settings {
        width: 40%;
    }

    #intro-buttons>button:first-child {
        width: 60%;
    }

    #game-controls .btn[data-direction="ArrowLeft"] {
        left: 35%;
    }

    #game-controls .btn[data-direction="ArrowRight"] {
        right: 35%;
    }

    .trivia-options>.btn {
        width: 48%;
    }
}

/* Large Devices (desktops, 992px and larger) */
@media screen and (min-width:992px) {
    h2{
        font-size: 2rem;
    }
    #game-controls .btn[data-direction="ArrowLeft"] {
        left: 36%;
    }

    #game-controls .btn[data-direction="ArrowRight"] {
        right: 36%;
    }

    #game-section .row {
        width: 100%;
        position: relative;
    }

    #game-master-keys,
    #game-stats {
        position: absolute;
        top: 42.5%;
        width: 20%;
        border-radius: 1rem;
    }

    #game-master-keys {
        left: 5%;
    }

    #game-stats {
        right: 5%;
    }
}

/* Extra large devices (larger than 1400px) */
@media screen and (min-width:1400px) {
    body {
        font-size: 1.3rem;
    }
    #game-controls .btn[data-direction="ArrowLeft"] {
        left: 37%;
    }

    #game-controls .btn[data-direction="ArrowRight"] {
        right: 37%;
    }
}