/* TinkySpeak Kiosk — Styles */

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

:root {
  --f-sans: 'General Sans', system-ui, -apple-system, sans-serif;
  --header-color: #2E5090;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --surface: #ffffff;
  --surface-alt: #f5f6f8;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  font-family: var(--f-sans);
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ═══ Layout ═══ */
.kiosk-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ═══ Header ═══ */
.kiosk-header {
  background: var(--header-color);
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-height: 56px;
}

.header-back {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.header-back:active { background: rgba(255,255,255,0.3); }
.header-back.visible { display: flex; align-items: center; justify-content: center; }

.header-info { flex: 1; min-width: 0; }
.header-name {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-subtitle {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-board-title {
  display: none;
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.85;
  margin-top: 1px;
}

/* Header controls — language selector + action buttons */
.header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Legacy icon buttons (settings, QR) */
.header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.header-btn:active { background: rgba(255,255,255,0.3); }

/* Language selector dropdown */
.lang-select {
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  background: rgba(232,163,61,0.15);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e8a33d;
  border: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-family: var(--f-sans);
}
.lang-select:focus { outline: none; }

.lang-arrow {
  color: rgba(232,163,61,0.4);
  font-size: 0.8rem;
  pointer-events: none;
}

/* ═══ Sentence Bar ═══ */
.sentence-bar {
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 600;
  color: var(--header-color);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sentence-bar:empty::after {
  content: 'Tap a tile to speak';
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85rem;
}

/* ═══ Tile Grid ═══ */
.tile-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

/* ═══ Tiles — white cards with colored borders ═══ */
.kiosk-tile {
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring), opacity 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
  background: #fff;
  border: 2px solid #e5e7eb;
  min-height: 110px;
}
.kiosk-tile:active { transform: scale(0.95); }
.kiosk-tile:focus-visible {
  outline: 3px solid var(--header-color);
  outline-offset: 2px;
}

.tile-emoji {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  line-height: 1;
  padding: 0.5rem 0;
  min-height: 70px;
  background: transparent;
}
.tile-label {
  padding: 8px 6px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.15;
  background: inherit;
}
.tile-subtitle {
  font-size: 0.6rem;
  font-weight: 500;
  opacity: 0.85;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

/* Bilateral translated subtitle */
.tile-translated {
  font-size: 0.55rem;
  font-weight: 500;
  opacity: 0.7;
  text-transform: none;
  margin-top: 2px;
  color: #fff;
}

/* Label strip colors */
.tile-blue .tile-label     { background: #2563eb; }
.tile-green .tile-label    { background: #16a34a; }
.tile-red .tile-label      { background: #dc2626; }
.tile-orange .tile-label   { background: #ea580c; }
.tile-purple .tile-label   { background: #7c3aed; }
.tile-pink .tile-label     { background: #db2777; }
.tile-yellow .tile-label   { background: #ca8a04; }
.tile-teal .tile-label     { background: #0d9488; }
.tile-gray .tile-label     { background: #6b7280; }
.tile-indigo .tile-label   { background: #4338ca; }

/* Tile border colors */
.tile-blue     { border-color: #2563eb; }
.tile-green    { border-color: #16a34a; }
.tile-red      { border-color: #dc2626; }
.tile-orange   { border-color: #ea580c; }
.tile-purple   { border-color: #7c3aed; }
.tile-pink     { border-color: #db2777; }
.tile-yellow   { border-color: #ca8a04; }
.tile-teal     { border-color: #0d9488; }
.tile-gray     { border-color: #6b7280; }
.tile-indigo   { border-color: #4338ca; }

/* AI-generated tiles */
.tile-ai       { background: #475569; }
.tile-ai .tile-emoji { background: #64748b; }

/* Speak flash animation */
.tile-speak-flash { animation: tilePulse 0.3s ease; }
@keyframes tilePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37,99,235,0.4); }
  50% { transform: scale(0.92); box-shadow: 0 0 0 8px rgba(37,99,235,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}

/* AI loading shimmer */
.tile-grid.ai-loading {
  animation: aiGridPulse 1.4s ease-in-out infinite;
}
@keyframes aiGridPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37,99,235,0.15); border-radius: var(--radius); }
  50% { box-shadow: 0 0 0 4px rgba(37,99,235,0.4); }
}

/* ═══ Input Bar ═══ */
.input-bar {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0;
}

/* Tap to Communicate / Listen button */
.tap-to-speak-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 10px 16px 6px;
  padding: 14px;
  border: none;
  border-radius: 28px;
  background: linear-gradient(135deg, #4A90D9, #2979D6);
  box-shadow: 0 2px 8px rgba(41,121,214,0.3);
  color: #fff;
  font-family: var(--f-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.tap-to-speak-btn:active { opacity: 0.9; }
.tap-to-speak-btn.listening {
  background: linear-gradient(135deg, #E53935, #D32F2F);
  box-shadow: 0 2px 8px rgba(229,57,53,0.35);
}

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 4px 16px 6px;
}

/* Clear button */
.clear-btn {
  padding: 12px 16px;
  background: #E53935;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: var(--f-sans);
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.clear-btn:active { opacity: 0.85; }

/* Send button */
.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: none;
  background: #4A90D9;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.send-btn:active { opacity: 0.85; }

/* Transcript toggle */
.transcript-toggle {
  display: block;
  margin: 4px auto;
  padding: 4px 14px;
  background: none;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  color: #9ca3af;
  font-size: 0.65rem;
  font-family: var(--f-sans);
  cursor: pointer;
  transition: opacity 0.2s;
}
.transcript-toggle:active { opacity: 0.7; }

.quick-tiles {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 6px 16px 10px;
}
.quick-tile {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: var(--f-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.quick-tile:active { background: var(--header-color); color: #fff; border-color: var(--header-color); }

.bottom-nav {
  display: flex;
  justify-content: space-around;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: #9e9e9e;
  font-family: var(--f-sans);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 12px;
}
.nav-item.active { color: var(--header-color); }
.nav-item svg { opacity: 0.6; }
.nav-item.active svg { opacity: 1; }

.mic-btn {
  display: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mic-btn:active { background: var(--header-color); color: #fff; }
.mic-btn.listening {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
  animation: micPulse 1.2s ease infinite;
}
@keyframes micPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.text-input {
  flex: 1;
  height: 48px;
  border-radius: 24px;
  border: 2px solid var(--border);
  background: #fff;
  padding: 0 1rem;
  font-family: var(--f-sans);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.text-input:focus { border-color: var(--header-color); }
.text-input::placeholder { color: var(--text-muted); }

/* ═══ Listen Overlay (full-screen STT) ═══ */
.listen-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  padding: 40px 20px;
  gap: 16px;
}
.listen-overlay.active { display: flex; }

.listen-overlay-icon {
  font-size: 100px;
  animation: micPopupPulse 1.5s ease infinite;
}

.listen-overlay-label {
  font-size: 1.2rem;
  font-weight: 700;
  color: #4A90D9;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.listen-overlay-transcript {
  font-size: 1.1rem;
  color: #6b7280;
  min-height: 32px;
  text-align: center;
}

.listen-mic-submit {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #43A047, #2E7D32);
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.listen-mic-check {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: #2E7D32;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listen-skip-btn {
  padding: 8px 20px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 20px;
  background: none;
  color: #9ca3af;
  font-size: 0.7rem;
  font-family: var(--f-sans);
  cursor: pointer;
}

@keyframes micPopupPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.75; }
}

/* ═══ Language Picker Modal ═══ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.3s var(--ease-spring);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #d1d5db;
  margin: 10px auto 6px;
}
.modal-title {
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  padding: 0.5rem 1rem;
  color: var(--text);
}
.modal-search {
  margin: 0 1rem 0.5rem;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 0.75rem;
  font-family: var(--f-sans);
  font-size: 0.85rem;
  outline: none;
  width: calc(100% - 2rem);
}
.modal-search:focus { border-color: var(--header-color); }

.lang-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.75rem 1rem;
  -webkit-overflow-scrolling: touch;
}
.lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
  color: var(--text);
}
.lang-item:active { background: #f0f0f0; }
.lang-item.selected { background: rgba(37,99,235,0.08); color: var(--header-color); font-weight: 700; }
.lang-item-flag { font-size: 1.3rem; }
.lang-item-name { flex: 1; }
.lang-item-code { font-size: 0.6rem; color: var(--text-muted); }

/* ═══ QR Modal ═══ */
.qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.qr-modal.open { display: flex; }
.qr-box {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.3s var(--ease-spring);
}
.qr-box canvas { display: block; margin: 0 auto 1rem; }
.qr-title { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.qr-url { font-size: 0.65rem; color: var(--text-muted); word-break: break-all; max-width: 250px; }
.qr-close {
  margin-top: 1rem;
  padding: 8px 24px;
  border-radius: 20px;
  border: none;
  background: var(--header-color);
  color: #fff;
  font-family: var(--f-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* ═══ Settings Modal ═══ */
.settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.settings-modal.open { display: flex; }
.settings-box {
  background: #fff;
  border-radius: 20px;
  padding: 1.5rem;
  width: 90%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.settings-title { font-size: 1rem; font-weight: 800; margin-bottom: 1rem; }
.settings-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.25rem; }
.settings-input {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 0.75rem;
  font-family: var(--f-sans);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  outline: none;
}
.settings-input:focus { border-color: var(--header-color); }
.settings-btns { display: flex; gap: 0.5rem; justify-content: flex-end; }
.settings-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  font-family: var(--f-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.settings-btn.primary { background: var(--header-color); color: #fff; }
.settings-btn.secondary { background: var(--surface-alt); color: var(--text); }

/* ═══ Offline Banner ═══ */
.offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 6px 1rem;
  background: #92400e;
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.offline-banner.visible { display: block; }

/* ═══ Chat bubbles ═══ */
.chat-area {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.chat-area.visible { display: flex; }

.chat-bubble {
  max-width: 90%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: bubbleIn 0.3s var(--ease-spring);
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Question bubble (formerly bubble-ai) */
.bubble-question,
.bubble-ai {
  align-self: flex-start;
  background: rgba(0,0,0,0.04);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Response bubble (formerly bubble-user) */
.bubble-response,
.bubble-user {
  align-self: flex-end;
  background: #22c55e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ═══ Responsive ═══ */
@media (min-width: 600px) {
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .tile-emoji { font-size: 3.2rem; }
  .kiosk-tile { min-height: 130px; }
}

@media (min-width: 900px) {
  .tile-grid { max-width: 720px; }
  .tile-emoji { font-size: 3.5rem; }
}

/* ═══ Demo Walkthrough ═══ */
.demo-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  overflow: hidden;
}
.demo-overlay.visible { opacity: 1; }
.demo-overlay.fade-out { opacity: 0; pointer-events: none; }

.demo-intro-card {
  background: #fff;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: demoCardIn 0.6s var(--ease-spring);
}
@keyframes demoCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.demo-logo {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--header-color);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}
.demo-logo-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.demo-tagline {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.demo-bullets {
  text-align: left;
  margin: 0 auto 1.25rem;
  max-width: 300px;
  list-style: none;
}
.demo-bullets li {
  font-size: 0.82rem;
  color: var(--text);
  padding: 0.3rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.demo-bullets li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--header-color);
  flex-shrink: 0;
}
.demo-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--header-color);
  margin-bottom: 1.5rem;
}
.demo-start-btn {
  display: inline-block;
  padding: 14px 48px;
  border-radius: 28px;
  border: none;
  background: var(--header-color);
  color: #fff;
  font-family: var(--f-sans);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  margin-bottom: 0.75rem;
}
.demo-start-btn:active { transform: scale(0.96); }
.demo-skip {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--f-sans);
  margin: 0 auto;
}

.demo-sentence-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 499;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: rgba(15, 23, 42, 0.95);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.demo-sentence-overlay.visible { opacity: 1; pointer-events: auto; }

.demo-typewriter {
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  max-width: 380px;
  padding: 0 1.5rem;
  line-height: 1.6;
  min-height: 3em;
}
.demo-typewriter .cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: rgba(255,255,255,0.7);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: demoBlink 0.8s step-end infinite;
}
@keyframes demoBlink { 50% { opacity: 0; } }

.demo-qr-scene {
  position: fixed;
  inset: 0;
  z-index: 498;
  background: rgba(15, 23, 42, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.demo-qr-scene.visible { opacity: 1; pointer-events: auto; }

.demo-phone {
  width: 180px;
  height: 340px;
  border-radius: 28px;
  border: 4px solid #555;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  transition: transform 0.8s var(--ease-spring), opacity 0.4s ease;
}
.demo-phone canvas { border-radius: 4px; }
.demo-phone-label {
  position: absolute;
  bottom: -2.5rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  white-space: nowrap;
}
.demo-scan-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
  border-radius: 2px;
  top: 20%;
  animation: demoScanLine 1.5s ease-in-out infinite;
}
@keyframes demoScanLine {
  0%, 100% { top: 20%; }
  50% { top: 75%; }
}

.demo-tile-highlight {
  box-shadow: 0 0 0 4px rgba(37,99,235,0.6), 0 0 20px rgba(37,99,235,0.3) !important;
  transition: box-shadow 0.3s ease !important;
}

.demo-staff-bubble {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 497;
  background: #fff;
  color: var(--text);
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  max-width: 340px;
  width: 85%;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-spring);
}
.demo-staff-bubble.visible { opacity: 1; }
.demo-staff-bubble::before {
  content: 'Staff:';
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--header-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.demo-closing {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  padding: 2rem;
}
.demo-closing.visible { opacity: 1; pointer-events: auto; }
.demo-closing-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  max-width: 360px;
  line-height: 1.5;
}
.demo-closing-qr {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
}
.demo-closing-qr canvas { display: block; margin: 0 auto 0.75rem; }
.demo-closing-cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
  text-align: center;
}
.demo-closing-contact {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}
.demo-closing-contact a {
  color: #93c5fd;
  text-decoration: none;
}
.demo-closing-dismiss {
  padding: 12px 40px;
  border-radius: 24px;
  border: 2px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #fff;
  font-family: var(--f-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}
.demo-closing-dismiss:active { background: rgba(255,255,255,0.1); }

/* ═══ Settings Pills ═══ */
.settings-pill {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-family: var(--f-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.settings-pill.active {
  background: var(--header-color);
  color: #fff;
  border-color: var(--header-color);
}

/* ═══ Dark Mode ═══ */
body.dark-mode {
  background: #0d0b10;
  color: #e8e8ed;
  --surface: #0d0b10;
  --surface-alt: #1c1a22;
  --text: #e8e8ed;
  --text-muted: #aaaaaa;
  --border: rgba(255,255,255,0.08);
}
body.dark-mode .kiosk-tile {
  background: #1c1a22;
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
body.dark-mode .sentence-bar { background: rgba(255,255,255,0.06); color: #f4c97b; }
body.dark-mode .text-input { background: #1c1a22; color: #e8e8ed; border-color: rgba(255,255,255,0.12); }
body.dark-mode .text-input::placeholder { color: rgba(255,255,255,0.3); }
body.dark-mode .quick-tile { background: #1c1a22; color: #aaa; border-color: rgba(255,255,255,0.08); }
body.dark-mode .settings-box { background: #1c1a22; color: #e8e8ed; }
body.dark-mode .settings-pill { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.6); border-color: rgba(255,255,255,0.08); }
body.dark-mode .settings-pill.active { background: #e8a33d; color: #000; border-color: #e8a33d; }
body.dark-mode .settings-input { background: rgba(255,255,255,0.06); color: #e8e8ed; border-color: rgba(255,255,255,0.1); }
body.dark-mode .clear-btn { background: #C62828; }

/* ═══ Outline Tile Mode ═══ */
.tile-grid.outline-mode .kiosk-tile {
  background: transparent !important;
}
.tile-grid.outline-mode .tile-label {
  background: transparent !important;
}
.tile-grid.outline-mode .tile-blue .tile-label { color: #2563eb; }
.tile-grid.outline-mode .tile-green .tile-label { color: #16a34a; }
.tile-grid.outline-mode .tile-red .tile-label { color: #dc2626; }
.tile-grid.outline-mode .tile-orange .tile-label { color: #ea580c; }
.tile-grid.outline-mode .tile-purple .tile-label { color: #7c3aed; }
.tile-grid.outline-mode .tile-pink .tile-label { color: #db2777; }
.tile-grid.outline-mode .tile-yellow .tile-label { color: #ca8a04; }
.tile-grid.outline-mode .tile-teal .tile-label { color: #0d9488; }
.tile-grid.outline-mode .tile-gray .tile-label { color: #6b7280; }
.tile-grid.outline-mode .tile-indigo .tile-label { color: #4338ca; }

/* ═══ Read on Focus — highlight ═══ */
body.read-on-focus .kiosk-tile:focus {
  box-shadow: 0 0 0 3px rgba(232,163,61,0.6), 0 0 20px rgba(232,163,61,0.3);
}

/* Demo burst-in animation for tiles */
@keyframes demoBurstIn {
  0% { opacity: 0; transform: scale(0.3) rotate(-8deg); }
  60% { opacity: 1; transform: scale(1.08) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
