:root {
  color-scheme: light;
  --btn-size: clamp(3.5rem, 12vmin, 6rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  overscroll-behavior: none;
}

.view {
  height: 100dvh;
  width: 100vw;
}

.hidden {
  display: none !important;
}

/* --- Scoreboard --- */

#scoreboard-view {
  display: flex;
  flex-direction: row;
  position: relative;
}

.panel {
  flex: 1 1 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.panel-a {
  background: #ffffff;
  color: #000000;
}

.panel-b {
  background: #000000;
  color: #ffffff;
}

.points {
  font-size: clamp(6rem, 30vmin, 16rem);
  font-weight: 700;
  line-height: 1;
  user-select: none;
}

.team-name {
  font-size: clamp(1.1rem, 4vmin, 2rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  text-align: center;
  max-width: 90%;
  overflow-wrap: break-word;
}

.stepper {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-a .stepper {
  left: 0.75rem;
}

.panel-b .stepper {
  right: 0.75rem;
}

.stepper-btn {
  width: var(--btn-size);
  height: var(--btn-size);
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: calc(var(--btn-size) * 0.45);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.stepper-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.stepper-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.menu-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 2px solid #808080;
  background: #808080;
  color: #fff;
  font-size: 1.25rem;
  z-index: 10;
  cursor: pointer;
}

/* --- Menu / New Game / History views --- */

#menu-view,
#new-game-view,
#history-view,
#end-game-confirm-view {
  width: 100%;
  max-width: 32rem;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #fafafa;
  color: #111;
  overflow-y: auto;
}

#menu-view button,
#new-game-view button,
#history-view button,
#end-game-confirm-view button {
  font-size: 1.1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
}

#end-game-summary {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  padding: 1rem 0;
}

#new-game-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#new-game-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
}

#new-game-form input {
  font-size: 1.1rem;
  padding: 0.6rem;
  border-radius: 0.4rem;
  border: 1px solid #999;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#history-list li {
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #fff;
}

/* --- Clear confirm dialog --- */

#clear-confirm-dialog {
  border: none;
  border-radius: 0.75rem;
  padding: 1.5rem;
  max-width: 90vw;
  width: 24rem;
}

#clear-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.dialog-actions button {
  font-size: 1rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #999;
  cursor: pointer;
}

.dialog-actions .danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
