/* Telegram Mini App only — does not affect the website (body.is-telegram) */

body.is-telegram {
  --tg-header-h: 44px;
  --tg-tabs-h: calc(46px + var(--safe-bottom));
  --tg-bar-h: 42px;
  --header-h: var(--tg-header-h);
  --tabs-h: var(--tg-tabs-h);
}

body.is-telegram .header {
  padding: 0.4rem 0.65rem;
  min-height: var(--tg-header-h);
  gap: 0.35rem;
}

body.is-telegram .header__icon,
body.is-telegram .header__subtitle {
  display: none;
}

body.is-telegram .header h1 {
  font-size: 0.95rem;
  line-height: 1.2;
}

body.is-telegram .header__brand {
  flex: 1;
  min-width: 0;
}

body.is-telegram .header__actions {
  width: auto;
  flex-shrink: 0;
  gap: 0.65rem;
}

body.is-telegram .header__stats {
  gap: 0.5rem;
}

body.is-telegram .stat__value {
  font-size: 0.95rem;
}

body.is-telegram .stat__label {
  font-size: 0.55rem;
}

body.is-telegram .mobile-tabs {
  padding: 0.3rem 0.5rem calc(0.3rem + var(--safe-bottom));
  gap: 0.25rem;
}

body.is-telegram .mobile-tabs__btn {
  min-height: 38px;
  padding: 0.25rem;
  font-size: 0.65rem;
  border-radius: 10px;
}

body.is-telegram .mobile-tabs__icon {
  font-size: 0.9rem;
}

body.is-telegram .panel {
  padding: 0.5rem;
}

body.is-telegram .panel--editor,
body.is-telegram .panel--hall {
  height: calc(var(--app-height) - var(--tg-header-h) - var(--tg-tabs-h));
  max-height: calc(var(--app-height) - var(--tg-header-h) - var(--tg-tabs-h));
}

body.is-telegram.layout-hall-tab .panel--hall {
  height: calc(var(--app-height) - var(--tg-header-h) - var(--tg-tabs-h) - var(--tg-bar-h));
  max-height: calc(var(--app-height) - var(--tg-header-h) - var(--tg-tabs-h) - var(--tg-bar-h));
}

body.is-telegram .panel--hall .panel__section-head {
  display: none;
}

body.is-telegram #hall-toolbar {
  display: none !important;
}

body.is-telegram .hall {
  padding-bottom: 0;
}

body.is-telegram .hall__quick-list {
  display: flex;
  padding: 0.35rem 0 0;
  margin: 0;
}

body.is-telegram .hall-quick-chip {
  font-size: 0.68rem;
  padding: 0.35rem 0.6rem;
}

body.is-telegram .hall-table__label {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
}

body.is-telegram .hall-table__label::before {
  content: "№";
  font-size: 0.55em;
  font-weight: 700;
  vertical-align: super;
  margin-right: 0.05em;
}

body.is-telegram .hall-table__count {
  font-size: 0.55rem;
  margin-top: 0.1rem;
}

body.is-telegram .hall:not(.hall--layout-mode) .hall-table {
  cursor: grab;
  touch-action: none;
}

body.is-telegram .modal__nudge {
  display: none !important;
}

body.is-telegram .tg-hall-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tg-tabs-h);
  z-index: 30;
  height: var(--tg-bar-h);
  padding: 0 0.4rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

body.is-telegram.layout-hall-tab .tg-hall-bar {
  display: flex;
}

body.is-telegram .tg-hall-bar__btn {
  flex-shrink: 0;
  min-width: 40px;
  height: 34px;
  padding: 0 0.45rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

body.is-telegram .tg-hall-bar__btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: var(--tg-button-text, #fff);
}

body.is-telegram .tg-hall-bar__zoom {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  justify-content: center;
  max-width: 140px;
}

body.is-telegram .tg-hall-bar__zoom button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 1.1rem;
  color: var(--text);
  touch-action: manipulation;
}

body.is-telegram .tg-hall-bar__zoom span {
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

body.is-telegram .guest-field {
  grid-template-columns: 22px 1fr auto;
  gap: 0.35rem;
}

body.is-telegram .guest-field__drag {
  display: none;
}

body.is-telegram .guest-field__actions {
  display: flex;
}

body.is-telegram .modal__guests-hint--desktop {
  display: none;
}

body.is-telegram .modal__guests-hint--mobile {
  display: inline;
}

body.is-telegram .modal__nudge {
  display: grid;
}

body.is-telegram .hall__resize-handle--corner {
  width: 36px;
  height: 36px;
}

body.is-telegram .hall__resize-handle--east {
  width: 22px;
  height: 56px;
  margin-top: -28px;
}

body.is-telegram .hall__resize-handle--south {
  width: 56px;
  height: 22px;
  margin-left: -28px;
}

body.is-telegram .hall__floor-size {
  font-size: 0.58rem;
  padding: 0.15rem 0.35rem;
}

body.is-telegram .panel__section {
  padding: 0.65rem;
}

body.is-telegram .setup-toggle {
  padding: 0.65rem 0.7rem;
  font-size: 1rem;
}

body.is-telegram .table-card__header {
  gap: 0.35rem;
}

/* More options sheet */
.tg-sheet {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  align-items: flex-end;
}

.tg-sheet[hidden] {
  display: none;
}

.tg-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 36, 25, 0.4);
}

.tg-sheet__panel {
  position: relative;
  width: 100%;
  padding: 0.75rem 0.75rem calc(0.75rem + var(--safe-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.35rem;
}

.tg-sheet__title {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tg-sheet__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tg-sheet__row-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.tg-sheet__row-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tg-sheet__btn {
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  touch-action: manipulation;
}

.tg-sheet__btn--block {
  width: 100%;
}

.tg-sheet__btn:active {
  background: var(--accent-soft);
}
