:root {
  --bg: #f4efe6;
  --bg-soft: #fff8ee;
  --ink: #1f2a24;
  --accent: #2d6a4f;
  --accent-2: #d68c45;
  --line: #d6c8b8;
  --danger: #9b2226;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  background: radial-gradient(circle at top, #fff6df, var(--bg));
  color: var(--ink);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 30px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.6rem;
}

.title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.app-title-icon {
  width: 30px;
  height: 30px;
  display: block;
}

.app-header p {
  margin-top: 6px;
  color: #4d5d53;
  font-size: 0.95rem;
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-top: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.grid-two {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
}

.btn-light {
  background: #ece6dd;
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-icon {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

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

.btn-top-nav {
  width: 100%;
  margin-bottom: 10px;
}

.scoring-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.quick-stats {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-stats article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 3px;
}

.quick-stats span {
  font-size: 0.8rem;
  color: #536357;
}

.quick-stats strong {
  font-size: 1.1rem;
}

.arrow-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 8px;
}

.arrow-cell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  min-height: 44px;
  display: grid;
  place-items: center;
}

.arrow-cell strong {
  font-size: 1.2rem;
  color: inherit;
}

.arrow-cell.current {
  border: 2px solid var(--accent-2);
}

.arrow-cell.score-hit {
  background: var(--accent);
  color: #fff;
}

.arrow-cell.score-miss {
  background: var(--danger);
  border-color: #7d1a1d;
  color: #fff;
}

.points-pad {
  margin-top: 12px;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  padding-bottom: 2px;
}

.score-entry-sticky {
  position: sticky;
  top: 8px;
  z-index: 5;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.point-btn {
  flex: 0 0 64px;
  background: var(--accent);
  border: 1px solid #245840;
  border-radius: 10px;
  min-height: 54px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.score-actions-row {
  margin-top: 8px;
  display: grid;
}

.point-btn.zero {
  background: var(--danger);
  border-color: #7d1a1d;
  color: #fff;
}

.point-btn.disabled-score {
  background: #b8b8b8;
  border-color: #a5a5a5;
  color: #fff;
  opacity: 0.75;
  cursor: not-allowed;
}

.table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

#live-volley-history-wrap {
  max-height: 300px;
  overflow-y: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--line);
}

.history-table th {
  font-size: 0.86rem;
  color: #536357;
}

.history-table tr:last-child td {
  border-bottom: none;
}

.row-delete-btn {
  padding: 6px;
  min-width: 38px;
  min-height: 34px;
  background: transparent;
  color: var(--danger);
}

.history-total {
  text-align: right;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  padding: 8px 0;
  color: var(--danger);
}

.history-total.success {
  color: var(--accent);
}

.stats-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.stats-list article {
  border-left: 4px solid var(--accent-2);
  background: #fff;
  padding: 8px;
  border-radius: 8px;
}

.actions {
  margin-top: 12px;
}

.hidden {
  display: none;
}

@media (min-width: 640px) {
  .grid-two {
    grid-template-columns: repeat(2, 1fr);
  }
}
