:root {
  color-scheme: dark;
  --bg: #030303;
  --surface: rgba(10, 10, 11, 0.84);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f5f0;
  --muted: #a6a6a0;
  --signal: #e9ff70;
  --exam: #ff5c86;
  --light: #70d6ff;
  --core: #62f28b;
  --heavy: #ffca57;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(233, 255, 112, 0.14), transparent 24rem),
    linear-gradient(245deg, rgba(255, 255, 255, 0.06), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

button, input { font: inherit; }

.app {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 0 72px;
}

.hero {
  display: grid;
  justify-items: center;
  padding: 32px 0 42px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 42px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 760;
}

.brand-mark {
  width: 17px;
  height: 17px;
  border: 2px solid var(--text);
  border-radius: 50%;
  box-shadow: inset 6px 0 0 var(--signal);
}

h1, h2 {
  margin: 0;
  font-weight: 880;
  line-height: 0.86;
  letter-spacing: 0;
}

h1 { font-size: clamp(56px, 12vw, 138px); }
h2 { font-size: clamp(30px, 4vw, 54px); }

.lede {
  max-width: 740px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.22;
}

.panel, .calendar-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 70%),
    var(--surface);
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px;
}

.month-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker, label span {
  margin: 0;
  color: var(--signal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.button, .mode, .time-choice {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 860;
  white-space: nowrap;
}

.button-light {
  border: 1px solid #eff2d6;
  background: #f5f7e9;
  color: #11120e;
}

.button-dark, .mode, .time-choice {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 26px;
}

.mode-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

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

.danger-button {
  border-color: rgba(255, 92, 134, 0.34);
  color: #ffb4c6;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mode.active {
  border-color: var(--signal);
  box-shadow: 0 0 22px rgba(233, 255, 112, 0.14);
}

.mode.exam.active { background: rgba(255, 92, 134, 0.18); }
.mode.light.active { background: rgba(112, 214, 255, 0.18); }
.mode.core.active { background: rgba(98, 242, 139, 0.18); }
.mode.heavy.active { background: rgba(255, 202, 87, 0.18); }

.calendar-shell {
  overflow: hidden;
  padding: 14px;
}

.autofill-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 20px;
}

.autofill-panel h2 {
  margin-top: 4px;
  font-size: clamp(28px, 4vw, 44px);
}

.theory-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.weekdays, .calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays span {
  color: var(--signal);
  padding: 10px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar {
  gap: 8px;
}

.day {
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.day.outside {
  opacity: 0.34;
}

.day.today {
  border-color: rgba(233, 255, 112, 0.55);
}

.day-number {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.slots {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  height: calc(100% - 26px);
  margin-top: 8px;
}

.slot {
  min-height: 42px;
  border: 1px dashed rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 5px;
}

.slot-whole {
  grid-row: 1 / 3;
}

.event {
  display: grid;
  min-height: 100%;
  align-content: center;
  border: 1px solid color-mix(in srgb, var(--event-color), transparent 20%);
  border-radius: 9px;
  background: color-mix(in srgb, var(--event-color), transparent 82%);
  color: var(--text);
  padding: 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.event.whole {
  min-height: 100%;
}

.event small {
  color: color-mix(in srgb, var(--event-color), white 30%);
  font-size: 9px;
  text-transform: uppercase;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.modal {
  display: grid;
  gap: 16px;
  width: min(460px, 100%);
  padding: 22px;
}

.modal-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.clear-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.check-row input {
  width: auto;
  accent-color: var(--signal);
}

.check-row span {
  color: var(--text);
  font-size: 13px;
}

label {
  display: grid;
  gap: 8px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  padding: 13px 14px;
}

input:focus {
  border-color: rgba(233, 255, 112, 0.55);
}

.time-options, .modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.time-choice.active {
  border-color: var(--signal);
  background: rgba(233, 255, 112, 0.16);
}

@media (max-width: 980px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .month-controls {
    justify-content: center;
  }

  .autofill-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 24px, 1320px);
  }

  .calendar-shell {
    overflow-x: auto;
  }

  .weekdays, .calendar {
    min-width: 820px;
  }
}
