*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #ffffff;
  --color-surface: #f5f5f7;
  --color-border: #e0e0e5;
  --color-text: #111113;
  --color-muted: #6b6b7a;
  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

html, body {
  height: 100%;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-logo-link {
  display: flex;
  align-items: center;
}

.site-logo {
  height: 1.75rem;
  width: auto;
}

.site-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #1c1c1c;
  cursor: pointer;
  transition: background 0.15s;
}

.control-btn:hover {
  background: color-mix(in srgb, #1c1c1c 8%, transparent);
}

.control-icon {
  width: 1.75rem;
  height: 1.75rem;
}

/* ── Font size control ── */

html.font-size-medium {
  font-size: 115%;
}

html.font-size-large {
  font-size: 135%;
}

.font-size-control {
  position: relative;
}

.font-size-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 8rem;
  z-index: 50;
}

.font-size-panel[hidden] {
  display: none;
}

.font-size-option {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

/*
 * Each option is rendered at the exact size the chat text (.chat-bubble,
 * font-size: 0.95rem) will end up at once that tier is applied, i.e.
 * 0.95rem * the html.font-size-* root size. Pinned in px (not rem) so the
 * preview stays accurate no matter which tier is currently active.
 */
.font-size-option[data-font-size="normal"] {
  font-size: 15.2px;
}

.font-size-option[data-font-size="medium"] {
  font-size: 17.48px;
}

.font-size-option[data-font-size="large"] {
  font-size: 20.52px;
}

.font-size-option:hover {
  background: color-mix(in srgb, #1c1c1c 8%, transparent);
}

.font-size-option--active {
  font-weight: 700;
  color: var(--color-accent);
}

/* ── Language control ── */

.lang-control {
  position: relative;
}

.lang-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 0.35rem;
  display: flex;
  flex-direction: row;
  gap: 0.1rem;
  z-index: 50;
}

.lang-panel[hidden] {
  display: none;
}

.lang-option {
  padding: 0.35rem 0.45rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

.lang-option:hover {
  background: color-mix(in srgb, #1c1c1c 8%, transparent);
}

.lang-option--active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 35rem;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1rem 3rem;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
  margin-bottom: 1.5rem;
}

.hero-logo {
  max-width: 70%;
  width: 100%;
  height: auto;
  margin-bottom: 1.25rem;
}

.hero-bottom > p {
  font-size: 1.25rem;
  color: var(--color-muted);
  max-width: 80%;
  margin: 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.hero-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  margin-top: auto;
  width: 100%;
  margin-bottom: 2rem;
}

.goodbye-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  max-width: 26rem;
  margin-top: auto;
  margin-bottom: 2rem;
  text-align: center;
}

.goodbye-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.goodbye-message {
  font-size: 1.1rem;
  color: var(--color-muted);
}

.goodbye-divider {
  width: 70%;
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.5rem 0;
}

.goodbye-footer {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.goodbye-back-button {
  margin-top: 2rem;
}

.help-tile {
  width: 100%;
  max-width: 26rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.help-tile-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.help-tile-body {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: center;
}

.btn-or {
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ── Chat ── */

.chat-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-bubble {
  max-width: 75%;
  padding: 0.6rem 0.9rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-bubble--sent {
  align-self: flex-end;
  background: var(--color-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble--received {
  align-self: flex-start;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 45rem;
  margin: 0 auto;
}

.chat-input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  outline: none;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: var(--color-accent);
}

.chat-input::placeholder {
  color: var(--color-muted);
}

.chat-send-btn {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-send-btn:hover {
  background: var(--color-accent-hover);
}

.chat-send-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Privacy modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--color-bg);
  border-radius: 16px;
  width: 100%;
  max-width: 35rem;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.7;
}

.modal-body h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p,
.modal-body ul {
  margin-bottom: 0.5rem;
}

.modal-body ul {
  padding-left: 1.25rem;
}

.modal-body a {
  color: var(--color-accent);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

body:has(.modal-overlay) {
  overflow: hidden;
}

/* ── Ticket page ── */

.ticket-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
}

.camera-square {
  width: 100%;
  max-width: 23.75rem;
  aspect-ratio: 1;
  background: #111;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

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

.camera-hint {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0 1rem;
}

.camera-square--manual {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.camera-scan-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.15s;
}

.camera-square--manual .camera-scan-btn {
  color: #1c1c1c;
}

.camera-scan-btn:hover {
  color: #fff;
}

.camera-square--manual .camera-scan-btn:hover {
  color: #1c1c1c;
  opacity: 0.7;
}

.camera-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}

.camera-error svg {
  width: 2.5rem;
  height: 2.5rem;
  stroke: currentColor;
  flex-shrink: 0;
}

.camera-error-title {
  font-size: 1rem;
  font-weight: 700;
}

.camera-error-body {
  font-size: 0.9rem;
  line-height: 1.4;
}

.camera-error-link {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
}

.camera-error-link:hover {
  color: #fff;
}

.camera-scan-btn svg {
  width: 3.5rem;
  height: 3.5rem;
  stroke: currentColor;
}

.ticket-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 23.75rem;
}

.ticket-input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  outline: none;
  transition: border-color 0.15s;
}

.ticket-input:focus {
  border-color: var(--color-accent);
}

.ticket-input::placeholder {
  color: var(--color-muted);
}

.ticket-submit {
  white-space: nowrap;
  flex-shrink: 0;
}

.site-flash--error {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: color-mix(in srgb, #ef4444 10%, transparent);
  border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
  color: #b91c1c;
  font-size: 0.9rem;
}

.ticket-page .site-flash--error,
.ticket-page .help-tile {
  width: 100%;
  max-width: 23.75rem;
}

/* ── Typing indicator ── */

.chat-typing-bubble {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.875rem;
  min-width: 3rem;
}

.chat-typing-bubble span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--color-muted);
  animation: typing-dot 1.2s infinite ease-in-out;
}

.chat-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-0.35rem); opacity: 1; }
}

/* ── Chat options (interactive list / reply buttons) ── */

.chat-options-text {
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.chat-option-btn {
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: 1.5px solid var(--color-accent);
  border-radius: 20px;
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chat-option-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.chat-option-btn--selected {
  background: var(--color-accent);
  color: #fff;
}

.chat-option-btn:disabled:not(.chat-option-btn--selected) {
  border-color: var(--color-border);
  color: var(--color-muted);
  cursor: default;
}

/* ── Footer (kept for reference) ── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-top: auto;
}
