:root {
  --primary: #4f46e5;
  --bg: #f1f5f9;
}
body {
  font-family: -apple-system, system-ui, sans-serif;
  background: var(--bg);
  padding: 20px;
  margin: 0;
  display: flex;
  justify-content: center;
  min-height: 0;
}

.container {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 900px;
  flex-wrap: wrap;
}

.card {
  background: white;
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  flex: 1;
  min-width: 320px;
  box-sizing: border-box;
}

.history-card {
  background: white;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  width: 300px;
  display: flex;
  flex-direction: column;
  max-height: 600px;
}

h2 {
  text-align: center;
  margin-top: 0;
  color: #1e293b;
  font-size: 20px;
  margin-bottom: 20px;
}

.score-board {
  display: flex;
  justify-content: space-between;
  margin-bottom: 25px;
  background: #eef2ff;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #e0e7ff;
}
.player {
  text-align: center;
  flex: 1;
}
.player-name {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 5px;
}
.score-input {
  width: 100%;
  max-width: 120px;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  border-radius: 999px;
  border: 2px solid #c7d2fe;
  padding: 4px 8px;
  background: #eef2ff;
  outline: none;
}

.label-title {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #475569;
  font-size: 14px;
}
.btn-group {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.option-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  color: #64748b;
  transition: 0.2s;
  outline: none;
}
.option-btn.active {
  border-color: var(--primary);
  background: #f5f3ff;
  color: var(--primary);
}

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 16px;
  text-align: center;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0;
}
.stepper input {
  border-radius: 0;
  border-left: none;
  border-right: none;
  flex: 1;
  min-width: 0;
}
.stepper-btn {
  width: 44px;
  height: 44px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  font-size: 20px;
  font-weight: bold;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}
.stepper-btn:first-child {
  border-radius: 8px 0 0 8px;
}
.stepper-btn:last-child {
  border-radius: 0 8px 8px 0;
}
.stepper-btn:active {
  background: #e0e7ff;
}

.actions {
  margin-top: 8px;
}

.btn-submit {
  background: var(--primary);
  color: white;
  border: none;
  width: 100%;
  padding: 16px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 12px;
}
.btn-submit:active {
  transform: scale(0.96);
}

.secondary-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-reset {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.btn-undo {
  background: #e5e7eb;
  color: #1f2933;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
}

.btn-redo {
  background: #ede9fe;
  color: #4c1d95;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
}

.secondary-actions .btn-undo,
.secondary-actions .btn-redo,
.secondary-actions .btn-reset {
  flex: 1;
  text-align: center;
}

.history-list {
  overflow-y: auto;
  flex-grow: 1;
  margin-top: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  position: sticky;
  top: 0;
  background: white;
  color: #94a3b8;
  font-weight: normal;
  text-align: left;
  padding: 8px;
  border-bottom: 2px solid #f1f5f9;
}
td {
  padding: 12px 8px;
  border-bottom: 1px solid #f8fafc;
  color: #475569;
}

@media (max-width: 650px) {
  .container {
    flex-direction: column;
    align-items: center;
  }
  .history-card {
    width: 100%;
    max-width: 400px;
    max-height: 300px;
  }
}
