:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --text: #16201a;
  --muted: #63706a;
  --line: #d8e0d9;
  --accent: #1f7a5a;
  --accent-strong: #155940;
  --danger: #a83232;
  --danger-bg: #fff0f0;
  --shadow: 0 14px 34px rgba(31, 49, 38, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body.is-busy { cursor: progress; }

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: var(--accent-strong); font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 14px 32px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 8vw, 2.3rem);
  line-height: 1.15;
}

h2 { margin-bottom: 16px; font-size: 1.12rem; }
h3 { margin: 0 0 8px; font-size: 1.08rem; }

.header-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.limit-badge {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.panel {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.status-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.event-form { display: grid; gap: 14px; }
.event-form-panel.is-auth-locked .event-form { opacity: 0.58; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font-weight: 600;
}

input:focus, select:focus {
  outline: 3px solid rgba(31, 122, 90, 0.18);
  border-color: var(--accent);
}

.field-grid, .form-actions, .notification-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.message {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 0.92rem;
  font-weight: 800;
}

.message.success { color: var(--accent-strong); }
.message.error { color: var(--danger); }

.primary-button, .secondary-button, .small-button, .clear-all-button, .clear-ended-button, .list-action-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.secondary-button, .small-button, .list-action-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.small-button { min-height: 36px; padding: 7px 10px; }

.clear-all-button, .clear-ended-button {
  border: 1px solid rgba(168, 50, 50, 0.22);
  background: var(--danger-bg);
  color: var(--danger);
}

.list-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.event-list { display: grid; gap: 12px; }

.event-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.event-game {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-weight: 900;
}

.event-meta {
  display: grid;
  gap: 5px;
  margin: 0;
}

.event-meta div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
}

.event-meta dt {
  color: var(--muted);
  font-weight: 800;
}

.event-meta dd { margin: 0; font-weight: 700; }

.calendar-links {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

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

.list-action-row {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.empty-state {
  margin: 10px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 27, 20, 0.42);
}

.guide-card {
  width: min(100%, 520px);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.24);
}

.guide-card p { margin-bottom: 10px; font-weight: 700; }

.guide-steps {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf6;
}

.guide-steps p { margin: 0 0 6px; }
.guide-steps p:last-child { margin-bottom: 0; }

.is-hidden { display: none !important; }

@media (min-width: 680px) {
  .field-grid, .form-actions { grid-template-columns: 1fr 1fr; }
  .event-card { grid-template-columns: 1fr auto; align-items: start; }
  .event-actions { width: 160px; grid-template-columns: 1fr; }
  .list-action-row { grid-template-columns: 1fr 1fr; }
}
