:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: #ffffff;
  --surface-soft: #fbf8f2;
  --text: #221d1c;
  --muted: #746b67;
  --line: #e8dfd7;
  --primary: #8f2f3f;
  --primary-dark: #68202d;
  --primary-soft: #f7e8eb;
  --success: #1f7a54;
  --success-soft: #e8f5ee;
  --warning: #a45d0d;
  --danger: #b22f35;
  --shadow: 0 18px 50px rgba(56, 39, 32, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(143, 47, 63, 0.08), transparent 32rem),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(143, 47, 63, 0.25);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  max-width: 1440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.widget-frame {
  overflow: hidden;
  min-height: calc(100vh - 48px);
  border: 1px solid rgba(143, 47, 63, 0.08);
  border-radius: 28px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  box-shadow: 0 8px 22px rgba(143, 47, 63, 0.25);
  font-weight: 800;
}

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

.brand-title,
.brand-subtitle {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.icon-button,
.ghost-button,
.secondary-button,
.primary-button,
.danger-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 15px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

.icon-button,
.ghost-button {
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
}

.icon-button:hover,
.ghost-button:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 9px 24px rgba(143, 47, 63, 0.22);
  font-weight: 800;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.danger-button {
  border: 1px solid rgba(178, 47, 53, 0.22);
  color: var(--danger);
  background: #fff5f5;
  font-weight: 700;
}

.full-width {
  width: 100%;
}

.content {
  padding: 24px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 310px;
  border-radius: 22px;
  background: #20372d;
  color: #fff;
}

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

.hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(17, 23, 20, 0.9), rgba(17, 23, 20, 0.42) 58%, rgba(17, 23, 20, 0.1));
  content: "";
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 310px;
  max-width: 720px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #e9c9a7;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.hero-description {
  max-width: 610px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 1.65;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.section-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.session-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.session-card:hover {
  transform: translateY(-2px);
  border-color: rgba(143, 47, 63, 0.35);
  box-shadow: 0 12px 30px rgba(56, 39, 32, 0.08);
}

.session-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(143, 47, 63, 0.09);
}

.session-date {
  display: grid;
  width: 58px;
  height: 64px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.session-day {
  margin-top: 6px;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
}

.session-month {
  margin-top: -6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session-info strong,
.session-info span {
  display: block;
}

.session-info strong {
  margin-bottom: 5px;
}

.session-info span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.session-price {
  color: var(--primary-dark);
  font-weight: 900;
  white-space: nowrap;
}

.booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(56, 39, 32, 0.05);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

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

.panel-body {
  padding: 20px;
}

.stage-wrap {
  overflow: hidden;
  padding: 8px 8px 24px;
}

.stage {
  width: min(560px, 80%);
  height: 34px;
  margin: 0 auto 28px;
  border-radius: 0 0 60% 60%;
  background: linear-gradient(180deg, #45302b, #241715);
  color: #fff;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 30px;
  text-transform: uppercase;
  box-shadow: 0 16px 30px rgba(37, 23, 20, 0.22);
}

.seat-map {
  overflow: auto;
  min-height: 410px;
  padding: 8px 10px 24px;
  scrollbar-width: thin;
}

.seat-row {
  display: grid;
  grid-template-columns: 22px repeat(12, 32px) 22px;
  justify-content: center;
  gap: 7px;
  margin-bottom: 9px;
}

.row-label {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.seat {
  position: relative;
  display: grid;
  width: 32px;
  height: 29px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px 9px 6px 6px;
  padding: 0;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.13s ease, box-shadow 0.13s ease, opacity 0.13s ease;
}

.seat:hover:not(:disabled) {
  transform: scale(1.16);
  box-shadow: 0 7px 16px rgba(56, 39, 32, 0.2), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.seat[data-category="Партер Premium"] {
  background: #8f2f3f;
}

.seat[data-category="Партер"] {
  background: #c1763f;
}

.seat[data-category="Балкон"] {
  background: #4d7894;
}

.seat.selected {
  color: #1e2b22;
  background: #f5d36d;
  box-shadow: 0 0 0 3px rgba(245, 211, 109, 0.32), inset 0 -4px 0 rgba(0, 0, 0, 0.1);
}

.seat.sold,
.seat.unavailable {
  color: #99918c;
  background: #ded9d5;
  box-shadow: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--dot);
}

.cart-panel {
  position: sticky;
  top: 16px;
}

.reservation-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 12px;
  font-weight: 700;
}

.reservation-timer.warning {
  color: var(--warning);
  background: #fff2dc;
}

.cart-empty {
  padding: 28px 10px;
  color: var(--muted);
  text-align: center;
}

.cart-empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-soft);
  font-size: 24px;
}

.cart-list {
  display: grid;
  gap: 10px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.cart-item:last-child {
  border-bottom: 0;
}

.cart-item-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
}

.cart-item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.cart-item-price {
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.remove-link {
  border: 0;
  padding: 2px 0;
  color: var(--danger);
  background: transparent;
  font-size: 11px;
}

.totals {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.total-row strong {
  color: var(--text);
}

.total-row.grand {
  align-items: baseline;
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.total-row.grand strong {
  font-size: 22px;
}

.promo-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 15px 0;
}

.field,
.select-field {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
}

.field::placeholder {
  color: #a39b96;
}

.field.error {
  border-color: var(--danger);
}

.field-message {
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 11px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
}

.form-group.full {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.checkbox-row input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--primary);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px;
  background: var(--surface);
}

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

.stepper-info strong,
.stepper-info span {
  display: block;
}

.stepper-info span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.stepper-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-soft);
  font-weight: 900;
}

.stepper-count {
  min-width: 22px;
  text-align: center;
  font-weight: 900;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.checkout-section + .checkout-section {
  margin-top: 16px;
}

.payment-options {
  display: grid;
  gap: 10px;
}

.payment-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
}

.payment-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.payment-option input {
  accent-color: var(--primary);
}

.test-note,
.alert {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
}

.test-note {
  margin-top: 12px;
  color: var(--muted);
  background: var(--surface-soft);
}

.alert {
  margin-bottom: 14px;
  color: var(--danger);
  background: #fff0f0;
}

.alert.success {
  color: var(--success);
  background: var(--success-soft);
}

.loading {
  display: grid;
  min-height: 420px;
  place-items: center;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-page {
  display: grid;
  min-height: 610px;
  place-items: center;
  padding: 42px 20px;
}

.success-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.success-icon {
  display: grid;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-size: 34px;
  box-shadow: 0 12px 30px rgba(31, 122, 84, 0.25);
}

.success-card h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.03em;
}

.success-card > p {
  max-width: 520px;
  margin: 12px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

.order-number {
  display: inline-flex;
  margin-top: 18px;
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 900;
}

.ticket-list {
  display: grid;
  gap: 10px;
  margin: 24px 0;
  text-align: left;
}

.ticket-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px dashed #cdbeb5;
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-soft);
}

.ticket-card strong,
.ticket-card span {
  display: block;
}

.ticket-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ticket-code {
  display: grid;
  grid-template-columns: repeat(5, 4px);
  gap: 3px;
  width: 42px;
  height: 42px;
  align-content: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
}

.ticket-code i {
  width: 4px;
  height: 4px;
  background: #171313;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.toast-region {
  position: fixed;
  z-index: 1000;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
}

.toast {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 13px;
  padding: 12px 14px;
  color: #fff;
  background: #2c2624;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  animation: toast-in 0.18s ease-out;
}

.toast.error {
  background: var(--danger);
}

.toast.success {
  background: var(--success);
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0, 0, 0, 0);
}

.embed-preview {
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 20px;
}

.embed-preview h1 {
  margin-bottom: 6px;
}

.embed-preview > p {
  color: var(--muted);
}

.embed-container {
  min-height: 700px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .booking-layout,
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }

  .session-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 0;
  }

  .widget-frame {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    min-height: 60px;
    padding: 10px 14px;
  }

  .brand-subtitle,
  .top-actions .ghost-button span {
    display: none;
  }

  .content {
    padding: 14px;
  }

  .hero,
  .hero-content {
    min-height: 340px;
  }

  .hero {
    border-radius: 18px;
  }

  .hero::after {
    background: linear-gradient(0deg, rgba(17, 23, 20, 0.92), rgba(17, 23, 20, 0.18) 80%);
  }

  .hero-content {
    padding: 22px;
  }

  .hero h1 {
    font-size: 46px;
  }

  .section-title {
    font-size: 19px;
  }

  .session-card {
    grid-template-columns: auto 1fr;
  }

  .session-price {
    grid-column: 2;
  }

  .panel-body {
    padding: 14px;
  }

  .seat-map {
    margin: 0 -14px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .seat-row {
    min-width: 530px;
  }

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

  .form-group.full {
    grid-column: auto;
  }

  .success-card {
    padding: 26px 18px;
  }

  .success-card h1 {
    font-size: 27px;
  }

  .success-actions {
    flex-direction: column;
  }

  .success-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
