/* палитра клуба: приложение всегда тёмное и не зависит от темы Telegram */
:root {
  color-scheme: dark;
  --lime: #92bd0a;
  --magenta: #bc0d6a;
  --black: #030303;
  --graphite: #2c2c2c;
  --white: #f6f6f2;
  --muted: #a3a39c;
  --line: #474747;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --menu-height: 68px;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
}

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 16px calc(var(--menu-height) + 104px + env(safe-area-inset-bottom));
}

h1 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  margin: 22px 4px 10px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
}

h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

.card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--graphite);
}

.card + .card {
  margin-top: 10px;
}

.stack > * + * {
  margin-top: 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row > :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.btn {
  padding: 11px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--lime);
  color: var(--black);
  font-weight: 700;
}

.btn.secondary {
  background: transparent;
  color: var(--white);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.btn.danger {
  background: var(--magenta);
  color: #ffffff;
}

.btn.small {
  flex: none;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.btn.full {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

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

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

label > input,
label > select,
label > textarea {
  margin-top: 5px;
  font-size: 15px;
}

/* --- Бронь --- */

.equipment-line {
  margin: -12px 0 12px;
  color: var(--muted);
  font-weight: 600;
}

.equipment-picker {
  margin: -6px 0 10px;
}

.days {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(68px, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--graphite);
  color: var(--white);
}

.day-name {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.day strong {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.day[aria-pressed="true"] {
  background: var(--lime);
  color: var(--black);
}

.day[aria-pressed="true"] .day-name {
  color: var(--black);
}

.time-card {
  padding: 12px;
  border-radius: var(--radius-md);
}

.booking-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--menu-height) + 18px + env(safe-area-inset-bottom));
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 536px;
  margin: 0 auto;
  padding: 10px 10px 10px 16px;
  border: 1.5px solid var(--lime);
  border-radius: var(--radius-md);
  background: var(--black);
  box-shadow: 0 8px 24px rgb(0 0 0 / 70%);
}

.bar-text {
  min-width: 0;
}

.bar-range {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--lime);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-duration {
  color: var(--muted);
  font-size: 13px;
}

.booking-bar .btn {
  flex: none;
  padding: 11px 14px;
}

/* --- Профиль --- */

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--lime);
  color: var(--black);
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.nickname {
  margin-top: 2px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--magenta);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.badge.lime {
  background: var(--lime);
  color: var(--black);
}

.badge.outline {
  background: transparent;
  color: var(--lime);
  box-shadow: inset 0 0 0 1.5px var(--lime);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--black);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tag.lime {
  color: var(--lime);
}

.tag.magenta {
  background: var(--magenta);
  color: #ffffff;
}

.user-name {
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 6px;
}

.row-actions .btn {
  width: 100%;
}

.hidden-events > summary {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.user-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 104px;
  padding: 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--black);
  color: var(--white);
  font-size: 14px;
  text-align: left;
}

.tile.tall {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.tile strong {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--lime);
}

.soon {
  color: var(--muted);
  font-size: 13px;
}

div.tile {
  color: var(--muted);
}

.dj-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.course {
  margin-bottom: 10px;
}

.block-title {
  margin-bottom: 4px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
}

/* --- Мероприятия --- */

.event-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--graphite);
  color: var(--white);
  text-align: left;
}

.event-card + .event-card {
  margin-top: 10px;
}

.event-card .text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-card .title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.event-card .date {
  margin-top: 6px;
  color: var(--lime);
  font-size: 14px;
  font-weight: 600;
}

.cover {
  position: relative;
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--black);
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* постера нет: рисуем пластинку в цветах клуба */
.cover .vinyl {
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #030303 0 3px, #202020 3px 5px);
}

.cover .vinyl::after {
  content: "";
  position: absolute;
  inset: 37%;
  border-radius: 50%;
  background: var(--label, var(--lime));
  box-shadow: inset 0 0 0 7px rgb(3 3 3 / 22%);
}

.event-hero {
  width: 100%;
  height: 190px;
}

/* --- Треки --- */

.blank {
  display: flex;
  align-items: center;
  min-height: 56vh;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(25px, 8vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* --- Админка --- */

.back {
  display: inline-flex;
  margin: -6px 0 12px -4px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--lime);
  font-weight: 700;
}

details.card > summary {
  font-weight: 700;
  cursor: pointer;
}

details.card > summary + * {
  margin-top: 14px;
}

.list-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

/* --- Меню, кнопка + и всплывающие окна --- */

.tabs {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  max-width: 536px;
  height: var(--menu-height);
  margin: 0 auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--graphite);
  box-shadow: 0 8px 28px rgb(0 0 0 / 70%);
}

.tabs button {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tabs svg {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tabs svg {
  width: 24px;
  height: 24px;
}

.tabs .icon-lock,
.tabs .locked .icon-open {
  display: none;
}

.tabs .locked .icon-lock {
  display: block;
}

.tabs .locked {
  color: #6f6f6a;
}

.tabs button[aria-current="page"] {
  background: var(--lime);
  color: var(--black);
  font-weight: 700;
}

dialog {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--graphite);
  color: var(--white);
}

dialog::backdrop {
  background: rgb(0 0 0 / 72%);
}

.sheet-body {
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
}

dialog h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

dialog .actions .btn {
  flex: 1;
}

/* --- Выпадающий список --- */

.select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-weight: 600;
  text-align: left;
}

.select::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin: -3px 2px 0;
  border-right: 2px solid var(--lime);
  border-bottom: 2px solid var(--lime);
  transform: rotate(45deg);
}

.select.compact {
  flex: none;
  width: 124px;
  padding: 8px 12px;
  font-size: 14px;
}

.select:disabled {
  opacity: 0.55;
}

.select:disabled::after {
  display: none;
}

.select-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.options {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--black);
  color: var(--white);
  font-weight: 600;
  text-align: left;
}

.option[aria-pressed="true"] {
  background: var(--lime);
  color: var(--black);
  font-weight: 700;
}

.option[aria-pressed="true"]::after {
  content: "";
  flex: none;
  width: 14px;
  height: 7px;
  margin: -3px 2px 0;
  border-left: 2.5px solid currentcolor;
  border-bottom: 2.5px solid currentcolor;
  transform: rotate(-45deg);
}

.field-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  max-width: 100%;
  padding: 8px 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.chip[aria-pressed="true"] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--black);
  font-weight: 700;
}

/* --- Выбор времени --- */

.picked {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--black);
}

.picked-range {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

.picked-duration {
  margin-top: 4px;
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.time-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 54px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile-end {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.7;
}

.time-tile:disabled {
  opacity: 1;
}

.time-tile.free:disabled {
  color: #6f6f6a;
}

.time-tile.busy {
  border-color: transparent;
  background: transparent;
  color: #8a8a84;
  text-decoration: line-through;
}

.time-tile.mine {
  border-color: var(--magenta);
  background: var(--magenta);
  color: #ffffff;
}

/* следующим нажатием выбирают конец брони, поэтому здесь главное «до» */
.time-tile.reachable {
  border-color: var(--lime);
}

.time-tile.reachable .tile-start {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.time-tile.reachable .tile-end {
  color: var(--lime);
  font-size: 15px;
  font-weight: 700;
  opacity: 1;
}

.time-tile.selected {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 30%, var(--black));
  color: var(--white);
}

.time-tile.selected.edge {
  background: var(--lime);
  color: var(--black);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--menu-height) + 96px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: 528px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--white);
  color: var(--black);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgb(0 0 0 / 65%);
}

@media (prefers-reduced-motion: no-preference) {
  dialog[open] {
    animation: sheet-up 180ms ease-out;
  }

  @keyframes sheet-up {
    from {
      transform: translateY(24px);
    }
  }

  .btn,
  .slot,
  .tabs button,
  .event-card,
  .tile {
    transition: transform 120ms ease, background-color 120ms ease;
  }

  button:active:not(:disabled) {
    transform: scale(0.98);
  }
}
