:root {
  color-scheme: dark;
  --page: #101820;
  --panel: #18232d;
  --panel-raised: #202e39;
  --line: #2b3a46;
  --text: #edf2f4;
  --muted: #9cabb6;
  --green: #63d6a0;
  --green-dark: #193d32;
  --gold: #f0c779;
  --red: #ff8f8f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 75% -15%, rgb(54 105 85 / 18%), transparent 36rem),
    var(--page);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.topbar {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
  border-bottom: 1px solid rgb(255 255 255 / 7%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  text-decoration: none;
}

.brand strong {
  color: var(--green);
  font-weight: 650;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #47745f;
  border-radius: 9px;
  background: var(--green-dark);
  color: var(--green);
  font-size: 18px;
}

.topbar-note,
.lede,
.section-help,
footer {
  color: var(--muted);
  font-size: 13px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-nav > a {
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.topbar-nav > a:hover {
  color: #a4edc7;
}

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 42px;
}

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

.page-heading {
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(29px, 4vw, 38px);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.lede {
  margin-bottom: 0;
}

.panel {
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgb(255 255 255 / 2%), transparent 44%), var(--panel);
  box-shadow: 0 18px 50px rgb(0 0 0 / 9%);
}

.section-heading {
  margin-bottom: 21px;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, transform 130ms ease;
}

.button {
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--green);
  color: #0c2118;
}

.button-primary:hover {
  background: #7ce2b2;
}

.button-secondary,
.icon-button {
  border-color: var(--line);
  background: #1d2a34;
  color: var(--text);
}

.button-secondary:hover,
.icon-button:hover {
  border-color: #527163;
  background: var(--panel-raised);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 22px;
}

.button-danger {
  border-color: #633d42;
  background: #38252a;
  color: var(--red);
}

.button-danger:hover {
  background: #4a2d32;
}

.month-label {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.weekday,
.calendar-day {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday:nth-child(7n),
.calendar-day:nth-child(7n) {
  border-right: 0;
}

.weekday {
  padding: 10px 6px;
  background: #1d2a34;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 113px;
  padding: 8px;
  background: #17222b;
}

.calendar-day.outside-month {
  background: #141e26;
}

.calendar-day.outside-month .day-number {
  color: #687782;
}

.calendar-day.selected-day {
  background: #1a2c2b;
  box-shadow: inset 0 0 0 1px #46765e;
}

.day-number {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
}

.day-number:hover {
  background: var(--panel-raised);
}

.day-number.today {
  background: var(--green);
  color: #0c2118;
  font-weight: 750;
}

.calendar-event {
  display: block;
  width: 100%;
  overflow: hidden;
  margin: 3px 0;
  padding: 4px 5px;
  border: 0;
  border-left: 2px solid var(--green);
  border-radius: 3px;
  background: #21382f;
  color: #d3f5e4;
  cursor: pointer;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event:hover {
  background: #2a483b;
}

.more-events {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.count-badge {
  display: grid;
  min-width: 27px;
  height: 27px;
  place-items: center;
  padding: 0 7px;
  border: 1px solid #3c574a;
  border-radius: 20px;
  background: var(--green-dark);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.tournament-list,
.room-list {
  display: grid;
  gap: 10px;
}

.tournament-card,
.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1b2832;
}

.tournament-card-main {
  min-width: 0;
}

.tournament-title {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tournament-title:hover,
.room-link:hover {
  color: var(--green);
}

.tournament-meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.tournament-buy-in {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.section-help {
  margin: -10px 0 17px;
}

.room-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 17px;
}

label {
  display: grid;
  gap: 7px;
  color: #d4dde2;
  font-size: 11px;
  font-weight: 650;
}

label small {
  color: var(--muted);
  font-size: inherit;
  font-weight: 450;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #344550;
  border-radius: 7px;
  outline: 0;
  background: #111b23;
  color: var(--text);
  font-size: 12px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #5da581;
  box-shadow: 0 0 0 3px rgb(99 214 160 / 12%);
}

input::placeholder,
textarea::placeholder {
  color: #71818d;
}

.room-card {
  padding: 11px 13px;
}

.room-card-name {
  font-size: 12px;
  font-weight: 700;
}

.room-summary {
  color: var(--muted);
  font-size: 11px;
}

.room-management-card {
  align-items: flex-start;
}

.room-card-details {
  min-width: 0;
}

.room-card-heading,
.room-actions,
.tournament-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.room-type-badge,
.attendance-badge,
.tournament-guaranteed,
.tournament-change {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.attendance-yes {
  border-color: #3c7259;
  background: #193d32;
  color: #a8edc8;
}

.attendance-possibly,
.attendance-maybe {
  border-color: #6d5934;
  background: #382f20;
  color: #f0d79f;
}

.tournament-guaranteed {
  border-color: #65532f;
  color: var(--gold);
}

.tournament-change {
  border-color: #74494b;
  background: #38252a;
  color: #ffc2c2;
  white-space: normal;
}

.import-error {
  margin: 6px 0 0;
  color: var(--red);
  font-size: 11px;
}

.import-status {
  margin: 6px 0 0;
  color: var(--green);
  font-size: 11px;
}

.room-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.room-actions .button {
  min-height: 32px;
}

.checkbox-label {
  min-height: 40px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
}

.checkbox-label input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

.room-link {
  margin-left: 7px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.room-remove {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid #4d3b3e;
  border-radius: 6px;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 10px;
}

.room-remove:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-state {
  margin: 0;
  padding: 20px;
  border: 1px dashed #35454f;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.notice {
  display: none;
  margin: -10px 0 18px;
  padding: 11px 13px;
  border: 1px solid #4b674f;
  border-radius: 8px;
  background: #1c3229;
  color: #c9f0d7;
  font-size: 12px;
}

.notice.visible {
  display: block;
}

.notice.error {
  border-color: #73464b;
  background: #38252a;
  color: #ffd1d1;
}

dialog {
  width: min(540px, calc(100% - 28px));
  max-height: min(90vh, 760px);
  overflow: auto;
  padding: 0;
  border: 1px solid #3b4b55;
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 80px rgb(0 0 0 / 55%);
}

dialog::backdrop {
  background: rgb(5 10 14 / 72%);
  backdrop-filter: blur(3px);
}

.tournament-form {
  display: grid;
  gap: 16px;
  padding: 23px;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.dialog-heading h2 {
  font-size: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.action-spacer {
  flex: 1;
}

footer {
  padding: 5px 0 25px;
  text-align: center;
}

@media (max-width: 700px) {
  main {
    width: min(100% - 24px, 560px);
    padding-top: 35px;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-note {
    font-size: 11px;
  }

  .topbar-nav {
    gap: 9px;
  }

  .topbar-nav > a {
    font-size: 10px;
  }

  .panel {
    padding: 17px 13px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading .button {
    flex: 0 0 auto;
    margin-top: 11px;
    padding: 0 10px;
    font-size: 11px;
  }

  .room-management-card {
    flex-direction: column;
  }

  .room-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .calendar-day {
    min-height: 75px;
    padding: 4px;
  }

  .weekday {
    padding: 8px 2px;
    font-size: 8px;
  }

  .calendar-event {
    height: 5px;
    margin: 3px 0;
    padding: 0;
    border-left-width: 3px;
    border-radius: 3px;
    background: #315746;
    color: transparent;
    font-size: 0;
  }

  .more-events {
    font-size: 8px;
  }

  .room-form {
    grid-template-columns: 1fr 1fr;
  }

  .room-form button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .topbar-note {
    display: none;
  }

  .page-heading {
    flex-direction: column;
    gap: 12px;
  }

  .page-heading .button {
    margin: 0;
  }

  .calendar-controls {
    gap: 4px;
  }

  .calendar-controls .button {
    min-height: 34px;
    padding: 0 9px;
  }

  .icon-button {
    width: 34px;
    min-height: 34px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .tournament-form {
    padding: 18px 15px;
  }

  .dialog-actions .button {
    padding: 0 9px;
    font-size: 10px;
  }
}
