:root {
  --bg: #0c0c0e;
  --card: #1b1b1f;
  --card-2: #232328;
  --gold: #f2b705;
  --gold-soft: #d4a017;
  --text: #f5f5f5;
  --text-dim: #9a9a9f;
  --danger: #ff5a5f;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 90px;
  min-height: 100vh;
}

.logo {
  text-align: center;
  padding: 20px 0 12px;
}

.logo-text {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
}

.logo-text span { color: var(--gold-soft); }

.logo-tagline {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold-soft);
  text-transform: uppercase;
}

.view { display: none; }
.view.active { display: block; }

.view-title {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0 16px;
}

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

.calc-row {
  background: var(--card-2);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
}

.calc-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

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

.calc-input-row input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 26px;
  font-weight: 600;
  width: 100%;
  outline: none;
}

.currency-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2e2e35;
  border: none;
  color: var(--text);
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.chevron { color: var(--text-dim); font-size: 11px; }

.currency-select.disabled-pick {
  cursor: default;
  opacity: 0.7;
}
.currency-select.disabled-pick .chevron { display: none; }

.swap-btn {
  display: block;
  margin: -4px auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid #36363c;
  color: var(--gold);
  font-size: 16px;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.rate-line {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 14px 0 16px;
  text-decoration: line-through;
  text-decoration-color: transparent;
}

.continue-btn {
  width: 100%;
  background: var(--gold);
  color: #1a1400;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}

.continue-btn:active { opacity: 0.85; }

.warning-line {
  text-align: center;
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 10px;
}

.operator-btn {
  width: 100%;
  margin-top: 14px;
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  padding: 13px;
  cursor: pointer;
}

.operator-btn:active { background: rgba(242, 183, 5, 0.12); }

.info-list { display: flex; flex-direction: column; gap: 10px; }

.info-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.rate-card, .branch-card, .booking-card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 16px;
}

.rate-card-top, .booking-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 4px;
}

.rate-card-sub, .booking-card-sub, .branch-card-sub {
  font-size: 13px;
  color: var(--text-dim);
}

.menu-grid {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid #2a2a2f;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 18px;
  padding: 6px 2px;
  cursor: pointer;
}

.menu-btn span { font-size: 10px; color: inherit; }

.menu-btn.active { color: var(--gold); }

.picker {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}

.picker.hidden { display: none; }

.picker-sheet {
  background: var(--card);
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 16px;
}

.picker-title {
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.picker-item {
  padding: 12px 8px;
  font-size: 16px;
  border-bottom: 1px solid #2a2a2f;
  cursor: pointer;
}

.picker-close {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: var(--card-2);
  color: var(--text);
  border: none;
  border-radius: 12px;
  font-weight: 600;
}

/* ---------- Step overlay (чат / флоу бронювання) ---------- */

.step-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* На мобільних Telegram-клієнтах 100vh/inset:0 не стискається разом з появою
     клавіатури (visual viewport), через що поле вводу ховається під нею.
     --app-height підтримується скриптом (Telegram.WebApp.viewportHeight або
     visualViewport.resize) і завжди відповідає реальній видимій висоті. */
  height: var(--app-height, 100vh);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 40;
  max-width: 480px;
  margin: 0 auto;
}

.step-overlay.hidden { display: none; }

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #232328;
  flex-shrink: 0;
}

.step-back {
  background: var(--card-2);
  border: none;
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.step-title { font-weight: 700; font-size: 16px; }

.step-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  flex-direction: column;
}

.step-pane.active { display: flex; }

/* Chat — лише внутрішня стрічка повідомлень скролиться, поле вводу завжди
   закріплене знизу видимої області (важливо при відкритій клавіатурі) */
#step-chat { overflow-y: hidden; }

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-bottom: 8px;
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.msg-bot {
  align-self: flex-start;
  background: var(--card);
  border-bottom-left-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  background: var(--gold);
  color: #1a1400;
  border-bottom-right-radius: 4px;
}

.msg-typing { color: var(--text-dim); font-style: italic; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  flex-shrink: 0;
}

.chat-input-row input {
  flex: 1;
  background: var(--card-2);
  border: none;
  color: var(--text);
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14.5px;
  outline: none;
}

#chat-send {
  background: var(--gold);
  border: none;
  color: #1a1400;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Booking options / branch list / phone / confirm / success */

#options-summary {
  margin-bottom: 28px;
}

#options-summary .summary-row {
  padding: 10px 0;
  font-size: 17px;
}

#options-summary .summary-row .label { font-size: 15px; }

.option-btn {
  width: 100%;
  text-align: left;
  background: var(--gold);
  border: none;
  color: #1a1400;
  border-radius: 14px;
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  cursor: pointer;
}

.option-btn:active { background: var(--gold-soft); }

.branch-pick-card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 10px;
  cursor: pointer;
}

.branch-pick-card:active { background: var(--card-2); }

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid #28282d;
}

.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: var(--text-dim); }
.summary-row .value { font-weight: 600; text-align: right; }
