:root {
  --red-main: #b22222;
  --red-dark: #8b0000;
  --red-hover: #ff4444;
  --text-light: #ffdcdc;
  --bg-overlay: rgba(0, 0, 0, 0.85);
  --font-main: 'Anton', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Global box-sizing for consistency */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem;
  min-height: 100vh;
  font-family: var(--font-main);
  background: url("https://static.vecteezy.com/system/resources/previews/023/847/064/non_2x/red-boxing-ring-in-an-empty-arena-with-ai-generated-free-photo.jpg") no-repeat center center fixed;
  background-size: cover;
  color: var(--red-main);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

.session-settings {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-overlay);
  border: 3px solid var(--red-main);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  width: 90%;
  max-width: 700px;
  min-width: 300px;
  box-shadow: 0 0 15px var(--red-main);
  text-align: center;
  box-sizing: border-box;
  margin: 0 auto;
}

#back-to-stance-btn {
  all: unset;
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-family: var(--font-main);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--red-main);
  cursor: pointer;
  user-select: none;
  transition: text-decoration 0.2s ease, color 0.2s ease;
}

#back-to-stance-btn:hover {
  text-decoration: underline;
  color: var(--red-hover);
}

h1 {
  font-weight: 700;
  margin-bottom: 1.5rem;
  font-size: 2.4rem;
}

/* Stance buttons container */
.stance-selection-container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  margin-bottom: 2rem;
}

/* Stance buttons */
.stance-button {
  flex: 1 1 45%;
  font-size: 2rem;
  padding: 1.2rem;
  border-radius: 12px;
  background-color: var(--red-dark);
  color: white;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 5px 15px rgba(139, 0, 0, 0.7);
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-align: center;
  white-space: nowrap;
  min-width: 140px;
  box-sizing: border-box;
}

.stance-button:hover {
  background-color: var(--red-main);
  transform: scale(1.05);
}

.stance-button.selected {
  background-color: var(--red-main);
  box-shadow: 0 0 20px 3px var(--red-main);
  transform: scale(1.1);
}

.stance-button small {
  font-weight: 400;
  font-size: 0.75rem;
  display: block;
  margin-top: 0.3rem;
  color: var(--text-light);
}

/* General buttons (except back) */
button:not(#back-to-stance-btn) {
  font-family: var(--font-main);
  font-size: 1.8rem;
  padding: 1rem 1.5rem;
  border-radius: 14px;
  background-color: var(--red-dark);
  color: white;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  border: none;
  box-shadow: 0 5px 15px rgba(139, 0, 0, 0.7);
  transition: background-color 0.3s ease, transform 0.2s ease;
  width: 100%;
  max-width: 320px;
  text-align: center;
  white-space: normal;
  box-sizing: border-box;
}

button:not(#back-to-stance-btn):hover:not(:disabled) {
  background-color: var(--red-main);
  transform: scale(1.05);
}

button:not(#back-to-stance-btn):disabled {
  background-color: #cc9999;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  color: #5a1a1a;
}

/* Timer control buttons */
#timer-controls .top-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

#start-timer-btn,
#stop-timer-btn {
  max-width: 140px;
}

#generate-combo-btn {
  max-width: 320px;
}

/* Settings section */
.settings-group {
  width: 100%;
  max-width: 320px;   /* limit width */
  margin: 0 auto 1.5rem; /* center and spacing */
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.settings-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--red-main);
  width: 100%;
  text-align: center;
}

.settings-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  text-align: center;
  gap: 1rem;
  max-width: 320px;  /* limit width */
  margin: 0 auto;    /* center horizontally */
  font-weight: 600;
  color: var(--red-main);
}

.settings-row > input[type="number"],
.settings-row > div {
  flex: 0 1 auto;  /* prevent stretching too much */
  max-width: 100px;
  text-align: center;
  margin: 0 auto;
}

input[type="number"] {
  width: 65px;
  padding: 0.35rem;
  font-family: inherit;
  font-size: 1.2rem;
  border: 2px solid var(--red-main);
  border-radius: 8px;
  text-align: center;
  background-color: #111;
  color: var(--red-main);
  transition: border-color 0.3s;
  margin: 0;
  display: inline-block;
  margin-right: 0.2rem;
}

input[type="number"]:focus {
  border-color: var(--red-hover);
  outline: none;
}

/* Timer display */
#timer-display {
  font-size: 4rem;
  font-weight: 900;
  color: var(--red-main);
  margin-bottom: 2rem;
  user-select: none;
}

/* Phase title */
#phase-title {
  margin-bottom: 0.8rem;
  font-weight: 700;
}

/* Combo display */
#combo-display {
  font-size: 1.3rem;
  background: #111;
  padding: 1.2rem 1.5rem;
  border-radius: 14px;
  border: 2px solid var(--red-dark);
  box-shadow: inset 0 0 10px rgba(178, 34, 34, 0.67);
  word-break: break-word;
  min-height: 3.5rem;
  margin-bottom: 1.5rem;
  user-select: text;
  color: var(--red-main);
  line-height: 1.3;
  overflow-wrap: break-word;
}

/* Responsive */
@media (max-width: 510px) {
  body {
    padding: 1rem 0.5rem;
  }

  .session-settings {
    max-width: 100%;
    padding: 1.5rem 1rem;
  }

  .stance-selection-container {
    flex-direction: column;
    gap: 1rem;
  }

  .stance-button,
  button:not(#back-to-stance-btn) {
    font-size: 1.5rem;
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    margin: 0.75rem 0;
    white-space: normal;
  }

  #timer-display {
    font-size: 3rem;
  }

  #combo-display {
    font-size: 1rem;
    min-height: 3rem;
  }

  input[type="number"] {
    width: 50px;
    font-size: 1rem;
  }
}

/* ===== Opening/About Page ===== */
.opening-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-overlay);
  border: 3px solid var(--red-main);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  width: 90%;
  max-width: 700px;
  min-width: 300px;
  box-shadow: 0 0 15px var(--red-main);
  text-align: center;
  box-sizing: border-box;
  margin: 0 auto;
  animation: fadeIn 0.8s ease-in;
}

.opening-screen .app-title {
  font-size: 2.6rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  color: var(--red-main);
  text-shadow: 0 0 10px rgba(178, 34, 34, 0.7);
}

.about-content {
  max-width: 600px;
  line-height: 1.6;
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 2rem;
  text-align: center;
}

#enter-app-btn {
  font-family: var(--font-main);
  font-size: 1.8rem;
  padding: 1rem 1.5rem;
  border-radius: 14px;
  background-color: var(--red-dark);
  color: white;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  border: none;
  box-shadow: 0 5px 15px rgba(139, 0, 0, 0.7);
  transition: background-color 0.3s ease, transform 0.2s ease;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-sizing: border-box;
}

#enter-app-btn:hover {
  background-color: var(--red-main);
  transform: scale(1.05);
}

a {
  color: var(--red-main); /* main red */
  text-decoration: underline;
  font-weight: 700;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--red-hover); /* brighter red on hover */
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
