/* Ludo har sit eget bræt. Fælles navigation og annoncer kommer fra includes/site.php. */
:root {
  color-scheme: dark;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: #f6f5e9;
  background: #0c2821;
  --gold: #edcf8a;
  --red: #d84b51;
  --green: #298f72;
  --yellow: #e8b843;
  --blue: #497bd2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 55% 0, #225d47 0, transparent 65%), #0c2821;
  min-height: 100vh;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #f6d996;
  outline-offset: 4px;
}
a {
  color: var(--gold);
}
[hidden] {
  display: none !important;
}
.ludo-page {
  width: min(1160px, 100%);
  margin: auto;
  padding: 24px;
}
.ludo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  color: #f7f3df;
  text-decoration: none;
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -1px;
}
.brand span {
  color: var(--gold);
}
.ludo-header nav {
  display: flex;
  gap: 8px;
}
.ludo-header nav a {
  color: #bed3c6;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
}
.ludo-header nav a[aria-current] {
  background: #ffffff14;
  color: var(--gold);
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 38px 0 26px;
}
.intro h1 {
  font-family: Georgia, serif;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 500;
  letter-spacing: -1.7px;
  margin: 6px 0 12px;
}
.intro p {
  color: #c3d6c8;
}
.eyebrow {
  color: var(--gold) !important;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
}
.panel {
  background: #ffffff08;
  border: 1px solid #ffffff1c;
  border-radius: 20px;
  padding: 24px;
}
.setup {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: start;
  max-width: 950px;
  margin: 24px auto;
}
.setup h2 {
  font:
    30px Georgia,
    serif;
  margin: 8px 0 15px;
}
.setup p {
  color: #bfd3c6;
  line-height: 1.65;
  max-width: 340px;
}
form {
  display: grid;
  gap: 16px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #ccded1;
}
input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid #ffffff30;
  background: #12392e;
  color: #fff6e6;
  border-radius: 10px;
  padding: 12px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 12px;
}
.primary {
  background: var(--gold);
  color: #17372b;
}
.primary:hover:not(:disabled) {
  background: #ffe3a6;
}
.secondary {
  background: #38644f;
  color: #fff5df;
  border: 1px solid #ffffff30;
}
.quiet {
  color: #decda5;
  background: #ffffff09;
  border: 1px solid #ffffff20;
  font-size: 13px;
}
.join-form {
  grid-column: 1/-1;
  border-top: 1px solid #ffffff20;
  padding-top: 22px;
  grid-template-columns: 1fr 1fr;
  align-items: end;
}
.join-form h3 {
  grid-column: 1/-1;
  margin: 0;
  font-size: 17px;
}
#error {
  color: #ffd1c8;
  min-height: 20px;
  text-align: center;
}
.room-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 18px;
  font-size: 13px;
  color: #bfd1c3;
}
.room-bar #roomInfo {
  margin-right: auto;
}
.players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.player {
  --piece: var(--red);
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #ffffff1b;
  border-radius: 12px;
  padding: 11px 14px;
  background: #ffffff05;
  min-width: 0;
}
.player.active {
  border-color: var(--piece);
  box-shadow: inset 0 -2px var(--piece);
  background: #ffffff0c;
}
.player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--piece);
  flex: none;
  border: 2px solid #fff8;
}
.player strong {
  font-size: 13px;
  display: block;
  overflow-wrap: anywhere;
}
.player small {
  color: #bfd2c5;
  font-size: 11px;
}
.c0 {
  --piece: var(--red);
}
.c1 {
  --piece: var(--green);
}
.c2 {
  --piece: var(--yellow);
}
.c3 {
  --piece: var(--blue);
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 700px) minmax(235px, 1fr);
  align-items: start;
  gap: 26px;
}
.board-shell {
  min-width: 0;
}
.board {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  background: #e9e1ca;
  border: 9px solid #e9e1ca;
  border-radius: 20px;
  box-shadow: 0 12px 40px #0004;
  overflow: hidden;
  isolation: isolate;
}
.square {
  grid-column: var(--x);
  grid-row: var(--y);
  background: #fffaf0;
  border: 1px solid #c7c0ae;
  display: grid;
  place-items: center;
  color: #8c897c;
  font-size: clamp(10px, 1.5vw, 19px);
  border-radius: 3px;
}
.square.star {
  color: #917b42;
  background: #fff3c9;
}
.square.globe {
  color: #45745e;
  background: #e2efe6;
  font-weight: 900;
}
.square.start,
.square.goal-lane {
  background: color-mix(in srgb, var(--piece) 67%, white);
  color: #fff;
  border-color: color-mix(in srgb, var(--piece) 65%, #20372e);
}
.home {
  grid-column: var(--x) / span 6;
  grid-row: var(--y) / span 6;
  background: var(--piece);
  border-radius: 10px;
  opacity: 0.94;
  margin: 3px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 10px;
  gap: 3px;
}
.home strong {
  color: #fff;
  font-size: clamp(9px, 1.3vw, 15px);
  text-shadow: 0 1px 2px #0004;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home small {
  color: #fffd;
  font-size: clamp(8px, 1vw, 11px);
}
.home-pad {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff2;
}
.center {
  grid-column: 7 / span 3;
  grid-row: 7 / span 3;
  background: conic-gradient(
    from 45deg,
    var(--yellow) 0 25%,
    var(--blue) 0 50%,
    var(--red) 0 75%,
    var(--green) 0
  );
  border: 3px solid #e9e1ca;
  display: grid;
  place-items: center;
}
.center span {
  color: white;
  font-size: clamp(7px, 1.1vw, 12px);
  font-weight: 850;
  text-shadow: 0 1px 4px #0009;
}
.piece {
  position: absolute;
  width: 5.15%;
  height: 5.15%;
  left: calc(var(--px) * 100% / 15);
  top: calc(var(--py) * 100% / 15);
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  z-index: 4;
  border: 2px solid #fff;
  color: #fff;
  background: var(--piece);
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: clamp(9px, 1.3vw, 15px);
  box-shadow: 0 2px 3px #0006;
  transition:
    left 0.3s,
    top 0.3s;
  opacity: 1 !important;
}
.piece.c2 {
  color: #3a300c;
}
.piece:disabled {
  cursor: default;
}
.piece.playable {
  outline: 3px solid #183a2d;
  outline-offset: 2px;
  cursor: pointer;
  z-index: 6;
}
.piece.playable:focus-visible {
  outline-color: #ffea8c;
}
.board-caption {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 11px;
  color: #b2cbbb;
}
.game-controls {
  position: static;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.game-controls .eyebrow {
  margin: 0;
}
.die {
  width: 82px;
  height: 82px;
  margin: 4px auto;
  background: #fff7e3;
  border-radius: 18px;
  box-shadow: 0 7px 0 #0003;
  color: #234832;
  display: grid;
  place-items: center;
  font-size: 48px;
  line-height: 1;
  font-weight: 800;
}
.status {
  margin: 2px 0;
  min-height: 66px;
  font-size: 14px;
  line-height: 1.6;
  color: #e7eee0;
  overflow-wrap: anywhere;
}
.hint {
  margin: 0;
  color: #b9d0bf;
  font-size: 12px;
  line-height: 1.6;
}
.move-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.move-choices:empty {
  display: none;
}
.move-choices button {
  border: 1px solid #f1d58f66;
  background: #f1d58f12;
  color: var(--gold);
  font-size: 12px;
  padding: 12px 7px;
}
details {
  text-align: left;
  border-top: 1px solid #ffffff20;
  padding-top: 15px;
  color: #c4d6c8;
  font-size: 12px;
}
summary {
  cursor: pointer;
}
.history {
  padding-left: 18px;
  line-height: 1.7;
}
.history li {
  margin-top: 7px;
}
.lobby {
  margin-bottom: 20px;
}
.checkbox {
  display: flex;
  align-items: center;
  margin: 20px 0;
}
.checkbox input {
  width: 18px;
  height: 18px;
}
.rules-short {
  margin: 40px auto 0;
  max-width: 650px;
  text-align: center;
  color: #b3cbbc;
  line-height: 1.7;
}
.rules-short h2 {
  font:
    25px Georgia,
    serif;
  color: #e6d4ae;
}
dialog {
  width: min(600px, calc(100% - 24px));
  max-height: 85vh;
  border: 1px solid #6b886e;
  background: #173e31;
  color: #eff4e8;
  border-radius: 18px;
  padding: 24px;
  line-height: 1.7;
}
dialog::backdrop {
  background: #061c16bb;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dialog-heading h2 {
  font:
    26px Georgia,
    serif;
}
dialog li {
  margin: 12px 0;
}
@media (max-width: 800px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  .board-shell {
    width: 100%;
    max-width: 650px;
    margin: auto;
  }
  .game-controls {
    max-width: 650px;
    width: 100%;
    margin: auto;
  }
  .status {
    min-height: 0;
  }
  .piece {
    font-size: clamp(9px, 2.5vw, 15px);
  }
  .square {
    font-size: clamp(10px, 3vw, 20px);
  }
  .home strong {
    font-size: clamp(9px, 2vw, 15px);
  }
  .home small {
    font-size: clamp(8px, 1.7vw, 11px);
  }
  .game-controls .die {
    width: 68px;
    height: 68px;
    font-size: 40px;
  }
  .game-controls {
    gap: 12px;
    padding: 18px;
  }
}
@media (max-width: 540px) {
  .ludo-page {
    padding: 16px 10px;
  }
  .brand {
    font-size: 21px;
  }
  .ludo-header {
    gap: 12px;
  }
  .ludo-header nav a {
    padding: 8px 9px;
    font-size: 12px;
  }
  .intro {
    margin: 24px 0 18px;
    align-items: flex-start;
  }
  .intro h1 {
    font-size: 34px;
    letter-spacing: -1px;
  }
  .intro p:not(.eyebrow) {
    font-size: 13px;
  }
  .intro > button {
    font-size: 11px;
    padding: 10px;
  }
  .setup {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px;
  }
  .setup h2 {
    font-size: 26px;
  }
  .setup p {
    margin-bottom: 0;
  }
  .join-form {
    grid-template-columns: 1fr;
  }
  .players {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .player {
    padding: 9px;
    gap: 7px;
  }
  .player strong {
    font-size: 12px;
  }
  .board {
    border-width: 5px;
    border-radius: 13px;
  }
  .home {
    padding: 6px;
    margin: 1px;
  }
  .piece {
    border-width: 1.5px;
    width: 5.5%;
    height: 5.5%;
  }
  .piece.playable {
    outline-width: 2px;
    outline-offset: 1px;
  }
  .board-caption {
    font-size: 10px;
    gap: 12px;
  }
  .rules-short {
    padding: 0 12px;
    font-size: 12px;
  }
  .room-bar button {
    font-size: 11px;
    padding: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .piece {
    transition: none;
  }
}

/* Når spillet er startet, får brættet plads frem for en stor velkomstoverskrift. */
#error:empty {
  display: none;
}
body.is-playing .intro {
  margin: 18px 0;
}
body.is-playing .intro h1 {
  font-size: 32px;
  margin: 0;
  letter-spacing: -0.7px;
}
body.is-playing .intro p {
  display: none;
}
body.is-playing .room-bar {
  margin-bottom: 12px;
}
@media (max-width: 800px) {
  .game-controls {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    text-align: left;
    gap: 10px 14px;
  }
  .game-controls #turnLabel {
    grid-column: 1/-1;
  }
  .game-controls .die {
    grid-column: 1;
    grid-row: 2 / span 2;
    width: 60px;
    height: 60px;
    font-size: 38px;
  }
  .game-controls #status,
  .game-controls #roll {
    grid-column: 2;
  }
  .game-controls #moveChoices,
  .game-controls #turnHint,
  .game-controls details,
  .game-controls #newGame {
    grid-column: 1/-1;
  }
}

/* Terningens prikker tegnes med CSS, så de ikke afhænger af en emoji-skrifttype. */
.die.number-die {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  padding: 16px;
}
.die .pip {
  width: 100%;
  height: 100%;
  background: #244b36;
  border-radius: 50%;
}
@media (max-width: 800px) {
  .die.number-die {
    gap: 4px;
    padding: 11px;
  }
}
