/* ABCPLAY · 31/multiplayer/base.css
 * 31: multiplayerens layout, kort, knapper og skærmstørrelser. Regler længere nede kan overstyre tidligere regler.
 * .navn vælger en CSS-klasse; #navn vælger et HTML-id.
 * @media tilpasser udseendet til bestemte skærmstørrelser.
 */

:root {
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  color: #f8f7ec;
  background: #102d25;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #256849, #102d25);
}
main {
  max-width: 1050px;
  margin: auto;
  padding: 18px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
header a {
  color: #f6d58c;
  text-decoration: none;
  font-weight: 700;
}
h1 {
  font-size: 34px;
  margin: 4px;
}
h1 span {
  font-size: 16px;
  color: #c6dbcd;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  background: #f4d38d;
  color: #163629;
  font-weight: 800;
  padding: 12px 17px;
  font-size: 15px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
#status {
  margin: 20px 0;
  background: #ffffff1c;
  border: 1px solid #ffffff24;
  padding: 14px;
  border-radius: 12px;
  min-height: 50px;
}
.opponents {
  display: flex;
  gap: 12px;
  justify-content: space-around;
  flex-wrap: wrap;
}
.opponent {
  background: #ffffff12;
  border: 1px solid #ffffff22;
  border-radius: 14px;
  padding: 13px;
  min-width: 130px;
  text-align: center;
}
.opponent strong {
  display: block;
  margin-bottom: 8px;
}
.backs {
  display: flex;
  justify-content: center;
}
.back {
  height: 65px;
  width: 45px;
  background: repeating-linear-gradient(45deg, #24538a 0 5px, #3b75b4 5px 10px);
  border: 4px solid #f5f1e7;
  border-radius: 5px;
  margin-left: -9px;
}
.back:first-child {
  margin-left: 0;
}
.center-table {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 35px 0;
}
.pile {
  height: 118px;
  width: 86px;
  padding: 5px;
  background: #ffffff15;
  border: 2px dashed #ffffff55;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.pile .card {
  width: 67px;
  height: 91px;
  pointer-events: none;
}
.pile:disabled {
  opacity: 0.65;
}
.your-area {
  border-top: 1px solid #ffffff40;
  padding-top: 15px;
}
.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hand-header h2 {
  margin: 5px 0 15px;
}
.hand {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 150px;
}
.card {
  height: 135px;
  width: 95px;
  border: 2px solid #ddd3bd;
  border-radius: 9px;
  background: linear-gradient(135deg, #fff, #f3eee1);
  color: #1d2d2b;
  box-shadow: 0 5px 12px #0005;
  position: relative;
  padding: 7px;
  font-weight: 900;
  font-size: 23px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}
.card.red {
  color: #c32f3d;
}
.card .suit {
  font-size: 48px;
  text-align: center;
  line-height: 1;
}
.card .bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}
button.card {
  padding: 7px;
}
.card:disabled {
  opacity: 1;
  cursor: default;
}
.card.selectable {
  outline: 3px solid #f4d38d;
  outline-offset: 2px;
}
.actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}
.rules {
  font-size: 13px;
  color: #c7dacc;
  line-height: 1.7;
  margin: 30px 0;
}
#results {
  background: #ffffff14;
  border-radius: 14px;
  padding: 18px;
  margin: 16px 0;
}
#results p {
  margin: 7px 0;
}
#overlay {
  position: fixed;
  inset: 0;
  background: #000b;
  display: grid;
  place-items: center;
  padding: 15px;
  z-index: 10;
}
#overlay[hidden] {
  display: none;
}
.dialog {
  background: #f9f6ea;
  color: #153629;
  padding: 28px;
  border-radius: 20px;
  width: min(100%, 420px);
  text-align: center;
}
.choices {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.choices button {
  background: #205e43;
  color: white;
}
#error {
  color: #b32a30;
} /* Tilpasning til skærmstørrelse eller skærmretning. */
@media (max-width: 600px) {
  main {
    padding: 10px;
  }
  h1 {
    font-size: 26px;
  }
  h1 span {
    font-size: 12px;
  }
  .center-table {
    margin: 20px 0;
    gap: 22px;
  }
  .opponent {
    min-width: 100px;
    padding: 8px;
    font-size: 12px;
  }
  .back {
    height: 50px;
    width: 35px;
  }
  .card {
    height: 116px;
    width: 81px;
    font-size: 20px;
  }
  .card .suit {
    font-size: 41px;
  }
  .hand {
    gap: 6px;
  }
  .rules {
    font-size: 12px;
  }
}

/* Keep cards and pile captions in separate rows. */
.center-table {
  gap: clamp(12px, 5vw, 32px);
  align-items: flex-start;
}
.pile {
  width: clamp(118px, 32vw, 166px);
  height: auto;
  min-height: 178px;
  padding: 12px 8px;
  gap: 12px;
  justify-content: flex-start;
  flex-shrink: 0;
  overflow: visible;
}
.pile .card {
  width: 82px;
  height: 112px;
  flex: 0 0 112px;
  padding: 6px;
  font-size: 20px;
}
.pile .card .suit {
  font-size: 37px;
}
.pile .card .bottom {
  font-size: 17px;
}
.pile .back {
  width: 76px;
  height: 105px;
  flex: 0 0 105px;
  margin: 0;
}
.pile-label {
  display: block;
  width: 100%;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: normal;
}
.card {
  overflow: hidden;
  isolation: isolate;
  flex-shrink: 0;
}
.card .corner {
  position: relative;
  z-index: 2;
  line-height: 1.05;
}
.card .corner small {
  display: block;
  font-size: 0.65em;
  line-height: 1.1;
}
.card .suit {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1;
  text-align: center;
  pointer-events: none;
}
.card .bottom {
  position: absolute;
  bottom: 7px;
  right: 7px;
  line-height: 1;
  z-index: 2;
}
.opponent .backs {
  gap: 4px;
  flex-wrap: nowrap;
}
.opponent .backs .card {
  width: clamp(38px, 6vw, 60px);
  height: clamp(57px, 9vw, 86px);
  font-size: 15px;
  padding: 4px;
  text-align: left;
}
.opponent .backs .card .suit {
  font-size: 24px;
}
.opponent .backs .card .bottom {
  font-size: 12px;
  bottom: 3px;
  right: 4px;
}
.opponent-score {
  font-weight: 800;
  margin-top: 8px;
  color: #f4d38d;
}
.result-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid #ffffff30;
  padding: 12px 0;
}
.result-cards {
  display: flex;
  gap: 7px;
}
.result-cards .card {
  width: 58px;
  height: 82px;
  font-size: 16px;
  padding: 4px;
}
.result-cards .card .suit {
  font-size: 28px;
}
.result-cards .card .bottom {
  font-size: 13px;
  bottom: 4px;
  right: 4px;
}
/* Tilpasning til skærmstørrelse eller skærmretning. */
@media (max-width: 600px) {
  .center-table {
    gap: 12px;
  }
  .pile {
    width: min(43vw, 155px);
    min-height: 164px;
    padding: 9px 5px;
  }
  .pile .card {
    width: 76px;
    height: 106px;
    flex-basis: 106px;
  }
  .pile .back {
    height: 98px;
    flex-basis: 98px;
    width: 72px;
  }
  .pile-label {
    font-size: 13px;
  }
  .opponent {
    flex: 1 1 100px;
    min-width: 0;
  }
  .opponent .backs .card {
    width: 38px;
    height: 59px;
    font-size: 13px;
  }
  .opponent .backs .card .suit {
    font-size: 19px;
  }
  .opponent .backs .card .bottom {
    font-size: 10px;
  }
}

/* Portrait and landscape mobile play */
/* Tilpasning til skærmstørrelse eller skærmretning. */
@media (max-width: 700px) {
  main {
    padding: clamp(8px, 2vw, 16px);
  }
  header {
    gap: 8px;
  }
  h1 {
    font-size: clamp(24px, 6vw, 34px);
  }
  .opponents {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(105px, 30%), 1fr));
    gap: 7px;
  }
  .opponent {
    min-width: 0;
    padding: 8px 4px;
  }
  .center-table {
    gap: clamp(10px, 4vw, 32px);
    margin: 18px auto;
    align-items: start;
  }
  .pile {
    width: clamp(112px, 34vw, 155px);
    height: auto;
    min-height: 154px;
    overflow: visible;
    white-space: normal;
    flex-shrink: 0;
  }
  .pile .card {
    flex-shrink: 0;
  }
  .hand {
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
  }
  .result-cards {
    flex-wrap: wrap;
  }
  button {
    touch-action: manipulation;
  }
}
/* Tilpasning til skærmstørrelse eller skærmretning. */
@media (max-width: 700px) and (orientation: landscape) {
  .opponents {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .center-table {
    margin: 10px auto;
    gap: 25px;
  }
  .pile {
    min-height: 128px;
    width: 140px;
  }
  .pile .card {
    height: 82px;
    width: 60px;
    flex-basis: 82px;
  }
  #status {
    margin: 10px 0;
    padding: 10px;
  }
}
