:root {
  --header-height: 60px;
  --column-min-width: 120px;
  --font-small: 1.4rem;
  --font-medium: 1.8rem;
  --font-big: 2.75rem;
}

* {
  box-sizing: border-box;
}

@font-face {
  font-family: "Roboto Mono";
  src: url("./fonts/RobotoMono-VariableFont_wght.ttf") format("truetype");
  font-weight: 700 900; /* only bold/black range */
  font-style: normal;
}

html,
body {
  height: 100%;
  width: 100%;
}

body {
  margin: 0;

  background: #2f2f2f;
  color: #fafafa;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Phenomena", sans-serif;
  font-weight: 900; /* base weight */
}

#homeView {
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#savedGamesList button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#gameView {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 10px;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: #1f1f1f;
  border: 2px solid #e74c3c;
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: min(420px, 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.overlay-content img {
  width: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #000;
}

.overlay-content p {
  margin: 0;
  text-align: center;
  font-size: var(--font-medium);
  font-weight: 900;
  color: #fafafa;
}

.overlay-content button {
  width: auto;
  padding: 8px 16px;
  margin-bottom: 16px;
}

.modal-content {
  background: #1f1f1f;
  border: 2px solid #e74c3c;
  border-radius: 13px;
  padding: 16px;
  width: min(320px, 90vw);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-content h2 {
  margin: 0;
  font-size: var(--font-medium);
}

.modal-content input {
  font-size: var(--font-small);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #2b2b2b;
  color: #fff;
}

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

.modal-actions button {
  width: auto;
  padding: 8px 16px;
}

.modal-actions .secondary {
  background: #555;
  outline: none;
}

/* Header (logo or image) */
.header {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
}

.header img {
  height: var(--header-height);
  width: var(--header-height);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  height: 100%;
}

.round-badge {
  height: var(--header-height);
  width: var(--header-height);
  border: 2px solid #e74c3c;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: var(--font-medium);
  font-weight: 700;
  color: #fafafa;
}

.round-badge.hidden {
  display: none;
}

.basePadding {
  padding: 10px 10px 0 10px;
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#leaderboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-column-gap: 10px;
  grid-row-gap: 5px;
}

#leaderboard p {
  margin-block-start: 0;
  margin-block-end: 0;
}

.input-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 10px 0 10px;
}

.leaderscore {
  border: 2px solid #e74c3c;
  border-radius: 13px;
  padding: 10px;
}

.leaderName {
  padding: 0;

  font-size: var(--font-medium);
}

.leaderScore {
  padding: 0;
}

.game-list button {
  display: flex;

  padding: 10px;
  border-radius: 13px;
  background-color: #e74c3c;
  color: white;
  align-items: center;
  font-size: var(--font-medium);
  width: 100%;
}

button {
  font-size: var(--font-medium);
  font-weight: 700;
  width: 50px;
  height: 50px;
  background: #e74c3c;
  border: none;
  border-radius: 13px;
  color: white;
  cursor: pointer;

  outline: 1px solid #fafafa;
  outline-offset: -3px;
}

button#addPlayerBtn {
  height: 100%;
  min-width: 60px;
}

#newGameBtn {
  border: none;
  cursor: pointer;
  border-radius: 13px;
  width: 100%;
  padding: 0px 20px;
  width: webkit-fill-available;
}

#startGame {
  padding: 0px 20px;
  opacity: 0.5;
  height: 100%;
  width: -webkit-fill-available;
}

.header-controls input {
  font-size: var(--font-medium);
  font-weight: 700;
  width: 180px;
  height: 100%;
  width: 100%;
  text-align: center;
  border: 2px solid #e74c3c;
  background-color: #e74c3c;
  border-radius: 13px;
  color: #fff;
  outline: none;
  display: none;

  outline: 1px solid #fafafa;
  outline-offset: -3px;
}

.player-column {
  border: 2px solid;
  display: flex;
  flex-direction: column;
  /* border-radius: 0 0 13px 13px; */
  border-radius: 13px;
  flex: 0 0 auto;
  min-width: 65px; /* for >5 players */
  margin-right: 10px;
  margin-right: 10px;

  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.player-column.selected {
  box-shadow: 0 0 2px 2px rgb(255, 255, 255);
}

.progress-wrap {
  height: 120px;
  display: flex;
  align-items: flex-end;
  box-sizing: border-box;
  overflow: hidden;
}

.progress-bar {
  width: 100%;
  height: 0;
  border-radius: 10px 10px 0 0;
  background: currentColor;
  transition: height 0.5s ease-in-out;
}

/* no gap after the very last column */
.game-container .player-column:last-child {
  margin-right: 0;
}

/* 1–5 players: each column gets an exact share of the width minus 10px gaps */
.game-container.columns-1 .player-column {
  flex: 0 0 calc((100% - 0px) / 1);
}
.game-container.columns-2 .player-column {
  flex: 0 0 calc((100% - 10px) / 2);
}
.game-container.columns-3 .player-column {
  flex: 0 0 calc((100% - 20px) / 3);
}
.game-container.columns-4 .player-column {
  flex: 0 0 calc((100% - 30px) / 4);
}
.game-container.columns-5 .player-column {
  flex: 0 0 calc((100% - 40px) / 5);
}
.game-container.columns-gt5 .player-column {
  flex: 0 0 65px;
}

.player-name {
  padding: 8px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-size: var(--font-big);
  font-weight: 900;
  color: white;
  /* border-radius: 13px 13px 0 0; */
}

.player-total {
  text-align: center;
  padding: 4px;
  font-size: var(--font-medium);
  font-weight: 700;
  border-bottom: 1px solid currentColor;
  color: white;
}

.scores {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.score-entry {
  padding: 1px 0 0 0;
  text-align: center;
  font-size: var(--font-small);
  font-weight: 700;
}

.scores-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow-x: auto;
}

.game-container {
  flex-grow: 1;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  overflow-x: auto;
  /* padding: 0 10px 10px 10px; */
  padding: 10px;
}

#gameContainer {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#gameContainer::-webkit-scrollbar {
  display: none;
}
