
/* Custom Fonts */
@font-face {
    font-family: 'PixelOperatorMonoBold';
    src: url('../images/pixel-operator-font/PixelOperatorMono8-Bold.ttf') format('truetype');
}
@font-face {
    font-family: 'KarmaticArcade';
    src: url('../images/karmatic-arcade-font/KarmaticArcade-6Yrp1.ttf') format('truetype');
}

/*
 * Base styles shared between mobile and desktop
 */

:root {
    --primary-color: #030435;
    --secondary-color: #53267c;
    --accent-color: #82D0F4;
    --success-color: #1BBE6F;
    --neutral-color: #FDC220;
    --warning-color: ##E63E12;
    --text-color: #ecf0f1;
    --card-bg-color: #ffffff;
    --card-text-color: #2c3e50;
    --card-aspect-ratio: 1.4;  /* height = width * 1.4 */
    --card-width: min(150px, 35vw);
    --card-height: calc(var(--card-width) * var(--card-aspect-ratio));
    --neon-glow: 0 0 5px var(--accent-color),
                 0 0 10px var(--accent-color),
                 0 0 15px var(--accent-color);
    --background: url('../images/stars.svg') 100% -6% / 30vh 30vh no-repeat,
                  url('../images/volt-logo.svg') center 99% / 40px no-repeat,
                  url('../images/gremo-volit.svg') 84% 84% / 48vh no-repeat,
                  radial-gradient(circle at 0% 0%, #030435 0%, #2b193b 50%, #53267c 100%);
    --background-color: #030435;
    --font-family: 'PixelOperatorMonoBold', monospace;
    --game-font: 'KarmaticArcade', monospace;
    
}



* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Shared styles that don't change between mobile and desktop */
body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
}

/* Modal styles (these are typically the same for both) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    font-family: var(--font-family);
    background: var(--background-color);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 80%;
}
.modal-header {
  padding-bottom: 1rem;
}
.modal-header h2,
.modal-header h2 + button {
  display: inline-block;
  vertical-align: middle;
}
.modal-header h2 + button {
  width: 1.5em;
  height: 1.5em;
}

.modal-message {
    margin-bottom: 1.5rem;
    font-size: 1.5em;
    color: var(--text-color);
    white-space: pre-line;
    text-align: center;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.modal-button {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.modal-button.secondary {
    background: var(--primary-color);
    font-family: var(--font-family);
    color: white;
}

.modal-button.primary {
    background: var(--accent-color);
    font-family: var(--font-family);
    color: white;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modal input[type='range'] {
  accent-color: var(--accent-color);
}

/* Card styles */

/* Tutorial glow effect */
.tutorial-glow {
    box-shadow: 0 0 20px 10px var(--accent-color) !important;
    animation: pulse-glow 1.5s infinite alternate;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 20px 10px var(--accent-color), inset 0 0 0.1rem 0.1rem var(--card-bg-color);
    }
    100% {
        box-shadow: 0 0 30px 15px var(--accent-color), inset 0 0 0.1rem 0.1rem var(--card-bg-color);
    }
}

/* Die container styling */
.die-container {
    display: inline-block;
    position: relative;
    width: fit-content;
    height: fit-content;
    margin: 20px auto;
}

#card-hand .card {
    position: absolute;
    transition: all 0.3s ease;
    transform-origin: bottom center;
}

/* Fallback classes for browsers that don't support :has() */
.three-cards .card:nth-of-type(1) {
  transform: translate(5rem, 0rem) rotate(15deg);
}
.three-cards .card:nth-of-type(2) {
  transform: translate(0, -1rem) rotate(0deg);
}
.three-cards .card:nth-of-type(3) {
  transform: translate(-5rem, 0rem) rotate(-15deg);
}

.two-cards .card:nth-of-type(1) {
  transform: translate(2.5rem, 0rem) rotate(10deg);
}
.two-cards .card:nth-of-type(2) {
  transform: translate(-2.5rem, 0rem) rotate(-10deg);
}

/* Keep original :has() selectors for browsers that support it */
#card-hand:has(.card:nth-of-type(3)) {
    .card:nth-of-type(1) {
      transform: translate(5rem, 0rem) rotate(15deg);
    }
    .card:nth-of-type(2) {
      transform: translate(0, -1rem) rotate(0deg);
    }
    .card:nth-of-type(3) {
      transform: translate(-5rem, 0rem) rotate(-15deg);
    }
  }

#card-hand:has(.card:nth-of-type(2)):not(:has(.card:nth-of-type(3))) {
    .card:nth-of-type(1) {
      transform: translate(2.5rem, 0rem) rotate(10deg);
    }

    .card:nth-of-type(2) {
      transform: translate(-2.5rem, 0rem) rotate(-10deg);
    }
  }

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

.card-icon {
    margin-bottom: 5px;
    text-align: center;
}

#card-hand .card.must-play {
    animation: pulse 0.5s infinite;
    border: 5px solid var(--warning-color);
    background-color: var(--card-bg-color);
}

.must-play-label {
    color: var(--warning-color);
    font-weight: bold;
    font-size: 0.5em;
    background-color: rgba(231, 76, 60, 0.1);
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 4px;
}

@keyframes pulse {
    0% {
        background-color: var(--card-bg-color);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }
    50% {
        background-color: rgba(231, 76, 60, 0.7);
        box-shadow: 0 0 0 40px rgba(231, 76, 60, 0);
    }
    100% {
        background-color: var(--card-bg-color);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* Rules Popup Styles */
#rules-popup {
    display: none;
    position: fixed;
    background: #000000e6;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    text-align: center;
    max-width: 90vw;
    width: max(30vh, 40vw);
}

#rules-popup .popup-arrow {
    position: absolute;
    right: -10px;
    top: 10%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid black;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

#rules-popup .popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#rules-popup .popup-text {
    margin: 0 0 15px 0;
    color: var(--neutral-color);
}

.popup-video {
    width: 100%;
    margin: 15px auto;
}

.popup-video .video-thumbnail {
    position: relative;
    display: block;
    width: 100%;
}

.popup-video .video-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.popup-video .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    cursor: pointer;
}

.popup-video .play-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 15px 0 15px 25px;
    border-color: transparent transparent transparent white;
}

.rules-content h4 {
  margin: .5em 0 .25em;
}
.rules-content .popup-video {
    width: 200px;
}

.rules-content .popup-video .play-button {
    width: 40px;
    height: 40px;
}

.rules-content .popup-video .play-button::after {
    border-width: 10px 0 10px 15px;
}

#rules-popup .game-title .sub-title {
    color: black;
}

#rules-popup .game-title .main-title {
    background-color: black;
}

#rules-popup .tutorial-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

#rules-popup .tutorial-checkbox input[type="checkbox"] {
    margin-right: 10px;
}

#rules-popup .tutorial-checkbox label {
    color: var(--text-color);
    font-size: 0.7em;
}

/* Other shared components */

.discard-pile .card {
    pointer-events: none;
}

.discard-pile .card.must-play {
    pointer-events: none;
}

/* Card styling */
.card, .card-deck, .discard-pile {
    width: var(--card-width);
    height: var(--card-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.card, .card-deck {
    cursor: pointer;
    border: 2px solid #ccc;
    background: var(--card-bg-color);
    box-sizing: border-box;
    padding: 0;
}

.card {
    position: relative;
    transition: all 0.3s ease;
    transform-origin: bottom center;
    z-index: 1;
}

.card-deck {
    position: relative;
    width: 95%;
    height: 95%;
    background-image: url('../images/card-back.svg');
    background-size: 95% 95%;
    background-repeat: no-repeat;
    background-position: center;
    background-color: white;
    border: 2px solid white;
    border-radius: 8px;
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.card-deck:hover {
    transform: rotate(-3deg) scale(1.1);
}



.discard-pile {
    border: 2px dashed #ccc;
    font-size: 14px;
    text-align: center;
    color: #999;
}

.drawn-card h3 {
    font-size: 1.1em;
    margin-bottom: 12px;
    color: var(--primary-color);
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.drawn-card p {
    flex: 1;
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 12px;
}

.drawn-card .card-effect {
    font-size: 0.9em;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-top: auto;
}

.card-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    font-style: italic;
}

.card-content p {
    font-family: monospace;
    font-size: 0.7em;
    margin: 0;
    color: var(--card-text-color);
    line-height: 1.1;
}

.card-content i {
    opacity: 0.7;
}

.card-content strong {
    font-family: var(--font-family);
    font-size: 0.85em;
    margin: 0;
    color: var(--card-text-color);
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: -1px;
}

.card-content {
    text-align: center;
    padding: 12px;
    font-size: 0.9em;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    margin: 0;
    line-height: 1.1;
}

.card-info {
    font-family: monospace;
    margin-top: auto;
    text-align: center;
    font-size: 0.6em;
    color: var(--secondary-color);
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

#card-hand, #discard-pile {
    font-size: 16px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: var(--background-color);
    overflow: hidden;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid var(--accent-color);
}

.leaderboard-table th {
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-weight: bold;
    text-transform: uppercase;
}

.leaderboard-table tr:nth-child(even) {
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

.leaderboard-table tr:hover {
    background-color: rgba(var(--primary-color-rgb), 0.2);
}

.player-name-input {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px;
    text-transform: uppercase;
}

.player-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(var(--primary-color-rgb), 0.5);
}

/* Update dropdown menu styles */
.dropdown-menu {
    background-color: var(--background-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    padding: 10px;
}

.dropdown-menu button,
.dropdown-menu .discord-link,
.dropdown-menu .privacy-link {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
}

.dropdown-menu .settings-link:hover,
.dropdown-menu .rules-link:hover,
.dropdown-menu .leaderboard-link:hover,
.dropdown-menu .credits-link:hover,
.dropdown-menu .privacy-link:hover,
.dropdown-menu .discord-link:hover {
    background-color: #f0f0f0;
    color: var(--accent-color);
}

/* Setting row styles */
.setting-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.difficulty-row, .language-row, .tutorial-row {
    gap: 10px;  /* Space between text and toggle */
}

.difficulty-row span {
    color: white;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: min(30vw, 160px); /* Responsive width with maximum */
    height: min(6vw, 34px); /* Proportional height */
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: calc(min(6vw, 34px) - 8px); /* Dynamic height based on container */
    width: calc(min(6vw, 34px) - 8px); /* Keep circle proportional */
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(calc(min(30vw, 160px) - min(6vw, 34px))); /* Dynamic translation */
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.slider-text {
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: min(1.5vw, 12px); /* Responsive font size */
    z-index: 1;
    transition: opacity 0.4s;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap; /* Prevent text wrapping */
}

.slider-text.left {
    left: min(6vw, 35px);
}

.slider-text.right {
    right: min(6vw, 35px);
}

/* Hide inactive text completely */
input:checked + .slider .slider-text.left,
input:not(:checked) + .slider .slider-text.right {
    opacity: 0;
}

input:not(:checked) + .slider .slider-text.left,
input:checked + .slider .slider-text.right {
    opacity: 1;
}

/* Left tickmark for all objectives */
.objective-track::before {
    content: '';
    position: absolute;
    left: -8px;
    width: 8px;
    height: 1px;
    background-color: white;
    bottom: 37.5%;
}

/* Right tickmark */
.objective-track::after {
    content: '';
    position: absolute;
    right: -8px;
    width: 8px;
    height: 1px;
    background-color: white;
    bottom: 37.5%;
}

/* Fixed width for difficulty text */
.fixed-width {
    display: inline-block;
    min-width: 65px;
    text-align: left;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

#difficulty-toggle, #tutorial-toggle, #music-toggle, #sound-effects-toggle {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.mode-indicator {
    text-align: center;
    font-weight: bold;
    margin-bottom: 1em;
    color: #2196F3;
}

.leaderboard-container {
    display: flex;
    flex-direction: column;
    gap: 1em;
    padding: 1em;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.5em;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.leaderboard-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.leaderboard-message {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 1.5em;
    text-align: center;
}

.highlight-score {
    background-color: rgba(33, 150, 243, 0.1);
    font-weight: bold;
}
