/* ==== CSS Variables ==== */
:root {
  --background-color-light: #555;
  --background-color-mid: #222;
  --background-color-dark: #111;
  --shadow-small: 0 2px 4px rgba(0, 0, 0, 0.6);
  --shadow-large: 0 4px 16px rgba(0, 0, 0, 0.6);
  --font-family: Arial, sans-serif;
  --font-size-small: 10px;
  --font-size-standard: 20px;
  --font-size-large: 24px;
  --font-size-title: 32px;
  --text-color-light: white;
  --text-color-mid: gray;
  --text-color-dark: black;
}

/* ==== Global Reset ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* outline: 1px red dashed; */
}

html, body {
  overflow: hidden;
  touch-action: manipulation;
}

/* ==== App Layout ==== */
body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background-color: var(--background-color-dark);
}

.app {
  width: 370px;
  max-width: 370px;
  height: 640px;
  max-height: 640px;
  position: relative;
  border-radius: 12px;
  box-shadow: var(--shadow-large);
  background-color: var(--background-color-mid);
  font-family: var(--font-family);
  font-size: var(--font-size-standard);
  color: var(--text-color-light);
  margin: 10px;
}

/* ==== Header ==== */
.header {
  width: 100%;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border-bottom: 2px solid var(--background-color-light);
}

.header-title {
  font-size: var(--font-size-title);
  text-shadow: var(--shadow-small);
}

/* ==== Main ==== */
.main {
  width: 100%;
  height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  text-align: center;
  padding-top: 15px;
}

#welcome-screen,
#players-screen,
#name-screen,
#mode-screen,
#game-screen,
#end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Input group styles */
.input-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.input-field label {
  display: block;
  text-align: center;
  margin-bottom: 5px;
}

.input-field input,
.input-field select {
  width: 200px;
  padding: 0 10px;
  height: 35px;
  border: none;
  border-radius: 5px;
  font-size: var(--font-size-standard);
  color: black;
  margin-bottom: 15px;
}

/* Common button styles */
.button, .keypad button {
  background-color: #ff9800;
  color: black;
  font-weight: bold;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: var(--shadow-small);
}

.button:hover, .keypad button:hover {
  background-color: #e68900;
}

/* Specific styles for general buttons */
.button {
  font-size: var(--font-size-standard);
  padding: 0 10px;
  height: 35px;

}

/* Specific styles for keypad buttons */
.keypad button {
  width: 60px;
  height: 60px;
  padding: 0;
  font-size: var(--font-size-large);
}

/* Keypad container styles */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  gap: 10px;
  justify-content: center;
  width: calc(60px * 3 + 10px * 2);
  margin: 0 auto 0 auto;
}

/* Keypad clear and submit button colors */
.keypad .clear {
  background-color: #d32f2f;
  font-size: 16px;
}

.keypad .clear:hover {
  background-color: #b71c1c;
}

.keypad .submit {
  background-color: #4caf50;
  font-size: 16px;
}

.keypad .submit:hover {
  background-color: #388e3c;
}

/* Scoreboard styles */
.scoreboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.scoreboard table {
  width: 350px;
  table-layout: fixed;
  border-collapse: collapse;
  margin-bottom: 15px;
}

.scoreboard th,
.scoreboard td {
  padding: 5px;
  border: 1px solid var(--background-color-light);
  font-size: var(--font-size-standard);
}

.scoreboard th {
  background-color: #1f1f1f;
}

/* Disable text selection on scoreboard to prevent double-tap zoom */
.scoreboard,
.scoreboard * {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ==== Footer ==== */
.footer {
  width: 100%;
  height: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  font-size: var(--font-size-small);
  color: var(--text-color-mid);
}

.footer-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
}

.footer a {
  color: var(--text-color-mid);
  text-decoration: none;
}

/* ==== Messages ==== */
#end-message {
  font-size: var(--font-size-standard);
  margin-bottom: 10px;
}