@font-face {
    font-family: 'ChonkyBitsFontRegular';
    src: url(fonts/chonky-bits-font/ChonkyBitsFontRegular-nA5x1.otf) format('opentype');
    font-weight: normal;
    font-style: normal;
}
 
/* =========================
   RESPONSIVE VARIABLEN
========================= */
:root {
    --field-size: 38px;
    --figure-size: 26px;
    --dice-size: 70px;
}
 
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
 
/* =========================
   BODY & CONTAINER
========================= */
body {
    font-family: 'ChonkyBitsFontRegular', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    image-rendering: pixelated;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    overflow: hidden;
}

/* =========================
   SPIELERAUSWAHL SCREEN
========================= */
.player-selection {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.selection-container {
    background: white;
    padding: 40px;
    box-shadow:
        0 0 0 4px #7f7f7f,
        8px 8px 0 0 #000;
    text-align: center;
    max-width: 600px;
}

.selection-container h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.selection-container h2 {
    font-size: 20px;
    color: #555;
    margin-bottom: 40px;
}

.player-options {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.player-option {
    background: white;
    width: 140px;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow:
        0 0 0 3px #000,
        6px 6px 0 0 #000;
    transition: all 0.2s ease;
}

.player-option:hover {
    transform: translate(-3px, -3px);
    box-shadow:
        0 0 0 3px #000,
        9px 9px 0 0 #000;
    background: #f8f9fa;
}

.player-option:active {
    transform: translate(2px, 2px);
    box-shadow:
        0 0 0 3px #000,
        4px 4px 0 0 #000;
}

.option-number {
    font-size: 60px;
    font-weight: bold;
    color: #333;
    line-height: 1;
}

.option-text {
    font-size: 18px;
    color: #555;
    margin-top: 5px;
}
 
.container {
    background: white;
    padding: 15px;
    max-width: 100%;
    max-height: 96vh;
    overflow: hidden;
    box-shadow:
        0 0 0 4px #7f7f7f,
        8px 8px 0 0 #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* =========================
   HEADER MIT 2 BUTTONS
========================= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 15px;
}

h1 {
    color: #333;
    font-size: 20px;
    flex: 1;
    text-align: center;
}

.header-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.restart-btn,
.change-players-btn {
    font-family: 'ChonkyBitsFontRegular', sans-serif;
    padding: 7px 14px;
    font-size: 13px;
    background: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow:
        0 0 0 2px #000,
        3px 3px 0 0 #000;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.restart-btn:hover,
.change-players-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow:
        0 0 0 2px #000,
        5px 5px 0 0 #000;
}

.restart-btn:active,
.change-players-btn:active {
    transform: translate(1px, 1px);
    box-shadow:
        0 0 0 2px #000,
        2px 2px 0 0 #000;
}
 
/* =========================
   SPIELER-ANZEIGE MIT FIGUR
========================= */
.game-info {
    text-align: center;
    margin-bottom: 6px;
    font-size: 16px;
    color: #555;
    font-weight: bold;
}

#currentPlayer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.player-indicator {
    display: inline-block;
    width: 32px;
    height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    vertical-align: middle;
}

.player-indicator.red {
    background-image: url(Bilder/player/player-red.png);
}

.player-indicator.blue {
    background-image: url(Bilder/player/player-blue.png);
}

.player-indicator.green {
    background-image: url(Bilder/player/player-green.png);
}

.player-indicator.yellow {
    background-image: url(Bilder/player/player-yellow.png);
}
 
/* =========================
   MESSAGE
========================= */
.message {
    text-align: center;
    margin-bottom: 8px;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    min-height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.can-move {
    background-color: #d3f9d8;
    color: #2b8a3e;
    font-weight: bold;
}

.message.no-move {
    background-color: #ffe3e3;
    color: #c92a2a;
    font-weight: bold;
}

.message.winner {
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
    color: #000;
    font-size: 18px;
    font-weight: bold;
    animation: winner-pulse 0.5s infinite alternate;
}

@keyframes winner-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}
 
/* =========================
   BOARD
========================= */
.board {
    display: grid;
    grid-template-columns: repeat(11, var(--field-size));
    grid-template-rows: repeat(11, var(--field-size));
    width: fit-content;
    margin: 0 auto 12px;
    padding: 4px;
    background: #f5f5f5;
    box-shadow:
        0 0 0 3px #7f7f7f,
        6px 6px 0 0 #000;
    transform-origin: center center;
}
 
/* =========================
   FIELDS
========================= */
.field {
    width: var(--field-size);
    height: var(--field-size);
    border: 1px solid #999fa5;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url(Bilder/field/path5.png);
    background-size: cover;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}
 
.field.empty {
    background: #f5f5f5;
    border: none;
}
 
.field.home-area {
    border: 2px solid;
    background-size: 90%;
    background-repeat: no-repeat;
    background-position: center;
}
 
.field.home-area.red {
    background-image: url(Bilder/home/home-red.png);
    border-color: #c92a2a;
}
 
.field.home-area.blue {
    background-image: url(Bilder/home/home-blue.png);
    border-color: #1864ab;
}
 
.field.home-area.green {
    background-image: url(Bilder/home/home-green.png);
    border-color: #2b8a3e;
}
 
.field.home-area.yellow {
    background-image: url(Bilder/home/home-yellow.png);
    border-color: #e67700;
}
 
.field.start-field {
    background-image: url(Bilder/field/start2.png);
}
 
.field.goal-field {
    border: 2px solid;
}
 
.field.goal-field.red { background-image: url(Bilder/goal/goal-red.png); }
.field.goal-field.blue { background-image: url(Bilder/goal/goal-blue.png); }
.field.goal-field.green { background-image: url(Bilder/goal/goal-green.png); }
.field.goal-field.yellow { background-image: url(Bilder/goal/goal-yellow.png); }
 
.field:not(.empty):not(.home-area):hover {
    transform: scale(1.05);
    z-index: 5;
}
 
/* =========================
   FIGURES
========================= */
.figure {
    width: var(--figure-size);
    height: var(--figure-size);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    cursor: pointer;
    transition: transform 0.3s ease;
}
 
.figure.red { background-image: url(Bilder/player/player-red.png); }
.figure.blue { background-image: url(Bilder/player/player-blue.png); }
.figure.green { background-image: url(Bilder/player/player-green.png); }
.figure.yellow { background-image: url(Bilder/player/player-yellow.png); }

.figure:hover {
    transform: scale(1.1);
}
 
.figure.selectable {
    animation: pulse 0.8s infinite;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9));
}
 
@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9));
    }
    50% { 
        transform: scale(1.25);
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1));
    }
}
 
/* =========================
   DICE
========================= */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.dice {
    width: var(--dice-size);
    height: var(--dice-size);
    background-image: url('Bilder/wuerfel.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    cursor: pointer;
    box-shadow:
        0 0 0 3px #000,
        5px 5px 0 0 #000;
    transition: all 0.2s ease;
    position: relative;
}

.dice:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 3px #000,
        7px 8px 0 0 #000;
}

.dice:active:not(.disabled) {
    transform: translateY(1px);
    box-shadow:
        0 0 0 3px #000,
        3px 3px 0 0 #000;
}

.dice.rolling {
    animation: diceRoll 0.6s ease-in-out;
    pointer-events: none;
}

@keyframes diceRoll {
    0% { 
        transform: rotate(0deg) scale(1);
    }
    25% { 
        transform: rotate(90deg) scale(1.1);
    }
    50% { 
        transform: rotate(180deg) scale(1.2);
    }
    75% { 
        transform: rotate(270deg) scale(1.1);
    }
    100% { 
        transform: rotate(360deg) scale(1);
    }
}

.dice.show-result {
    animation: diceShake 0.3s ease-in-out;
}

@keyframes diceShake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-4px) rotate(-4deg); }
    75% { transform: translateX(4px) rotate(4deg); }
}

.dice.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(50%);
}
 
/* =========================
   RESPONSIVE BREAKPOINTS
========================= */

/* Große Bildschirme */
@media (min-width: 1400px) {
    :root {
        --field-size: 42px;
        --figure-size: 28px;
        --dice-size: 75px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .game-info {
        font-size: 18px;
    }
    
    .player-indicator {
        width: 36px;
        height: 36px;
    }
    
    .restart-btn,
    .change-players-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
}

@media (max-width: 1399px) {
    :root {
        --field-size: 38px;
        --figure-size: 26px;
        --dice-size: 70px;
    }
}

@media (max-width: 1200px) {
    :root {
        --field-size: 35px;
        --figure-size: 24px;
        --dice-size: 65px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .game-info {
        font-size: 15px;
    }
    
    .message {
        font-size: 13px;
        padding: 5px;
    }
    
    .container {
        padding: 12px;
    }
    
    .restart-btn,
    .change-players-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .player-indicator {
        width: 28px;
        height: 28px;
    }
}
 
@media (max-width: 900px) {
    :root {
        --field-size: 32px;
        --figure-size: 22px;
        --dice-size: 60px;
    }
    
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 17px;
    }
    
    .restart-btn,
    .change-players-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .player-indicator {
        width: 26px;
        height: 26px;
    }
    
    .selection-container {
        padding: 30px;
    }
    
    .selection-container h1 {
        font-size: 24px;
    }
    
    .selection-container h2 {
        font-size: 18px;
    }
    
    .player-option {
        width: 120px;
        height: 120px;
    }
    
    .option-number {
        font-size: 50px;
    }
}
 
@media (max-width: 600px) {
    :root {
        --field-size: 26px;
        --figure-size: 17px;
        --dice-size: 55px;
    }
 
    .container {
        padding: 10px;
    }
 
    h1 {
        font-size: 15px;
    }
 
    .game-info {
        font-size: 13px;
    }

    .message {
        font-size: 12px;
        padding: 4px;
        margin-bottom: 6px;
    }
    
    .header {
        gap: 10px;
    }
    
    .header-buttons {
        gap: 4px;
    }
    
    .restart-btn,
    .change-players-btn {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    .player-indicator {
        width: 24px;
        height: 24px;
    }
    
    .selection-container {
        padding: 20px;
    }
    
    .selection-container h1 {
        font-size: 20px;
    }
    
    .selection-container h2 {
        font-size: 16px;
        margin-bottom: 30px;
    }
    
    .player-options {
        gap: 15px;
    }
    
    .player-option {
        width: 100px;
        height: 100px;
    }
    
    .option-number {
        font-size: 40px;
    }
    
    .option-text {
        font-size: 14px;
    }
}
 
@media (max-width: 420px) {
    :root {
        --field-size: 23px;
        --figure-size: 15px;
        --dice-size: 50px;
    }
    
    h1 {
        font-size: 13px;
    }
    
    .player-indicator {
        width: 22px;
        height: 22px;
    }
}
 
@media (max-width: 360px) {
    :root {
        --field-size: 20px;
        --figure-size: 13px;
        --dice-size: 45px;
    }
    
    .player-indicator {
        width: 20px;
        height: 20px;
    }
}

html {
    overflow: hidden;
    height: 100vh;
}

body {
    overflow: hidden;
    height: 100vh;
}

.corner-btn{
  width: 46px;
  height: 46px;
  padding: 0;

  background: #fff;
  border: none;
  cursor: pointer;

  box-shadow: 0 0 0 2px #000, 3px 3px 0 0 #000;
  display: grid;
  place-items: center;

  flex-shrink: 0;
  transition: all 0.2s ease;
}


.corner-icon{
  width: 70%;
  height: 70%;
  display: block;
  image-rendering: pixelated;
}

.corner-btn:hover{
  transform: translate(-2px, -2px);
  box-shadow: 0 0 0 2px #000, 6px 6px 0 0 #000;
}

.corner-btn:active{
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 2px #000, 2px 2px 0 0 #000;
}

/* ===== Musik Modal ===== */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: grid;
  place-items: center;
  z-index: 99999;
}

.modal{
  width: min(360px, 92vw);
  background: #fff;
  box-shadow: 0 0 0 4px #7f7f7f, 8px 8px 0 0 #000;
  padding: 14px;
}

.modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-header h2{
  font-size: 18px;
  color: #333;
}

.modal-close{
  font-family: 'ChonkyBitsFontRegular', sans-serif;
  width: 38px;
  height: 38px;
  background: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 2px #000, 3px 3px 0 0 #000;
  transition: all 0.2s ease;
}

.modal-close:hover{
  transform: translate(-2px, -2px);
  box-shadow: 0 0 0 2px #000, 5px 5px 0 0 #000;
}

.modal-close:active{
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 2px #000, 2px 2px 0 0 #000;
}

.modal-body{
  display: grid;
  gap: 12px;
}

.modal-btn{
  font-family: 'ChonkyBitsFontRegular', sans-serif;
  padding: 10px 12px;
  background: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 2px #000, 3px 3px 0 0 #000;
  transition: all 0.2s ease;
}

.modal-btn:hover{
  transform: translate(-2px, -2px);
  box-shadow: 0 0 0 2px #000, 5px 5px 0 0 #000;
}

.modal-btn:active{
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 2px #000, 2px 2px 0 0 #000;
}

.volume-row{
  display: grid;
  gap: 6px;
  color: #333;
}

.volume-row label{
  font-size: 14px;
}

.volume-row input[type="range"]{
  width: 100%;
}
.music-selection {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.music-select {
    font-family: 'ChonkyBitsFontRegular', sans-serif;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    border: 2px solid #000;
    cursor: pointer;
    box-shadow: 0 0 0 2px #000, 3px 3px 0 0 #000;
    transition: all 0.2s ease;
}

.music-select:hover {
    transform: translate(-2px, -2px);
    box-shadow: 0 0 0 2px #000, 5px 5px 0 0 #000;
}

.music-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #000, 5px 5px 0 0 #000;
}

/* Range Slider Styling */
input[type="range"] {
    width: 100%;
    height: 8px;
    background: #ddd;
    border: 2px solid #000;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #000;
    cursor: pointer;
    box-shadow: 2px 2px 0 0 #000;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #000;
    cursor: pointer;
    box-shadow: 2px 2px 0 0 #000;
}