/* inter-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/inter-v20-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* inter-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/inter-v20-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* inter-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('../fonts/inter-v20-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* playfair-display-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/playfair-display-v40-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* playfair-display-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/playfair-display-v40-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* playfair-display-900 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 900;
  src: url('../fonts/playfair-display-v40-latin-900.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* indie-flower-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Indie Flower';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/indie-flower-v24-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

:root {
  --white: #ffffff;
  /* Primary Colors */
  --felt: #2a2a2a;
  --felt-dark: #1a1a1a;
  --card: #e8e6e1;
  --card-border: #b8b5b0;
  --divider: #2a2a2a;
  /* Accent Colors */
  --red: #c74545;
  --gold: #d4884d;
  --gold-light: #e5a877;
  --blue: #4a7db5;
  --blue-dark: #3a6d9f;
  --ink: #3a3a3a;
  --ink-soft: rgba(255, 255, 255, 0.85);
  --ink-soft-dark: #5a5a5a;
  --block-bg: #f0ede8;
  --block-border: #d8d5d0;
  --green: #4a9d6f;
  /* Variations */
  --green-dark: #2a7d4f;
  --green-light: #6abd8f;
  --caramel-dark: #c47a40;
  --caramel-light: #dea577;
  --copper-light: #d99a5a;
  /* Layout */
  --max-content-width: 520px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--felt);
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(255,255,255,0.03) 0%, transparent 60%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.1) 10px, rgba(0,0,0,0.1) 11px);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  padding: 0;
  color: var(--ink-soft);
}

header { text-align: center; margin-bottom: 24px; }
header > a {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
  line-height: 1;
}
header p {
  color: var(--ink-soft);
  font-size: 0.75rem;
  margin-top: 5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}
.suit-row {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 8px; font-size: 1.3rem; opacity: 0.7;
}
.suit-row span:nth-child(2), .suit-row span:nth-child(4) { color: var(--red); }

.team-setup {
  display: grid;
  grid-template-columns: 1fr 4px 1fr;
  max-width: var(--max-content-width);
  margin: 0 auto 20px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
}

.team-setup.sticky {
  background: var(--felt);
}

.team-name-label {
  color: var(--ink-soft);
  font-family: "Indie Flower", cursive;
  font-size: 1.7rem;
  font-weight: 400;
  text-align: center;
  padding: 9px 12px;
}

.scorecard {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.05) inset;
  max-width: var(--max-content-width);
  margin: 0 auto;
  color: var(--ink);
}

.scorecard-grid {
  width: 100%;
  clip-path: inset(0 0 0 0 round 10px);
}

.grid-row {
  display: grid;
  grid-template-columns: 6.5% 21.5625% 21.5625% 0.75% 21.5625% 21.5625% 6.5%;
  width: 100%;
}

.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-row {
  display: grid;
  grid-template-columns: 6.5% 21.5625% 21.5625% 0.75% 21.5625% 21.5625% 6.5%;
  background: #d8d5d0;
  color: var(--ink-soft-dark);
  font-family: 'Playfair Display', serif;
  position: sticky;
  top: 64px;
  z-index: 9;
  padding: 4px 0;
}

.header-label {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft-dark);
}

.grid-row.round {
  border-bottom: 1px solid var(--card-border);
  min-height: 60px;
}

.grid-row.round:hover {
  background: rgba(212, 136, 77, 0.05);
}

.play-col {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  min-height: 42px;
}

.circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: transparent;
}

.play-col.active .circle {
  background: var(--green);
  border-color: var(--green);
}

.score-cell {
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-family: "Indie Flower", cursive;
  font-size: 2.5rem;
  color: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.roem-cell {
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-family: "Indie Flower", cursive;
  font-size: 1.75rem;
  color: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.score-cell:hover, .roem-cell:hover {
  background: rgba(212, 136, 77, 0.08);
}

.score-cell.nat {
  color: var(--red);
  text-decoration: line-through;
}

.score-cell.pit {
  color: var(--red);
}

.roem-cell.nat {
  color: var(--red);
  text-decoration: line-through;
}

.divider-col {
  background: #d0cdc8;
  position: relative;
}

.header-row .divider-col {
  background: none;
}

.round-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d0cdc8;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.difference-col {
  font-family: "Indie Flower", cursive;
  font-size: 1.5rem;
  opacity: 0.3;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-row.block-total {
  background: var(--block-bg);
  border-bottom: 1px solid var(--card-border);
  height: 38px;
}

.grid-row.block-total .score-cell {
  text-align: center;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: #2a2a2a;
  cursor: default;
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-row.block-total .roem-cell {
  text-align: center;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a2a2a;
  cursor: default;
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-row.cumulative {
  background: #d8d5d0;
  border-bottom: 1px solid rgba(58,58,58,0.1);
  min-height: 66px;
  height: 58px;
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 6.5% 16.5625% 21.5625% 10% 21.5625% 16.5625% 6.5%;
  align-items: center;
}

.cum-cell {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a4a4a;
  min-height: 44px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cum-cell.total {
  font-family: "Indie Flower", cursive;
  font-size: 3em;
  font-weight: 400;
  text-align: center;
  height: 68px;
  grid-column: span 2;
}

.cum-cell.winning {
  color: var(--green);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #3a3a3a;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  transform: scale(0.9) translateY(-20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.stats-modal-header {
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 20px;
  letter-spacing: 0.04em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-modal-header i {
  color: var(--gold-light);
}

.modal-title {
  display: flex;
  justify-content: space-around;
  align-items: center;
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 20px;
  letter-spacing: 0.04em;
  flex: none;
  gap: 12px;
  text-align: center;
}

.modal-title > div:nth-child(1),
.modal-title > div:nth-child(2) {
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--gold-light);
}

.modal-display {
  text-align: center;
  color: var(--gold-light);
  font-family: "Indie Flower", cursive;
  font-size: 4em;
  margin-bottom: 16px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.roem-keypad {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.roem-keypad.active {
  display: grid;
}

.keypad-btn {
  background: #d0cdc8;
  border: 1px solid #c8c5c0;
  color: #2a2a2a;
  font-size: 1.2rem;
  font-weight: 600;
  padding: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Inter', sans-serif;
}

.keypad-btn:hover {
  background: #c8c5c0;
  border-color: #b8b5b0;
}

.keypad-btn.action {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
  grid-column: span 1;
}

.keypad-btn.action:hover {
  background: var(--copper-light);
  border-color: var(--red);
}

.keypad-btn.backspace-btn {
  background: var(--caramel-dark);
  border-color: var(--caramel-dark);
  color: var(--white);
}

.keypad-btn.backspace-btn:hover {
  background: var(--caramel-light);
  border-color: var(--caramel-dark);
}

.enter-btn {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Inter', sans-serif;
}

.enter-btn:hover {
  background: var(--green-light);
  border-color: var(--green-dark);
}

.legend {
  max-width: var(--max-content-width);
  margin: 10px auto 0;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.legend span {
  color: rgba(255,255,255,0.5);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.legend strong {
  color: rgba(255,255,255,0.75);
}

/* Group Page Styles */
.group-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px;
}

.group-header {
  text-align: center;
  margin-bottom: 40px;
}

.group-uuid-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.group-uuid-display {
  color: var(--ink-soft);
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  opacity: 0.6;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  word-break: break-all;
}

.share-group-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0.6;
}

.share-group-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.group-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.team-names {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.team-label {
  color: var(--ink-soft);
  font-size: 0.9rem;
  opacity: 0.7;
  min-width: 50px;
  text-align: center;
}

.team-name {
  text-align: center;
  flex: 1;
}

.team-name-input {
  background: rgba(212, 136, 77, 0.1);
  border: 1px solid rgba(212, 136, 77, 0.3);
  border-radius: 4px;
  padding: 8px 16px;
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}

.team-name-input:focus {
  border-color: var(--gold);
  background: rgba(212, 136, 77, 0.2);
}

.team-name-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.new-game-button-group {
  display: flex;
  width: 100%;
  margin-bottom: 32px;
  position: relative;
}

.new-game-btn {
  flex: 1;
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  padding: 14px;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.new-game-btn:hover:not(:disabled) {
  background: var(--green-light);
}

.new-game-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.new-game-dropdown-btn {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  padding: 14px 16px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  border-left: none;
  font-size: 0.8rem;
}

.new-game-dropdown-btn:hover:not(:disabled) {
  background: var(--green-light);
}

.new-game-dropdown-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.new-game-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #3a3a3a;
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  margin-top: 4px;
  display: none;
  flex-direction: column;
  z-index: 100;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.new-game-dropdown.active {
  display: flex;
}

.dropdown-item {
  background: none;
  border: none;
  color: var(--ink-soft);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dropdown-item i {
  order: -1;
  opacity: 0.5;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-item:first-child {
  border-radius: 4px 4px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 4px 4px;
}

.games-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 0;
}

.games-section h2 {
  color: var(--gold-light);
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  text-align: center;
  margin: 0;
}

.import-game-btn {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
  white-space: nowrap;
}

.import-game-btn:hover {
  background: var(--caramel-dark);
  border-color: var(--caramel-dark);
}

/* Import game modal styles */
.import-game-form {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.import-form-label {
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 500;
}

.import-form-input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.import-form-input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.15);
}

.import-form-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.import-game-submit-btn {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

.import-game-submit-btn:hover {
  background: var(--green-light);
}

.import-game-cancel-btn {
  background: #4a4a4a;
  border: 1px solid #5a5a5a;
  color: var(--ink-soft);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

.import-game-cancel-btn:hover {
  background: #5a5a5a;
  border-color: #6a6a6a;
}

/* Export modal styles */
.export-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#export-message {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0;
}

/* Import data modal styles */
.import-data-form {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-form-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.import-form-checkbox-wrapper input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.import-warning {
  color: #ff9800;
  font-size: 0.85rem;
  margin: 8px 0 0 0;
  padding: 8px;
  background: rgba(255, 152, 0, 0.1);
  border-radius: 4px;
  border-left: 3px solid #ff9800;
}

/* Export/Import modal buttons */
#export-confirm-btn,
#import-confirm-btn {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#export-confirm-btn:hover,
#import-confirm-btn:hover {
  background: var(--green-light);
}

#export-cancel-btn,
#import-cancel-btn {
  background: #4a4a4a;
  border: 1px solid #5a5a5a;
  color: var(--ink-soft);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#export-cancel-btn:hover,
#import-cancel-btn:hover {
  background: #5a5a5a;
  border-color: #6a6a6a;
}

/* Statistics modal styles */
.stats-table-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 20px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.stats-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.stats-table th {
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.stats-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.stats-close-btn {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

.stats-close-btn:hover {
  background: var(--green-light);
}

/* Group statistics styles */
#group-stats-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px 20px;
}

.group-stats-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-stat-section {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.group-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px;
}

.stat-value-left {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.stat-value-right {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.stat-main-value {
  color: var(--gold-light);
  font-weight: 500;
  min-width: 36px;
  text-align: center;
}

.stat-percentage {
  color: #666;
  font-size: 0.85rem;
  min-width: 50px;
  text-align: right;
}

.stat-value-right .stat-percentage {
  text-align: left;
}

.stat-name {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

#group-stats-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--ink-soft);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}

#group-stats-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}

#group-stats-close-btn {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#group-stats-close-btn:hover {
  background: var(--green-light);
}

#group-stats-team1,
#group-stats-team2 {
  font-family: 'Indie Flower', cursive;
  color: var(--ink-soft);
  font-size: 1.5rem;
}

.games-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
}

.games-by-date {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.date-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 16px;
}

.date-header {
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.date-header:hover {
  opacity: 0.8;
}

.date-header::before {
  content: '▼';
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 0.7rem;
  width: 1em;
}

.date-group.collapsed .date-header::before {
  transform: rotate(-90deg);
}

.date-header-label {
  flex: 1;
}

.date-stats-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, color 0.2s;
}

.date-stats-btn:hover {
  opacity: 0.6;
  color: var(--accent);
}

.date-stats-btn:active {
  opacity: 0.4;
}

.game-card {
  /* background: rgba(255,255,255,0.08); */
  /* border: 1px solid rgba(255,255,255,0.15); */
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.3s ease, max-height 0.3s ease, margin 0.1s ease, padding-top 0.1s ease, padding-bottom 0.1s ease;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  opacity: 1;
  margin-bottom: 8px;
}

.date-score-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}

.date-group.collapsed {
  gap: 0;
  transition: gap 0.1s ease;
}

.date-group.collapsed .game-card {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
  padding: 0;
  pointer-events: none;
}

.date-score-summary-team-wrapper {
  flex: 0 0 125px;
  display: flex;
  align-items: center;
}

.date-score-summary-team-wrapper:last-child {
  justify-content: flex-end;
}

.date-score-summary-team {
  color: var(--ink-soft);
  font-size: 0.9rem;
  opacity: 0.7;
}

.date-score-summary-team-wrapper:last-child .date-score-summary-team {
  text-align: end;
}

.date-score-summary-score {
  font-family: 'Playfair Display', serif;
  color: var(--gold-light);
  font-size: 1.8rem;
  text-align: center;
  flex: 1;
  display: flex;
  justify-content: center;
}

.game-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  width: 100%;
  align-items: center;
}

.game-card:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}


.game-card-time {
  color: var(--gold-light);
  font-size: 0.75rem;
  font-weight: 400;
  flex: 0 0 75px;
  text-align: left;
}

.game-card-status-wrapper {
  flex: 0 0 75px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.game-card-status {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.game-card-status.completed {
  background: rgba(74, 157, 111, 0.2);
  color: var(--green);
}

.game-card-status.incomplete {
  background: rgba(212, 136, 77, 0.2);
  color: var(--gold);
}

.game-card-scores {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.game-score {
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.game-score-label {
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-bottom: 2px;
  display: block;
}

.game-score-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.game-score-value span {
  display: inline;
}

.score-separator {
  margin: 0 4px;
}

.game-score-value.progress {
  color: var(--ink-soft);
  opacity: 0.5;
  height: 32px;
  font-size: 1rem;
}

.back-link {
  text-align: center;
  margin-top: 32px;
}

.back-link a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.875rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.back-link a:hover {
  opacity: 1;
}

/* Back button in header (scorecard page) */
#back-link {
  position: absolute;
  top: 24px;
  left: 16px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.875rem;
  opacity: 0.8;
  transition: opacity 0.2s;
  margin-top: -16px;
}

#back-link:hover {
  opacity: 1;
}

/* Complete game button */
#complete-game-container {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, rgba(42, 42, 42, 0), rgba(42, 42, 42, 0.95));
  padding: 16px;
  z-index: 100;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#complete-game-container.active {
  display: flex;
}

#complete-game-btn {
  background: var(--green);
  color: var(--white);
  border: 1px solid var(--green-dark);
  padding: 16px 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  max-width: 300px;
  box-shadow: 0 4px 16px rgba(74, 157, 111, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#complete-game-btn i {
  position: absolute;
  left: 16px;
  opacity: 0.5;
}

#complete-game-btn:hover {
  background: var(--green-light);
  box-shadow: 0 6px 20px rgba(74, 157, 111, 0.4);
}

/* Modal action buttons */
#game-change-date-btn,
#game-mark-incomplete-btn,
#game-stats-btn,
#game-delete-btn,
#game-cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#game-change-date-btn i,
#game-mark-incomplete-btn i,
#game-stats-btn i,
#game-delete-btn i,
#game-cancel-btn i {
  position: absolute;
  left: 12px;
  opacity: 0.5;
}

#game-change-date-btn {
  background: #4a4a4a;
  border: 1px solid #5a5a5a;
  color: var(--ink-soft);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#game-change-date-btn:hover {
  background: #5a5a5a;
  border-color: #6a6a6a;
}

#game-delete-btn {
  background: var(--red);
  border: 1px solid var(--red);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#game-delete-btn:hover {
  background: #b63535;
}

#game-mark-incomplete-btn {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--ink-soft);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#game-mark-incomplete-btn:hover {
  background: var(--caramel-dark);
  border-color: var(--caramel-dark);
}

#game-stats-btn {
  background: var(--blue);
  border: 1px solid var(--blue);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#game-stats-btn:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

#game-cancel-btn {
  background: #4a4a4a;
  border: 1px solid #5a5a5a;
  color: var(--ink-soft);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#game-cancel-btn:hover {
  background: #5a5a5a;
  border-color: #6a6a6a;
}

/* Admin modal buttons */
#group-delete-btn {
  background: var(--red);
  border: 1px solid var(--red);
  color: var(--white);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#group-delete-btn:hover {
  background: #b63535;
}

#group-cancel-btn {
  background: #4a4a4a;
  border: 1px solid #5a5a5a;
  color: var(--ink-soft);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  font-size: 0.95rem;
}

#group-cancel-btn:hover {
  background: #5a5a5a;
  border-color: #6a6a6a;
}

/* Modal button container */
.modal-button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  flex: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Modal buttons tap highlight */
#game-change-date-btn,
#game-delete-btn,
#game-mark-incomplete-btn,
#game-cancel-btn,
#group-delete-btn,
#group-cancel-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Team separator in group page */
.team-separator {
  color: var(--ink-soft);
}

/* Landing page styles */
.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.landing-content {
  max-width: 640px;
  width: 100%;
  padding: 24px 16px;
}

.landing-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--gold-light);
  text-align: center;
  margin-bottom: 32px;
}

.landing-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-input-group label {
  color: var(--ink-soft);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.landing-input-group input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 12px 16px;
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.landing-input-group input::placeholder {
  color: rgba(255,255,255,0.5);
}

.landing-input-group input:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.15);
}

.landing-input-group input::placeholder {
  opacity: 0.35;
}

.landing-button {
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.landing-button i {
  position: absolute;
  right: 16px;
  opacity: 0.5;
}

.landing-button:hover {
  background: var(--green-light);
}

.landing-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.landing-error {
  color: var(--red);
  font-size: 0.875rem;
  margin-top: 8px;
  display: none;
}

.landing-error.show {
  display: block;
}

.landing-guide-link {
  margin-top: 32px;
  text-align: center;
}

.guide-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.875rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.guide-link:hover {
  opacity: 1;
}

.landing-info-card {
  margin-top: 48px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--ink-soft);
}

.landing-info-card h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-family: 'Playfair Display', serif;
}

.landing-info-card h3 {
  font-size: 1.1rem;
  margin-top: 20px;
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}

.landing-info-card p {
  margin-bottom: 16px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.landing-info-card ul,
.landing-info-card ol {
  margin-left: 24px;
  margin-bottom: 16px;
  line-height: 1.8;
}

.landing-info-card li {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.landing-info-card strong {
  color: var(--gold-light);
}

/* Landing page header */
.landing-content header {
  margin-bottom: 48px;
}

/* @media (max-width: 420px) {
  .score-cell, .roem-cell { font-size: 0.85rem; }
  .total-cell { font-size: 0.92rem; margin: 4px 3px; }
} */

/* Scale the scorecard up on desktop so it doesn't render at mobile size */
@media (min-width: 700px) {
  :root {
    --max-content-width: 760px;
  }

  .group-container {
    max-width: 900px;
  }

  .team-setup {
    height: 92px;
  }

  .header-row {
    top: 92px;
  }

  .team-name-label {
    font-size: 2.6rem;
  }

  .header-label {
    font-size: 0.92rem;
  }

  .grid-row.round {
    min-height: 88px;
  }

  .score-cell {
    font-size: 3.6rem;
    min-height: 88px;
  }

  .roem-cell {
    font-size: 2.5rem;
    min-height: 88px;
  }

  .grid-row.cumulative {
    min-height: 80px;
    height: 72px;
  }

  .cum-cell {
    font-size: 1.2rem;
  }

  .cum-cell.total {
    font-size: 4.3rem;
    height: 82px;
  }

  .round-number {
    width: 30px;
    height: 30px;
    font-size: 0.92rem;
  }
}
