* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: #fff;
  color: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.view {
  display: none;
  height: 100vh;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.view.active {
  display: flex;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid #000;
  flex-shrink: 0;
  gap: 8px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.header-btn {
  background: none;
  border: 2px solid #000;
  color: #000;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.header-btn:active {
  background: #000;
  color: #fff;
}

.team-picker-btn {
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  padding: 2px 0;
  touch-action: manipulation;
  text-align: left;
}

.team-picker-btn:active {
  color: #000;
}

/* Player list */
.player-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.player-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #ddd;
  gap: 12px;
}

.player-name {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name-input {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  border: 2px solid #000;
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
  min-width: 0;
  background: #fff;
  color: #000;
}

.player-time {
  font-size: 24px;
  font-weight: 700;
  font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  min-width: 70px;
  text-align: right;
  white-space: nowrap;
}

.btn-start-stop {
  font-size: 16px;
  font-weight: 700;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  min-width: 70px;
  text-align: center;
}

.btn-start-stop.start {
  background: #22C55E;
  color: #fff;
}

.btn-start-stop.start:active {
  background: #16A34A;
}

.btn-start-stop.stop {
  background: #EF4444;
  color: #fff;
}

.btn-start-stop.stop:active {
  background: #DC2626;
}

.btn-delete {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 8px;
  touch-action: manipulation;
  line-height: 1;
}

.btn-delete:active {
  color: #000;
}

.btn-ok {
  font-size: 16px;
  font-weight: 700;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #000;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-ok:active {
  background: #333;
}

/* Add player / add team button */
.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  font-size: 24px;
  font-weight: 700;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  margin: 12px 0;
}

.btn-add:active {
  background: #333;
}

.add-player-row {
  padding: 0 16px;
}

/* Season totals view */
.season-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #ddd;
  gap: 12px;
}

.season-name {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
}

.season-time {
  font-size: 24px;
  font-weight: 700;
  font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
}

.season-empty {
  padding: 40px 16px;
  text-align: center;
  font-size: 18px;
  color: #999;
}

.header-back {
  background: none;
  border: none;
  font-size: 18px;
  font-weight: 600;
  color: #000;
  cursor: pointer;
  padding: 8px 0;
  touch-action: manipulation;
}

.header-back:active {
  color: #666;
}

/* Team picker */
.team-row {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #ddd;
  gap: 12px;
  cursor: pointer;
}

.team-row:active {
  background: #f5f5f5;
}

.team-row.active-team {
  background: #f0f0f0;
}

.team-row-name {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
}

.team-row-count {
  font-size: 14px;
  color: #999;
}

.team-row-check {
  font-size: 20px;
  font-weight: 700;
}

/* Confirmation modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin: 20px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.modal p {
  font-size: 18px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  border: none;
}

.modal-cancel {
  background: #e5e5e5;
  color: #000;
}

.modal-confirm {
  background: #000;
  color: #fff;
}

.modal-confirm.danger {
  background: #EF4444;
}
