/* ── PALETTE ── */
:root {
  --lightgreen:  #7D9B9D;
  --darkgreen:   #60828B;
  --lightblue:   #4976AD;
  --darkblue:    #2B588F;
  --lightyellow: #F0B450;
  --darkyellow:  #C38A3E;
  --lightred:    #A75740;
  --darkred:     #803019;
  --lightbrown:  #E6CFAA;
  --brown:       #C7A67A;
  --darkbrown:   #A18054;
  --black:       #1E1610;

  --board-bg:      #F1E3CA;
  --board-border:  #8B6C48;
  --cell-bg:       #fff5d5;
  --grain-color:   rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Inria Serif', serif;
  background-color: var(--lightbrown);
  background-image:
    radial-gradient(circle, var(--grain-color) 1px, transparent 1px),
    radial-gradient(circle, rgba(0,0,0,0.035) 1px, transparent 1px);
  background-size: 24px 24px, 12px 12px;
  background-blend-mode: overlay;
  color: var(--darkbrown);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

body::before{
  content:'';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='black' filter='url(%23noise)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 999997;
  display: block;
}

/* ══════════════════════════════════════
   START SCREEN
══════════════════════════════════════ */
#start-screen {
  height: 100vh;
  min-height: 780px;
  width: 100vw;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 6rem 2rem calc(120px + 1.5rem);
  animation: fadeIn 0.8s ease;
  position: relative;
  overflow: hidden;
}

.start-header {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  gap: 0.75rem;
  width: 100%; max-width: 1400px;
  z-index: 25;
  background: transparent;
  border-bottom: 2px solid var(--darkbrown);
}

.logo a img{
  width: 120px; height: auto;
}

.header-actions { 
  display: flex; gap: 0.4rem; 
}

.game-icon-description img {
  width: 100px; height: auto;
  display: block;
} 

@media (max-width: 480px) {
  .game-icon-description img {
    display: none;
  } 

  .mobile--hidden {
    display: none;
  }
}

.icon-btn {
  background: var(--brown);
  border: 2px solid var(--darkbrown);
  border-radius: 6px;
  color: var(--black);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.18s;
}

.icon-btn:hover { 
  border-color: var(--black); 
  color: var(--black);
  background-color: var(--darkbrown);
  filter: brightness(1.08); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 16px rgba(240,180,80,0.25);
}

.h1 {
  font-size: clamp(2.2rem,6vw,3.8rem);
  font-weight: 700;
  color: var(--lightyellow);
  text-shadow: 0 2px 20px rgba(193,160,90,0.4);
}

.full-card {
  display: flex; 
  flex-direction: column;
  align-items: center; 
  justify-content: center;  
  width: 100%;
  position: absolute;
}

@media (max-height: 870px) {
  .full-card {
    bottom: 144px;
    left: 0;
    right: 0;
  }
}

@media (min-width: 400px) {
  .full-card {
    padding: 2rem 2rem;
  }
}

.logo-indent img{
  width: 400px; height: auto;
  margin-bottom: -100px;
  position: relative;
  z-index: 3;
}

.start-card {
  background: var(--brown);
  border: 4px solid var(--darkbrown);
  padding: 2rem 2.5rem;
  width: 100%; max-width: 500px;
  height: 475px;
  position: relative;
  z-index: 1;
}

.card-content{
margin-top: 80px;
}

.player-row {
  display: flex; 
  align-items: center; 
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.p-dot {
  width: 28px; 
  height: 28px; 
  border-radius: 50%; 
  flex-shrink: 0;
}

.p-dot.blue   { 
  background: var(--lightblue); 
  border: 3px solid var(--darkblue);
}

.p-dot.yellow { 
  background: var(--lightyellow); 
  border: 3px solid var(--darkyellow);
}

.player-row input {
  flex: 1;
  background: var(--lightbrown);
  border: 3px solid var(--darkbrown);
  border-radius: 6px;
  color: var(--black);
  font-family: inherit;
  font-size: 1.3rem;
  padding:0.8rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}

@media (max-width: 480px) {
  .p-dot {
    width: 20px; 
    height: 20px; 
    border-radius: 100%; 
    flex-shrink: 0;
  }

  .player-row input {
    flex: 1;
    font-size: 1rem;
    padding: 0.5rem 0.8rem;
  }

  .player-row {
    display: flex; 
    align-items: center; 
    gap: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
  }
}

.player-row input:focus { 
  border-color: var(--black);
  color: var(--black);
}

.player-row input::placeholder { 
  color: var(--darkbrown); 
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.8rem 1.6rem;
  border-radius: 7px;
  border: none; cursor: pointer;
  transition: all 0.18s;
  background: var(--brown);
  border: 2px solid var(--darkbrown);
  border-radius: 6px;
  color: var(--black);
  cursor: pointer;
}

.btn:hover { 
  border-color: var(--black); 
  color: var(--black);
  background-color: var(--darkbrown);
  filter: brightness(1.08); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 16px rgba(240,180,80,0.25);
}

.btn-primary {
  background: var(--lightbrown);
  color: var(--black);
  width: 100%; 
  margin-top: 1rem;
  font-size: 1.1rem;
  border: 3px solid var(--darkbrown);
  flex-wrap: nowrap;
}
.btn-primary:hover { 
  filter: brightness(1.08); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 16px rgba(240,180,80,0.25); 
}

.btn-primary:active { 
  transform: translateY(0); 
}

.btn-ghost {
  background: rgba(255,245,210,0.08);
  border: 3px solid var(--darkbrown);
  color: var(--black);
  font-size: 1.1rem; 
  flex-wrap: nowrap;
  width: 100%; margin-top: 1rem;
}

.btn-ghost:hover { 
  border-color: var(--black); 
  color: var(--black);
  background-color: var(--darkbrown);
  filter: brightness(1.08); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 16px rgba(240,180,80,0.25);
}

.start-actions {
  display: flex; 
  flex-direction: row;
  justify-content: space-evenly; 
  gap: 0.75rem;
  margin-top: 4rem;
}

@media (max-width: 480px) {
  .start-actions {
    display: flex; 
    flex-direction: column-reverse;
    gap: 0.1rem;
    margin-top: 0;
  }
}

.floor{
  width: 100%; height: 120px;
  background: #CEB792;
  position: absolute; bottom: 0; left: 0;
  padding-bottom: calc(120px + 1.5rem)
}

@media (max-height: 780px) {
  .floor {
    z-index: -2;
  }
}

@media (max-width: 480px) {
  .floor {
    display: none;
  }
}

.art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* @media (max-height: 780px) {
  .art {
    z-index: -1;
  }
} */

.art-img {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.art-img img {
  display: block;
  object-fit: contain;
}

/* Individual element sizing (customize width/height here) */
.art-img .cactus {
  width: 400px;
  height: auto;
}

.art-img .schilderij {
  width: 300px;
  height: auto;
}

.art-img .kaarten {
  width: 200px;
  height: auto;
}

.art-img .steen-big {
  width: 280px;
  height: auto;
}

.art-img .steen-medium {
  width: 180px;
  height: auto;
}

.art-img .steen-small {
  width: 130px;
  height: auto;
}

.art-img .farao {
  width: 380px;
  height: auto;
}

.art-img .water {
  width: 500px;
  height: auto;
}

/* Positioning for each element */
.art-img:nth-child(1) { /* cactus */
  bottom: -40px;
  left: -120px;
}

.art-img:nth-child(2) { /* schilderij */
  top: 148px;
  left: 130px;
}

.art-img:nth-child(3) { /* kaarten */
  bottom: 0px;
  left: 200px;
}

.art-img:nth-child(4) { /* steen-big 1 */
  bottom: 40px;
  left: 320px;
}

.art-img:nth-child(5) { /* steen-big 2 */
  bottom: 40px;
  right: 320px;
}

.art-img:nth-child(6) { /* steen-medium */
  bottom: 45px;
  right: -50px;
}

.art-img:nth-child(7) { /* steen-small */
  bottom: 0px;
  right: 620px;
}

.art-img:nth-child(8) { /* farao */
  bottom: -20px;
  right: 40px;
}

.art-img:nth-child(9) { /* water 1 */
  bottom: 80px;
  left: -50px;
  z-index: -1;
}

.art-img:nth-child(10) { /* water 2 */
  bottom: 80px;
  right: -50px;
  z-index: -1;
}

/* _______________________________________ */

@media (max-width: 1320px) {
  .art-img .cactus {
    width: 480px;
    height: auto;
    position: relative;
    z-index: 2;
  }

  .art-img:nth-child(1) { /* cactus */
    bottom: -40px;
    left: -60px;
  }
}

@media (max-width: 1150px) {
  .art-img .cactus {
    display: none;
  }
}

@media (max-width: 1320px) {
  .art-img .schilderij {
    display: none;
  }
}

/* @media (max-height: 710px) {
  .art-img .schilderij {
    display: none;
  }
} */

@media (max-width: 1320px) {
  .art-img .kaarten {
    display: none;
  }
}

@media (max-width: 1320px) {
  .art-img .steen-big {
    width: 280px;
    height: auto;
  }

  .art-img:nth-child(4) { /* steen-big 1 */
    bottom: 40px;
    left: 170px;
  }

  .art-img:nth-child(5) { /* steen-big 2 */
    bottom: 40px;
    right: 170px;
  }
}

@media (max-width: 800px) {
  .art-img .steen-big {
   display: none;
  }
}

@media (max-width: 1320px) {
  .art-img .steen-medium {
    display: none;
  }
}

@media (max-width: 1320px) {
  .art-img .steen-small {
    display: none;
  }
}

@media (max-width: 1320px) {
  .art-img .farao {
    width: 380px;
    height: auto;
  }

  .art-img:nth-child(8) { /* farao */
    bottom: -20px;
    right: -40px;
  }
}

@media (max-width: 1150px) {
  .art-img .farao {
    display: none;
  }
}

@media (max-width: 1320px) {
  .art-img .water {
    width: 500px;
    height: auto;
  }

  .art-img:nth-child(9) { /* water 1 */
    bottom: 80px;
    left: -200px;
    z-index: -1;
  }

  .art-img:nth-child(10) { /* water 2 */
    bottom: 80px;
    right: -200px;
    z-index: -1;
  }
}

@media (max-width: 800px) {
  .art-img .water {
    display: none;
  }
}

/* ══════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════ */
#game-screen {
  display: none;
  min-height: 100vh;
  padding: 0.85rem 1rem;
  animation: fadeIn 0.4s ease;
  flex-direction: column;
}
#game-screen.visible { display: flex; }

.game-body {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(420px, 1fr) minmax(260px, 320px);
  gap: 1rem;
  width: min(100%, 1400px);
  margin: 1rem auto 0;
  align-items: center;
  justify-content: center;
}

.side-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-column {
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (max-width: 980px) {
  .game-body {
    grid-template-columns: 1fr;
  }
  .board-column {
    order: -1;
  }
  .side-panel {
    order: 1;
    flex-wrap: wrap;
    flex-direction: row;
  }
  .right-panel {
    order: 3;
  }

  .score-block {
    order: -1;
    width: 100%;
  }
}

@media (min-width: 981px) {
  .game-body {
    align-items: stretch;
  }
  .side-panel {
    justify-content: space-between;
  }
  .log-area {
    flex: 1;
    min-height: 0;
  }
}

/* header */
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--darkbrown);
}
.game-title {
  font-size: 1.15rem; letter-spacing: 0.2em;
  color: var(--darkbrown); font-weight: 700;
}

/* score bar */
.score-bar {
  display: flex;
  gap: 0.6rem;
  justify-content: space-evenly; 
  align-items: center;
}
.score-player {
  background: var(--brown);
  border: 4px solid var(--darkbrown);
  padding: 0.65rem 0.9rem;
  display: flex; 
  align-items: center; 
  gap: 0.75rem;
  transition: all 0.25s;
  width: 100%;
  height: 14%;
  justify-content: center;
}

.score-player.active-turn {
  border-color: var(--black);
}

.score-player.p2 { 
  flex-direction: row-reverse; 
}

.s-name {
  font-size: 0.78rem; 
  color: var(--black);
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
  opacity: 0.85;
}

.score-player.p2 .s-val { 
  margin-left: 0; 
  margin-right: auto; 
}

.s-dot {
  width: 12px; 
  height: 12px; 
  border-radius: 100%; 
  flex-shrink: 0;
}

.s-dot.blue   { 
  background: var(--lightblue); 
}

.s-dot.yellow { 
  background: var(--lightyellow); 
}

.s-name {
  display: none;
}
.s-val {
  font-size: 2.2rem; 
  font-weight: 700;
  color: var(--black); 
  margin-left: auto;
}

.score-player.p2 .s-val { 
  margin-left: 0; 
  margin-right: auto; 
}

.score-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 24px;
  font-size: 1rem;
  font-weight: bold;
}
.score-player.blue-player .score-tag {
  background: #2B588F;
  color: #6794CB;
  border: 3px solid #6794CB;
}
.score-player.yellow-player .score-tag {
  background: #C38A3E;
  color: #F0B450;
  border: 3px solid #F0B450;
}
.score-tag.blue-tag {
  background: #2B588F;
  color: #6794CB;
  border: 3px solid #6794CB;
  padding: 0 0;
  margin-left: 5px;
  margin-right: 5px;
}
.score-tag.yellow-tag {
  background: #C38A3E;
  color: #F0B450;
  border: 3px solid #F0B450;
  padding: 0 0;
  margin-left: 5px;
  margin-right: 5px;
}

/* ── HAND AREA ── */
.hands-area {
  display: grid; 
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.hand-panel {
  background: var(--brown);
  border: 4px solid var(--darkbrown);
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 43%;
}
.hand-panel.active-blue {
  border-color: var(--lightblue);
}
.hand-panel.active-yellow {
  border-color: var(--lightyellow);
}
.hand-label {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--black);
  background-color: var(--darkbrown);
  border: 3px solid #8D6C40;
  writing-mode: sideways-lr;
  padding: 1rem 0.7rem;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-left: -3px;
  margin-top: -3px;
  margin-bottom: -3px;
}
.hand-panel.active-blue .hand-label {
  background-color: var(--lightblue);
  border: 3px solid var(--darkblue);
}
.hand-panel.active-yellow .hand-label {
  background-color: var(--lightyellow);
  border: 3px solid var(--darkyellow);
}
.hand-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
  align-content: center;
  margin: 0.8rem;
}

@media (max-width: 480px) {
  .book-content {
    padding: 1.5rem 1rem !important;
  }

  .kaarten-in-regels {
    flex-wrap: wrap;
  }

  .kaarten-in-regels img {
    width: 22% !important;
  }

  .hand-cards {
    gap: 0;
    margin: 0.4rem;
  }

  .hand-panel {
    display: flex;
    flex-direction: column;
  }

  .hand-label {
    writing-mode: unset;
    padding: 5px;
  }
}

@media (max-width: 980px) {
  .hand-panel {
    width: calc(50% - 5px);
  }
}


@media (max-width: 980px) {
  .hand-panel {
    width: calc(50% - 5px);
  }
}

/* mini-card (in hand) */
.mini-card {
  width: 100%; 
  aspect-ratio: 1;
  border-radius: 0;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: grab;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  flex-shrink: 0;
}
.mini-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.mini-card.selected {
  transform: translateY(-5px) scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  z-index: 10;
}
.mini-card.used {
  opacity: 0.2;
  pointer-events: none;
  cursor: default;
}
.mini-card:not(.used):not(.selected):hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 10px rgba(240,180,80,0.3);
}
.mini-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

/* drag ghost */
#drag-ghost {
  position: fixed;
  width: 52px; height: 52px;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
  z-index: 9999;
  display: none;
  transform: translate(-50%, -50%);
  border: 2.5px solid var(--lightyellow);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#drag-ghost img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ── BOARD ── */
.board-wrapper {
  display: flex; justify-content: center; align-items: center;
  width: 100%;
}

.board-grid {
  width: 100%;
  max-width: calc(680px + 32px);
}

.board-labels-top {
  display: grid;
  grid-template-columns: 32px repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.board-body {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: stretch;
}

.board-labels-left {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
}

.board-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lightbrown);
  border: 2px solid var(--darkbrown);
  color: var(--black);
  font-size: 1.2rem;
  font-weight: 900;
  text-transform: uppercase;
  min-width: 32px;
  min-height: 32px;
  padding: 0.25rem;
}

.mega-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  width: min(100%, 680px);
  max-width: 680px;
  aspect-ratio: 1;
}

.sub-board {
  background: #f6e5c4;
  border: 4px solid var(--brown);
  border-radius: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
  position: relative;
  aspect-ratio: 1;
  box-shadow: inset 0 0 0 1px rgba(139,108,74,0.15);
}

.sub-board.active-board {
  border-color: var(--darkbrown);
  box-shadow: inset 0 0 0 1px rgba(139,108,74,0.45), 0 0 16px rgba(139,108,74,0.14);
  transform: translateY(-1px);
}
.sub-board.inactive-board {
  opacity: 0.8;
  background: rgba(139,108,74,0.4);
  border-color: rgba(139,108,74,0.6);
}
.cell.no-play {
  cursor: not-allowed;
  opacity: 0.75;
  background: rgba(255,255,255,0.72);
}

.sub-board-label {
  position: absolute;
  top: -11px; left: 50%; transform: translateX(-50%);
  font-size: 0.52rem; letter-spacing: 0.1em;
  color: var(--darkbrown);
  background: var(--lightbrown);
  padding: 0 5px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s;
  text-transform: uppercase;
}
.sub-board.active-board .sub-board-label { opacity: 1; }

/* cells */
.cell {
  aspect-ratio: 1;
  border-radius: 0;
  background: #fff5d6;
  border: 1px solid rgba(147,108,64,0.35);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.2s;
  overflow: hidden;
  min-height: 0;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.cell.drop-hover {
  background: rgba(240,180,80,0.25) !important;
  border-color: var(--lightyellow) !important;
  transform: scale(1.05);
}
.cell:hover:not(.filled):not(.no-play) {
  background: rgba(240,180,80,0.15);
  border-color: rgba(240,180,80,0.5);
}
.cell.filled { cursor: default; }
.cell.no-play { cursor: not-allowed; opacity: 0.7; }
.cell img {
  width: 90%; height: 90%;
  object-fit: cover;
  border-radius: 0;
  display: block;
  pointer-events: none;
}

/* scoring outline */
.cell.scoring-outline {
  box-shadow: 0 0 0 3px var(--lightyellow), 0 0 12px rgba(240,180,80,0.6);
  z-index: 2;
  animation: outlinePulse 1.8s ease forwards;
}
@keyframes outlinePulse {
  0%   { box-shadow: 0 0 0 3px var(--darkbrown), 0 0 12px rgba(139,108,74,0.9); }
  60%  { box-shadow: 0 0 0 3px var(--darkbrown), 0 0 18px rgba(139,108,74,0.4); }
  100% { box-shadow: 0 0 0 2px var(--darkyellow), 0 0 4px rgba(139,108,74,0.1); }
}

/* log */
.log-area {
  background: var(--brown);
  border: 5px solid var(--darkbrown);
  padding: 1rem 1.1rem;
  font-size: 1rem;
  color: var(--black);
  line-height: 1.75;
  white-space: pre-wrap;
  min-height: 320px;
  overflow-y: auto;
}
.log-area hr {
  border: none;
  height: 2px;
  background: var(--darkbrown);
  margin: 0.5rem 0;
}

/* Player name colors in log */
.blue { color: var(--darkblue); }
.yellow { color: var(--darkyellow); }


/* ══════════════════════════════════════
   MODALS
══════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 999998;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }

.rules-modal {
  background: var(--brown);
  border-radius: 16px;
  width: 100%; max-width: 800px;
  max-height: 92vh;
  position: relative;
}

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

.modal::before{
  content:'';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 999999;
  display: block;
  border-radius: 16px;
}

.modal h2 {
  font-size: 1.5rem;
  color: var(--darkbrown); margin-bottom: 1rem;
}
.modal h3 {
  font-size: 0.92rem;
  color: var(--darkbrown); margin: 1rem 0 0.35rem;
  border-bottom: 1px solid var(--darkbrown); padding-bottom: 0.2rem;
}
.modal p{
  font-size: 1rem; color: var(--darkbrown);
  line-height: 1.75; margin-bottom: 0.45rem;
}

.modal .rule-image {
  width: 100%; height: auto;
  display: block;
  margin: 1rem 0;
  border-radius: 0;
}

/* ══════════════════════════════════════
    RULES MODAL – SIMPELE BLADERBOEK
══════════════════════════════════════ */
.rules-book {
    width: 100%;
    background: #F4E9D8;
    border: 12px solid var(--darkbrown);
    border-radius: 16px;
    position: relative;
}

.book-header {
    background: var(--lightbrown);
    padding: 1.5rem 2rem;
    border-top-right-radius: 4px;
    border-top-left-radius: 4px;
    border-bottom: 3px solid #8B6C48;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 700;
}

.book-content {
    padding: 2.5rem 3rem;
    min-height: 520px;
    font-size: 1.15rem;
    line-height: 1.7;
}
.book-content img { max-width: 100%; margin: 1rem 0;}

.book-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: #EFD9B8;
    border-top: 4px solid #8B6C48;
}
.page-counter {
    font-weight: 700;
    color: var(--darkbrown);
}

@media (max-width: 670px) {
  .page-count {
    display: none;
  }

  .rules-bladeren{
    display: none;
  }

  .close-short{
    display: block;
    font-family: inherit;
  }

  .close-long{
    display: none;
  }

  .book-header .btn{
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}

@media (min-width: 670px) {
  .close-short{
    display: none;
  }

  .close-long{
    display: block;
  }
}

.kaarten-in-regels, .borden-in-regels{
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

.kaarten-in-regels img{
  width: 15%; height: auto;
  flex-wrap: wrap;
}

.borden-in-regels img{
  width: 24%; height: auto;
  flex-wrap: wrap;
}

/* WIN */
.win-title {
  font-size: 2.3rem;
  color: var(--black);
  text-align: center;
  margin-bottom: 2rem;
}

.win-card {
  background: var(--brown);
  border: 4px solid var(--darkbrown);
  padding: 2rem 2.5rem;
  width: 100%; max-width: 500px;
  height: 475px;
  position: relative;
  z-index: 1;
}

.win-card .score-player {
  background-color: var(--lightbrown);
}

.card-content{
  margin-top: 80px;
}

.win-actions {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  gap: 0.75rem;
  margin-top: 4rem;
  text-wrap: nowrap;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--darkbrown);
  border: 1.5px solid var(--black);
  border-radius: 7px;
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
  color: #fff;
  z-index: 1000001; opacity: 0;
  transition: all 0.25s; pointer-events: none; white-space: nowrap;
  max-width: calc(100vw - 3rem);
  overflow-wrap: break-word;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); animation: fadeIn 0.18s ease forwards; }

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