:root {
  --bg-dark: #0d3b66;
  --panel: #0a2c4d;
  --panel-border: rgba(255,255,255,0.10);
  --court-blue: #2d6fb7;
  --court-blue-light: #4f8fd6;
  --court-line: rgba(255,255,255,0.95);
  --text: #ffffff;
  --shadow: 0 12px 30px rgba(0,0,0,0.22);
  --player-a: #a9d0f2;
  --player-b: #ffffff;
  --selected: #ffe34f;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #114b84 0%, #0a3158 100%);
  color: var(--text);
}

body {
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr 220px;
}

.side-panel {
  background: var(--panel);
  padding: 18px 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
}

.left-panel {
  border-right: 1px solid var(--panel-border);
}

.right-panel {
  border-left: 1px solid var(--panel-border);
}

.right-panel h2 {
  margin: 0 0 20px 0;
  font-size: 32px;
  line-height: 1;
}

.logo-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
  min-height: 78px;
  overflow: hidden;
}

.logo-img {
  max-width: 120px;
  max-height: 60px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

#modo,
#sacador,
#mensagem,
.game-type-box {
  font-size: 16px;
  line-height: 1.35;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px 14px;
  font-weight: 700;
}

.game-type-box label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  letter-spacing: 0.4px;
}

.game-type-box select {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  background: #ffffff;
  color: #111;
  outline: none;
}

#mensagem {
  margin-bottom: 16px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
}

button {
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 17px;
  cursor: pointer;
  font-weight: 800;
}

#btnJogar {
  width: fit-content;
  min-width: 138px;
  background: #ffe34f;
  color: #111;
}

#btnReiniciar {
  width: fit-content;
  min-width: 138px;
  background: #7ad1ff;
  color: #111;
}

#btnLimpar,
#btnRegras {
  width: fit-content;
  min-width: 138px;
  background: #f3f3f3;
  color: #111;
}

.score-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 18px;
}

.score-line {
  font-size: 17px;
  line-height: 1.3;
}

.score-line span {
  display: inline-block;
  margin-top: 6px;
  font-size: 21px;
  font-weight: bold;
}

.center-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-width: 0;
}

.court-module {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
}

.zone-title {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.22);
}

.attack-title {
  margin-bottom: 4px;
}

.defense-title {
  margin-top: 4px;
}

.court-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.court {
  position: relative;
  height: min(76vh, 740px);
  aspect-ratio: 0.62 / 1;
  max-width: 100%;
  background: linear-gradient(180deg, var(--court-blue-light) 0%, var(--court-blue) 100%);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.court::before,
.court::after,
.court *::before,
.court *::after {
  content: none !important;
  display: none !important;
}

.court-doubles {
  position: absolute;
  left: 14%;
  top: 5%;
  width: 72%;
  height: 90%;
  border: 4px solid var(--court-line);
  background: transparent;
}

.court-singles {
  position: absolute;
  left: 23%;
  top: 5%;
  width: 54%;
  height: 90%;
  border-left: 4px solid var(--court-line);
  border-right: 4px solid var(--court-line);
  background: transparent;
}

.court-net {
  position: absolute;
  left: 14%;
  top: 50%;
  width: 72%;
  height: 4px;
  background: var(--court-line);
  transform: translateY(-50%);
}

.court-service-top {
  position: absolute;
  left: 23%;
  top: 27.5%;
  width: 54%;
  height: 4px;
  background: var(--court-line);
}

.court-service-bottom {
  position: absolute;
  left: 23%;
  top: 72.5%;
  width: 54%;
  height: 4px;
  background: var(--court-line);
}

.court-center-service {
  position: absolute;
  left: 50%;
  top: 27.5%;
  width: 4px;
  height: 45%;
  background: var(--court-line);
  transform: translateX(-50%);
}

.dice-zone {
  position: absolute;
  left: 15%;
  width: 70%;
  z-index: 5;
}

.attack-zone {
  top: 7%;
  height: 35%;
}

.defense-zone {
  bottom: 7%;
  height: 35%;
}

.sum-zone {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  min-width: 72px;
  text-align: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.30);
  border-radius: 999px;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(0,0,0,0.24);
  z-index: 6;
}

.attack-sum {
  top: 44%;
}

.defense-sum {
  top: 52%;
}

.dados,
.tr-board {
  position: relative;
  width: 100%;
  height: 100%;
}

.dado {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #111;
  color: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.dado.player-a {
  background: var(--player-a);
}

.dado.player-b {
  background: var(--player-b);
}

.selecionado {
  border: 4px solid var(--selected);
  box-shadow: 0 0 0 4px rgba(255,227,79,0.25);
}

.oculto-suave {
  opacity: 0.18;
}

.esgotado {
  opacity: 0.12;
  filter: grayscale(100%);
}

.inativo {
  opacity: 0.35;
}

.resultado-fixo {
  z-index: 8;
}

.defense-d12-slot {
  position: absolute;
  left: calc(50% + 125px);
  top: 62%;
  transform: translateY(-50%);
  width: 90px;
  height: 96px;
}

.d12-label {
  position: absolute;
  top: 0;
  left: 0;
  width: 90px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.22);
  letter-spacing: 0.5px;
  text-align: center;
}

#defenseD12Holder {
  position: absolute;
  top: 34px;
  left: 0;
  width: 90px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-line {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.result-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.result-box {
  margin-bottom: 18px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 220px 1fr 200px;
  }

  .right-panel h2 {
    font-size: 28px;
  }

  #modo,
  #sacador,
  #mensagem,
  .score-line,
  .game-type-box {
    font-size: 15px;
  }

  .zone-title {
    font-size: 20px;
  }

  .dado {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }

  .defense-d12-slot {
    left: calc(50% + 215px);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .side-panel {
    border: none;
    padding: 18px 16px;
  }

  .center-stage {
    padding: 10px 12px 18px 12px;
  }

  .court-module {
    gap: 8px;
  }

  .court {
    width: min(92vw, 430px);
    height: auto;
    aspect-ratio: 0.62 / 1;
  }

  .defense-d12-slot {
    position: static;
    transform: none;
    margin-top: 10px;
  }

  .button-group {
    flex-direction: row;
    flex-wrap: wrap;
  }

  #btnJogar,
  #btnReiniciar,
  #btnLimpar,
  #btnRegras {
    min-width: 122px;
  }

  .zone-title {
    font-size: 19px;
  }

  .dado {
    width: 50px;
    height: 50px;
    font-size: 21px;
  }

  .sum-zone {
    font-size: 26px;
  }
}

.tr-board {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 0;
  position: relative;
  height: 100%;
}

.tr-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.attack-board .tr-row,
.defense-board .tr-row {
  gap: 22px;
}

.tr-row-top {
  margin-top: 2px;
}

.tr-row-mid {
  margin-top: 10px;
}

.tr-row-bottom {
  margin-top: 14px;
}

.front-row {
  margin-top: 18px;
}

.back-from-net {
  margin-top: 16px;
}

.tr-row-top .dado:nth-child(1),
.tr-row-top .dado:nth-child(3) {
  transform: translateY(6px);
}

.tr-row-mid .dado {
  transform: translateY(0px);
}

.front-row .dado {
  transform: translateY(-2px);
}

.back-from-net .dado {
  transform: translateY(2px);
}

.floating-second-serve-d12 {
  position: relative;
  margin-top: 16px;
}