html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100vw;
  font-family: sans-serif;
  background: #222;
  box-sizing: border-box;
  overflow: hidden;
}

#game-container {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  /* Mobil böngésző címsor kezelése */
  height: 100vh; /* fallback */
  height: 100dvh; /* modern böngészők */
  height: calc(var(--vh, 1vh) * 100); /* JS alapú viewport */
  overflow: hidden;
}

.player-panel {
  background: #1eaaf1;
  color: white;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  transition: transform 0.4s;
  padding: 6px 0 0 0;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.player-header {
  position: relative;
  width: 100%;
  margin-bottom: 0.4em;
  height: 2em;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.starter-indicator {
  position: absolute;
  left: 7px;
  top: 5px;
  font-size: 0.85em;
  color: gold;
  display: none;
  z-index: 3;
  background: transparent;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.starter-indicator:active {
  transform: scale(1.3);
}
.starter-indicator.active {
  display: inline !important;
}

.player-name-container {
  width: 100%;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 99vw;
}
.player-title,
.player-name-edit {
  font-size: 1.15em;
  outline: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  text-align: center;
  min-width: 6em;
  max-width: 17em;
  overflow-x: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.3em;
  box-sizing: border-box;
}
.player-title:focus {
  background: #fff5;
  border-radius: 0.2em;
}
.player-name-edit {
  border: 1px solid #1271b2;
  border-radius: 0.2em;
  padding: 0.05em 0.2em;
  background: white;
  color: #155689;
}

.score-group {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100vw;
  min-height: 0;
  box-sizing: border-box;
}
.score-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  max-width: 98vw;
  margin: 0 auto;
}
.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 75px;
  width: 32vw;
  max-width: 30vw;
  box-sizing: border-box;
}
.score-label {
  display: flex;
  font-size: 1em;
  margin-bottom: 0.08em;
  font-weight: 700;
  max-width: 100%;
  text-align: center;
}
.score-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.18em;
  margin-bottom: 0.05em;
  width: 100%;
}
.big-score {
  font-size: 3em;
  font-weight: bold;
  min-width: 1em;
  text-align: center;
  margin: 0 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  height: 1.5em;
}

.btn {
  background: #155689;
  color: white;
  border: none;
  border-radius: 0.6em;
  padding: 0.12em 0.5em;
  font-size: 1.3em;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 36px;
  min-height: 36px;
  max-height: 40px;
  box-sizing: border-box;
}
.btn:active {
  background: #1271b2;
}
.max-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.08em;
  font-size: 0.88em;
  justify-content: center;
  width: 100%;
}
.max-score {
  font-size: 0.95em;
  font-weight: bold;
  padding: 0 2px;
  min-width: 1.1em;
  text-align: center;
  box-sizing: border-box;
}
.max-label {
  display: flex;
  font-size: 0.8em;
  color: #ddf7;
  margin-left: 2px;
  text-align: center;
}

.panel-action-bar {
  width: 100%;
  flex-shrink: 0;
  min-height: 50px;
  max-height: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #1eaaf1;
  color: white;
  font-size: 1em;
  box-sizing: border-box;
  padding: 2px 0 3px 0;
}
.turn-ind {
  font-weight: bold;
  font-size: 1.3em;
  margin-bottom: 2px;
}
.current-turn {
  width: 100%;
  text-align: center;
  font-size: 1.05em;
  font-weight: bold;
  margin-bottom: 1px;
  margin-top: 2px;
  letter-spacing: 0.01em;
}

#divider {
  background: #111;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

/* PORTRAIT */
@media (orientation: portrait) {
  #game-container {
    flex-direction: column;
  }
  #player2-panel {
    transform: rotate(180deg);
  }
  #player1-panel {
    transform: none;
  }
  .player-panel {
    width: 100vw;
    height: auto;
  }
  .score-row {
    flex-direction: row;
    gap: 0.18em;
    width: 98vw;
    max-width: 98vw;
  }
  .score-block {
    width: 31vw;
    max-width: 30%;
    min-width: 75px;
    justify-content: center;
  }
  #divider {
    width: 100vw;
    height: 3px;
    min-height: 3px;
    max-height: 3px;
  }
}

/* LANDSCAPE */
@media (orientation: landscape) {
  #game-container {
    flex-direction: row;
  }
  
  #player2-panel,
  #player1-panel {
    transform: none;
    width: 50vw;
    height: 100%;
  }
  
  #divider {
    width: 3px;
    min-width: 3px;
    max-width: 3px;
    height: 100%;
  }
  
  .score-row {
    flex-direction: column;
    max-width: 45vw;
    margin: 0 auto;
    align-items: center;
    justify-content: space-around;
  }
  .score-block {
    width: 88vw;
    min-width: 75px;
    max-width: 45vw;
    justify-content: center;
  }
}

/* nagyon kis kijelzők */
@media (max-width: 400px) {
  .score-block {
    max-width: 86px;
    min-width: 62px;
    width: 28vw;
  }
  .btn,
  .max-score,
  .player-title,
  .player-name-edit {
    font-size: 0.95em;
  }
  .big-score {
    font-size: 1.5em;
  }
  .turn-ind {
    font-size: 1.2em;
  }
  .current-turn {
    font-size: 0.98em;
  }
}