/* =========================================================
   BASIS
   ========================================================= */

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

* {
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.app {
  min-height: 100vh;
  padding: 10px;
  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;
  white-space: nowrap;
}

.help-link {
  margin-left: auto;
  color: #ffd700;
  text-decoration: none;
  font-weight: bold;
  padding: 6px 10px;
}

.help-link:hover {
  text-decoration: underline;
}

.topbar-button {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.22);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.controller-config-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
}

.controller-config-dialog {
  width: min(94vw, 680px);
  max-height: 94vh;
  overflow-y: auto;
  padding: 20px;
  border: 3px solid #ffd700;
  border-radius: 16px;
  background: #0b5d3b;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.controller-config-dialog h2 {
  margin-top: 0;
}

.controller-config-row {
  display: grid;
  grid-template-columns: 90px minmax(120px, 1fr) minmax(180px, 1.5fr);
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.controller-config-row input,
.controller-config-row select {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  font: inherit;
}

.controller-config-hinweis {
  color: #fff6a8;
  font-size: 13px;
}

.controller-config-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.controller-config-actions button {
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* =========================================================
   GEMEINSAME KARTENKLASSEN
   ========================================================= */

.kartenbild {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kartenbild-tisch {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.karte {
  transform: var(--card-transform, none);
  z-index: var(--card-z-index, 1);
}

.karte:hover,
.karte:focus-visible {
  transform: var(--card-hover-transform, var(--card-transform, none));
  z-index: 100;
}

.kartenflug {
  pointer-events: none;
  z-index: 300;
  contain: layout paint style;
  will-change: transform;
  transition: transform 260ms cubic-bezier(.22, .8, .3, 1);
}

@media (prefers-reduced-motion: reduce) {
  .kartenflug,
  .karte {
    transition-duration: 0.01ms !important;
  }
}

/* Gewinnende Weise: genau eine kompakte Kartenzeile je Teamspieler. */
#table-message.weis-message {
  box-sizing: border-box;
  width: min(94vw, 720px);
  max-width: 720px;
  min-height: 0;
  padding: clamp(10px, 2vw, 18px);
  flex-direction: column;
  align-items: stretch;
}

#table-message.weis-message #message-ok-button {
  display: block;
  align-self: center;
}

body #table-message.team-message.team-0-message {
  border: 3px solid #8dffae;
  box-shadow: 0 0 0 3px rgba(141, 255, 174, 0.2),
    0 10px 28px rgba(0, 0, 0, 0.42);
}

body #table-message.team-message.team-1-message {
  border: 3px solid #ff9c9c;
  box-shadow: 0 0 0 3px rgba(255, 156, 156, 0.18),
    0 10px 28px rgba(0, 0, 0, 0.48);
}

.meldungs-kommentar {
  display: block;
  width: min(100%, 360px);
  min-height: 52px;
  margin: 8px auto 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  font: inherit;
  font-size: 11px;
  resize: vertical;
}

#play-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.weis-meldung {
  width: 100%;
  display: grid;
  gap: 10px;
}

.weis-titel,
.weis-total {
  font-weight: 800;
}

.weis-titel {
  color: #fff6a8;
  font-size: clamp(14px, 3.5vw, 20px);
}

.weis-zeile {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(58px, auto) minmax(0, 1fr);
  align-items: center;
  gap: clamp(5px, 1.5vw, 12px);
  padding: 6px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}

.weis-spieler {
  max-width: 105px;
  overflow: hidden;
  color: #d8ffd8;
  font-size: clamp(9px, 2.2vw, 12px);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weis-kartenzeile {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weis-karte {
  width: 0;
  min-width: 0;
  max-width: 58px;
  height: auto;
  flex: 1 1 0;
  object-fit: contain;
}

.weis-gruppenabstand {
  flex: 0 0 clamp(5px, 1.5vw, 12px);
}

.weis-leer {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-style: italic;
}

.weis-total {
  font-size: clamp(12px, 3vw, 16px);
}

.stoeck-meldung {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 100%;
}

.stoeck-titel {
  color: #fff6a8;
  font-size: clamp(16px, 3.8vw, 22px);
}

.stoeck-karten {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.stoeck-karte {
  width: clamp(46px, 12vw, 72px);
  height: auto;
}

.trumpf-status-anzeige,
.trumpf-slalom-symbolgruppe {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.trumpf-status-anzeige {
  gap: 4px;
}

.trumpf-status-symbol {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.trumpf-slalom-symbolgruppe {
  gap: 2px;
}

.trumpf-bestaetigungs-symbol {
  display: flex;
  justify-content: center;
  margin-bottom: 7px;
}

.trumpf-bestaetigungs-symbol .trumpf-status-symbol {
  width: 58px;
  height: 58px;
}

.trumpf-bestaetigungs-symbol .trumpf-slalom-symbolgruppe {
  gap: 8px;
}

.rundenende-titel {
  display: inline-block;
  margin-bottom: 7px;
  font-size: clamp(16px, 4vw, 21px);
  line-height: 1.15;
}

.runden-team {
  display: inline-block;
  margin-top: 5px;
  font-size: clamp(14px, 3.4vw, 18px);
  line-height: 1.15;
}

.runden-team-0 {
  color: #8dffae;
}

.runden-team-1 {
  color: #ff9c9c;
}

.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;
  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;
}

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

#mobile-game-info,
#mobile-opponents {
  display: none;
}


/* =========================================================
   Tisch
   ========================================================= */

#table-area {
    position: relative;
    width: 100%;
    height: 100%;
}

.ai-suggestion-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border: 1px solid rgba(140, 255, 140, 0.7);
  border-radius: 8px;
  background: rgba(8, 42, 31, 0.94);
  color: #d8ffd8;
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.ai-suggestion-toggle strong {
  color: white;
  font-weight: bold;
}

.ai-suggestion-toggle:focus-visible {
  outline: 2px solid #ffd700;
  outline-offset: 2px;
}

.ai-suggestion-details {
  display: none;
  padding: 12px 14px;
  border: 1px solid rgba(140, 255, 140, 0.75);
  border-radius: 10px;
  background: rgba(5, 31, 24, 0.97);
  color: #f3fff3;
  text-align: left;
  text-shadow: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.ai-suggestion:hover .ai-suggestion-details,
.ai-suggestion.is-open .ai-suggestion-details {
  display: block;
}

.ai-suggestion-details > strong {
  display: block;
  margin-bottom: 7px;
  color: #8cff8c;
  font-weight: bold;
}

.ai-suggestion-details ul {
  margin: 0;
  padding-left: 18px;
}

.ai-suggestion-details li + li {
  margin-top: 5px;
}
