:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #222;
  --accent: #1a5fb4;
  --accent-text: #ffffff;
  --danger: #a51d2d;
  --miss-bg: #f8d7d7;
}

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

/* Author rules that set `display` (e.g. .actions { display: flex }) would
   otherwise override the UA's default [hidden] { display: none }. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.screen {
  max-width: 32rem;
  margin: 0 auto;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.25rem 3rem;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 1.5rem;
}

h2 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  text-transform: capitalize;
}

p {
  line-height: 1.5;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.confirm-text {
  width: 100%;
  color: var(--danger);
  margin: 0 0 0.5rem;
}

button {
  font: inherit;
  padding: 0.75rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}

button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

button.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.row-break {
  flex-basis: 100%;
  height: 0;
}

.secondary-actions {
  margin-top: 2rem;
  border-top: 1px solid #ddd;
  padding-top: 1rem;
}

.bout-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.bout-meta .field {
  flex: 1 1 9rem;
  margin-bottom: 0;
}

.targets {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 1.5rem 0;
}

.target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  min-height: auto;
  touch-action: manipulation;
}

.target-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: #fff;
  transition: background-color 0.1s ease;
}

.target.miss .target-circle {
  background: #111;
}

.target-label {
  font-size: 0.8rem;
  color: var(--text);
}

.history-session {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
  cursor: pointer;
}

.history-session .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-session-delete {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  line-height: 1;
  color: var(--danger);
  border-color: var(--danger);
}

.history-session-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-session-controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-session-folder-select {
  max-width: 7.5rem;
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.history-folder-title {
  font-size: 1.05rem;
}

.history-new-folder-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.history-new-folder-name {
  flex: 1;
}

.history-folder {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #f7f6f1;
  cursor: pointer;
}

.history-folder .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-folder-delete {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  line-height: 1;
  color: var(--danger);
  border-color: var(--danger);
}

.history-folder-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bout-detail {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.target-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.target-chip {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.target-chip.hit {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.target-chip.miss {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.field input {
  font: inherit;
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.error-text {
  color: var(--danger);
  font-size: 0.9rem;
}

.password-input {
  position: relative;
}

.password-input input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 0.4rem;
  background: none;
  border: none;
  color: var(--muted);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* ---- Login / Forgot Password cards ---- */

.auth-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 1.75rem 1.5rem;
  margin-top: 1.5rem;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand h1 {
  margin-bottom: 0.35rem;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin-bottom: 0.75rem;
}

.oauth-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #fff;
  font-weight: 500;
}

.oauth-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ddd;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  min-height: auto;
  color: var(--accent);
  text-decoration: underline;
  font-size: 0.85rem;
}

.auth-forgot {
  margin: -0.5rem 0 1rem;
  text-align: right;
}

.mode-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.mode-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  width: 100%;
  padding: 1rem 1.2rem;
  text-align: left;
  white-space: normal;
}

.mode-choice-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.mode-choice-desc {
  color: var(--muted);
  font-size: 0.85rem;
}

.oneshot-rep-label {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.25rem;
}

.oneshot-phase-label {
  color: var(--muted);
  margin: 0;
}

.oneshot-clock {
  font-size: 4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0.5rem 0 2rem;
}

.user-badge {
  position: fixed;
  top: calc(0.75rem + env(safe-area-inset-top));
  right: 1rem;
  max-width: 45%;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #ddd;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 10;
}
