body {
  font-family: Arial, sans-serif;
  background: #0b5d3b;
  color: white;
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

.app {
  height: 100vh;
  padding: 10px;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: 65px 1fr;
  gap: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 14px;
  border-radius: 12px;
}

.topbar h1 {
  font-size: 22px;
  margin: 0;
}

.table-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 10px;
  grid-template-areas:
    "infoCurrent top infoTotal"
    "left center right"
    ". bottom .";
}

.player,
.center-table,
.info-box {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.player {
  background: rgba(255, 255, 255, 0.14);
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 10px;
  text-align: center;
  transition: 0.2s;
  overflow: hidden;
}

.player.active {
  border-color: #ffd700;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.85);
  background: rgba(255, 255, 255, 0.28);
}

.player h2,
.player .player-info {
  display: inline;
}

.player h2 {
  margin: 0 10px 6px 0;
  font-size: 22px;
}

.player-info {
  font-size: 16px;
  opacity: 0.8;
}

.player-info::before {
  content: "– ";
}

.player-top {
  grid-area: top;
}

.player-left {
  grid-area: left;
}

.player-right {
  grid-area: right;
}

.player-bottom {
  grid-area: bottom;
}

.info-current {
  grid-area: infoCurrent;
}

.info-total {
  grid-area: infoTotal;
}

.info-box {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 16px;
  padding: 10px;
  overflow: hidden;
}

.info-box h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

#status,
#score {
  background: rgba(255, 255, 255, 0.16);
  padding: 8px 12px;
  border-radius: 10px;
}

.center-table {
  grid-area: center;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 22px;
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.center-table h2 {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  z-index: 2;
}

#table {
  position: absolute;
  inset: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas:
    ". p2 ."
    "p1 . p3"
    ". p0 .";
  justify-items: center;
  align-items: center;
  box-sizing: border-box;
}

.table-card-player-0 {
  grid-area: p0;
  transform: translateY(-30px);
}

.table-card-player-1 {
  grid-area: p1;
}

.table-card-player-2 {
  grid-area: p2;
  transform: translateY(30px);
}

.table-card-player-3 {
  grid-area: p3;
}

.player-hand {

  margin-top: 6px;

  display: grid;

  grid-template-columns: repeat(6, auto);

  grid-auto-rows: auto;

  justify-content: center;

  align-content: start;

  gap: 8px;

  overflow: hidden;
}

.karte,
.played-card {
  width: clamp(34px, 4vw, 58px);
  aspect-ratio: 2 / 3;
  background: white;
  color: black;
  border: 2px solid #222;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.35);
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  display: block;
}

.karte {
  cursor: pointer;
  transition: 0.2s;
}

.karte:hover {
  transform: translateY(-4px) scale(1.03);
}

.karte:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.karten-ecke {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 13px;
  height: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.karten-symbol {
  width: 13px;
  height: 13px;
  object-fit: contain;
  display: block;
}

.karten-wert-mitte {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 1vw, 16px);
  font-weight: bold;
  text-align: center;
  line-height: 1;
  padding-top: 4px;
  box-sizing: border-box;
  word-break: break-word;
}

.verdeckt {
  background: #1d3557;
  color: white;
}

.karten-ruecken {
  height: 100%;
  font-size: clamp(14px, 2vw, 24px);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ausgewaehlt {
  transform: translateY(-10px);
  border-color: #ffd700;
  box-shadow:
    0 0 12px rgba(255,215,0,0.9),
    0 4px 8px rgba(0,0,0,0.35);
}

#play-button {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2;
}

.ai-suggestion {
  margin-top: 2px;
  margin-bottom: 4px;
  line-height: 1.1;
  font-size: 11px;
  color: #ffe082;
}

#table-message {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.82);
  color: white;
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: bold;
  text-align: center;
  display: none;
  z-index: 5;
  max-width: 90%;
}

.trumpfwahl-spieler {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  min-height: 34px;
}

.trumpf-title {
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 2px;
}

.trumpf-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  background: white;
  transition: 0.2s;
}

.trumpf-btn:hover {
  background: #ffe082;
}

.trumpf-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.schieben-btn-infield {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  color: white;
  background: rgba(30, 30, 30, 0.75);
  transition: 0.2s;
}

.schieben-btn-infield:hover {
  background: rgba(10, 10, 10, 0.9);
}

.table-message-text {

  margin-bottom: 12px;

  line-height: 1.4;
}

#message-ok-button {

  padding: 6px 14px;

  border: none;
  border-radius: 8px;

  cursor: pointer;

  font-weight: bold;

  background: #ffd700;

  color: black;

  transition: 0.2s;
}

#message-ok-button:hover {

  background: #ffec80;
}

.ai-suggestion {

  margin-top: 2px;

  margin-bottom: 2px;

  padding: 0;

  line-height: 1.05;

  font-size: 11px;

  font-weight: normal;

  color: #ffe082;

  min-height: 0;
}

.ai-suggestion div {

  margin: 0;
  
  padding: 0;
}

.ai-suggestion strong {
  font-weight: normal;
}

/* =========================
   MOBILE LAYOUT
========================= */

@media (max-width: 900px) {

  .center-table {
    order: 1;

    height: 300px;
    min-height: 300px;
    max-height: 300px;

    flex: 0 0 300px;
  }

  .player-bottom {
    order: 2;
  }

  .player-left {
    order: 3;
  }

  .player-top {
    order: 4;
  }

  .player-right {
    order: 5;
  }

  .info-current {
    order: 6;
  }

  .info-total {
    order: 7;
  }

  body {
    overflow-y: auto;
    height: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;

    padding: 4px;
    gap: 4px;

    display: flex;
    flex-direction: column;
  }

  .topbar {
    padding: 6px 8px;
    border-radius: 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .topbar h1 {
    font-size: 16px;
  }

  .table-layout {

    display: flex;
    flex-direction: column;

    gap: 6px;

    height: auto;
  }

  .center-table {
    min-height: 320px;
    height: 320px;
  }

  .center-table h2 {
    font-size: 20px;
  }

  #table {
    inset: 32px 8px 48px 8px;
  }

  #play-button {
    bottom: 8px;
    font-size: 14px;
    padding: 8px 14px;
    z-index: 20;
  }

  #table-message {
    font-size: 14px;
    padding: 10px 12px;
    max-width: 85%;
  }

  .table-message-text {
    font-size: 14px;
    line-height: 1.2;
  }

  #message-ok-button {
    font-size: 13px;
    padding: 6px 12px;
  }
  
  .info-box,
  .player,
  .center-table {

    width: 100%;

    min-height: auto;

    height: auto;
  }

  .player {

    padding: 6px;

    border-radius: 12px;
  }

  .player h2 {
    font-size: 18px;
  }

  .player-info {
    font-size: 12px;
  }

  .info-box {

    padding: 6px;

    border-radius: 12px;
  }

  .info-box h2 {
    font-size: 15px;
  }

  #status,
  #score {

    font-size: 12px;

    padding: 6px 8px;
  }

  .center-table {

    min-height: 220px;

    border-radius: 14px;

    padding: 6px;
  }

  .player-hand {

    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    gap: 4px;

    margin-top: 4px;
  }

  .karte,
  .played-card {

    width: 42px;

    border-radius: 8px;

    padding: 2px;

    border-width: 1px;
  }

  .karten-ecke {

    top: 2px;
    right: 2px;

    width: 10px;
    height: 10px;
  }

  .karten-symbol {

    width: 10px;
    height: 10px;
  }

  .karten-wert-mitte {

    font-size: 10px;

    padding-top: 2px;
  }

  .trumpfwahl-spieler {

    gap: 4px;

    margin-top: 4px;
  }

  .trumpf-btn,
  .schieben-btn-infield {

    font-size: 10px;

    padding: 4px 6px;

    border-radius: 6px;
  }

  .trumpf-icon {

    width: 14px;
    height: 14px;
  }

  #play-button {

    font-size: 11px;

    padding: 4px 8px;
  }

  .ai-suggestion {

    font-size: 10px;
  }
}