:root {
  color-scheme: dark;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  --bg: #09090d;
  --sidebar: #0e0e14;
  --surface: #13131b;
  --surface2: #191824;
  --line: #2a2936;
  --text: #f8f7fb;
  --muted: #a8a5b5;
  --purple: #8b5cf6;
  --purple2: #a78bfa;
  --success: #7ee2a8;
  --warning: #f4c86a;
  --danger: #fb7185;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, a, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #c4b5fd;
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 30px;
  background: #0b0b10;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand .maker {
  color: var(--purple2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 2px;
  line-height: 1;
}

.brand strong {
  margin-top: 2px;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: .7px;
  line-height: 1;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account img {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.account-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-copy strong { font-size: 13px; }
.account-copy small { color: var(--muted); font-size: 11px; }

.shell {
  width: min(1120px, calc(100% - 36px));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 42px 0 64px;
}

.login-card {
  max-width: 720px;
  margin: 22px auto 0;
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.twitch-mark {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  margin-bottom: 18px;
  padding: 0 10px;
  color: #fff;
  background: #9146ff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.eyebrow {
  margin: 0;
  color: var(--purple2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.login-card h1,
.page-heading h1 {
  margin: 6px 0 10px;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-weight: 400;
  letter-spacing: .2px;
}

.login-card h1 { font-size: clamp(34px, 6vw, 52px); }
.page-heading h1 { font-size: clamp(34px, 5vw, 48px); }

.login-card > p:not(.eyebrow):not(.privacy-note) {
  max-width: 560px;
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.privacy-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  color: #fff;
  background: var(--purple);
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
  text-decoration: none;
}

.button:hover { background: #7c4eed; }
.button:disabled { cursor: not-allowed; opacity: .6; }

.button-secondary {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--line);
}

.button-secondary:hover {
  color: #fff;
  background: #201d2d;
  border-color: var(--purple);
}

.twitch-button { margin-top: 2px; background: #9146ff; }
.twitch-button:hover { background: #7f38e8; }
.primary-button { background: var(--purple); }

.page-heading,
.section-heading,
.event-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.page-heading { margin-bottom: 18px; }
.page-heading p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.organizer-panel,
.event-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.organizer-panel {
  margin-bottom: 14px;
  padding: 18px;
}

.section-heading h2,
.event-header h2 {
  margin: 5px 0 0;
  font-size: 24px;
  letter-spacing: -.3px;
}

.role-badge,
.claim-summary {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 5px 9px;
  color: var(--purple2);
  background: #20202a;
  border: 1px solid #343342;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.event-form {
  display: grid;
  grid-template-columns: 2fr repeat(4, minmax(110px, 1fr)) auto;
  align-items: end;
  gap: 12px 14px;
  margin-top: 18px;
}

.event-form label,
.slot-dialog label {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.event-form label small {
  position: absolute;
  right: 10px;
  bottom: 12px;
  color: #777485;
  font-size: 10px;
}

.event-form input,
.slot-dialog input {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--text);
  background: #0d0d13;
  border: 1px solid #393746;
  border-radius: 7px;
  outline: none;
}

.event-form input:hover,
.slot-dialog input:hover { border-color: #4b485a; }

.event-form input:focus,
.slot-dialog input:focus { border-color: var(--purple2); }

.message {
  margin: 14px 0;
  padding: 12px 14px;
  color: #ddd5f3;
  background: var(--surface2);
  border: 1px solid #3b3158;
  border-left: 3px solid var(--purple);
  border-radius: 7px;
}

.message.error {
  color: #fecdd3;
  background: #2a1118;
  border-color: #6a3140;
  border-left-color: var(--danger);
}

.events {
  display: grid;
  gap: 14px;
}

.event-card { overflow: hidden; }

.event-header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.event-date { text-transform: uppercase; }

.event-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.slots.multi-day { display: block; }

.event-day + .event-day { border-top: 1px solid #373348; }

.event-day-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--line);
}

.event-day-kicker {
  color: var(--purple2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
}

.event-day-title {
  margin: 0;
  font-size: 17px;
}

.event-day-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.slot {
  min-height: 108px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.slot:nth-child(even) { border-right: 0; }
.slot.mine {
  background: var(--surface2);
  box-shadow: inset 3px 0 0 var(--purple);
}

.slot.claimed:not(.mine) { color: #c9c6d2; }

.slot.past:not(.mine) {
  color: #8c8997;
  background: #101017;
}

.slot.past .slot-number,
.slot.past .slot-time { opacity: .72; }

.slot-number {
  color: #777485;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
}

.slot-time {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slot-time strong { font-size: 15px; }
.slot-time span,
.slot-owner small { color: var(--muted); font-size: 11px; }

.slot-owner {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.slot-owner strong {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  white-space: nowrap;
}

.slot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.slot-actions .button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

.mine-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  padding: 34px 22px;
  color: var(--muted);
  background: transparent;
  border: 1px dashed #3a3847;
  border-radius: 8px;
  text-align: center;
}

.slot-dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
}

.slot-dialog::backdrop {
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(2px);
}

.slot-dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

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

.dialog-heading h2 { margin: 5px 0 0; }

.close-button {
  width: 40px;
  min-height: 40px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 20px;
}

.close-button:hover { border-color: var(--purple); }

@media (max-width: 1020px) {
  .event-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-form .wide { grid-column: 1 / -1; }
  .event-form button { min-height: 42px; }
}

@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .shell { width: min(100% - 28px, 1120px); padding-top: 28px; }
  .page-heading,
  .section-heading,
  .event-header { align-items: stretch; flex-direction: column; }
  .slots,
  .event-day-slots { grid-template-columns: 1fr; }
  .slot,
  .slot:nth-child(even) { border-right: 0; }
}

@media (max-width: 560px) {
  .brand strong { font-size: 21px; }
  .brand small { display: none; }
  .account-copy { display: none; }
  .login-card,
  .organizer-panel,
  .event-header { padding: 16px; }
  .event-form { grid-template-columns: 1fr; }
  .event-form .wide { grid-column: auto; }
  .slot { grid-template-columns: 32px minmax(0, 1fr); }
  .slot-actions,
  .slot-owner,
  .mine-pill {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }
  .slot-actions { justify-content: flex-start; }
}
