* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --bg: #0b0f19;
  --panel: #111927;
  --panel-2: #161c2a;
  --border: rgba(255,255,255,.08);
  --accent: #ffb020;
  --accent-ink: #241703;
  --cyan: #00d9d9;
  --text: #f5f7fb;
  --text-soft: #a6b0c3;
  --green: #10b981;
}
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
}

.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; border-bottom: 1px solid var(--border); }
.back-link { color: var(--text-soft); text-decoration: none; font-size: .85rem; }
.back-link:hover { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 40px 24px 80px; }

.intro { max-width: 720px; margin: 0 auto 40px; text-align: center; }
.intro-eyebrow { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.intro h1 { font-size: 1.9rem; margin: 0 0 14px; line-height: 1.25; }
.intro p { color: var(--text-soft); line-height: 1.6; font-size: .96rem; }
.intro-actions { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 24px; flex-wrap: wrap; }

.btn-play {
  background: linear-gradient(135deg, var(--accent), #d98f10);
  color: var(--accent-ink); border: none; border-radius: 10px;
  padding: 13px 26px; font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.btn-play:hover { transform: translateY(-1px); }
.btn-play:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.subtitle-toggle { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-soft); cursor: pointer; }
.subtitle-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.mode-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.mode-btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text-soft); border-radius: 8px; padding: 8px 14px; font-size: .82rem; font-weight: 600; cursor: pointer; transition: color .15s ease, border-color .15s ease; }
.mode-btn:hover { color: var(--text); }
.mode-btn.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.mode-btn-fullscreen { margin-left: 6px; color: var(--text-soft); }
.mode-btn-fullscreen:hover { color: var(--accent); border-color: var(--accent); }

.stage-wrap { max-width: 1080px; margin: 0 auto; }
.stage-wrap.pseudo-fullscreen { position: fixed; inset: 0; z-index: 9999; max-width: none; overflow: auto; background: var(--bg); display: flex; flex-direction: column; justify-content: center; padding: 24px; }
body.pseudo-fullscreen-lock { overflow: hidden; }

.stage {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2px;
  background: var(--border);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 560px;
}

/* ---------- Modo mobile: UN solo marco de teléfono; el panel admin y la carta pública del
   cliente son "pantallas" secuenciales dentro del mismo marco (una visible a la vez), como
   una app de celular real. script.js alterna la clase .mob-screen-active entre ambas. ---------- */
.stage[data-mode="mobile"] {
  display: block;
  position: relative;
  width: 320px; height: 640px;
  margin: 0 auto;
  background: #05070c;
  border: 10px solid #1c2536;
  border-radius: 42px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px var(--border);
  overflow: hidden;
  min-height: 0;
}
.stage[data-mode="mobile"]::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 120px; height: 22px; background: #1c2536; border-radius: 0 0 14px 14px; z-index: 5;
}
.stage[data-mode="mobile"] .stage-half {
  position: absolute; inset: 0;
  padding-top: 22px; /* despeja el notch del marco de teléfono */
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateX(16px);
  transition: opacity .28s ease, transform .28s ease, visibility .28s;
}
.stage[data-mode="mobile"] .stage-half.mob-screen-active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(0); z-index: 2;
}

.stage-half { background: var(--panel); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.device-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); padding: 10px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }

/* ---------- Panel de administración (escritorio) ---------- */
.admin-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.admin-tabs { display: flex; gap: 4px; padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.admin-tab { padding: 7px 14px; border-radius: 8px; font-size: .78rem; font-weight: 600; color: var(--text-soft); background: transparent; border: 1px solid transparent; }
.admin-tab.active { color: var(--accent-ink); background: var(--accent); }

.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.admin-topbar h4 { margin: 0; font-size: .88rem; }
.admin-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 12px; font-size: .76rem; font-weight: 600; cursor: default; }
.admin-btn.admin-btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.admin-btn.admin-btn-highlight { border-color: var(--accent); color: var(--accent); animation: highlightPulse 1.4s ease infinite; }
@keyframes highlightPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,176,32,.4); } 50% { box-shadow: 0 0 0 6px rgba(255,176,32,0); } }

.admin-body { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }

.plato-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; margin-bottom: 4px; background: #0f1522; border: 1px solid transparent; transition: background .2s ease, border-color .2s ease; }
.plato-row.selected { border-color: var(--accent); background: rgba(255,176,32,.08); }
.plato-check { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--text-soft); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: .7rem; color: var(--accent-ink); }
.plato-row.selected .plato-check { background: var(--accent); border-color: var(--accent); }
.plato-thumb { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg,#3a2a10,#2a1c08); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.plato-info { flex: 1; min-width: 0; }
.plato-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plato-section { font-size: .7rem; color: var(--text-soft); }
.plato-price { font-size: .84rem; font-weight: 700; color: var(--accent); transition: color .3s ease; }
.plato-price.price-updated { color: var(--green); animation: priceFlash .8s ease; }
@keyframes priceFlash { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }

.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: rgba(255,176,32,.1); border-top: 1px solid var(--border); animation: msgIn .2s ease; }
.bulk-bar-count { font-size: .78rem; font-weight: 600; }
.bulk-bar-actions { display: flex; gap: 6px; }

.price-modal { position: absolute; inset: 0; background: rgba(6,9,15,.7); display: flex; align-items: center; justify-content: center; z-index: 20; animation: msgIn .2s ease; }
.price-modal-box { background: var(--panel-2); border: 1px solid var(--accent); border-radius: 12px; padding: 18px 20px; width: 260px; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.price-modal-box h5 { margin: 0 0 12px; font-size: .86rem; }
.price-modal-toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.price-modal-toggle span { flex: 1; text-align: center; padding: 6px; border-radius: 7px; font-size: .74rem; font-weight: 600; background: #0b0f19; border: 1px solid var(--border); color: var(--text-soft); }
.price-modal-toggle span.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.price-modal-input { width: 100%; background: #0b0f19; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; color: var(--text); font-size: .9rem; text-align: center; margin-bottom: 12px; }
.price-modal-apply { width: 100%; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 9px; font-weight: 700; font-size: .82rem; }

.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 4px; }
.template-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; transition: border-color .2s ease, transform .2s ease; }
.template-card .template-swatch { width: 100%; aspect-ratio: 3/4; border-radius: 7px; margin-bottom: 8px; }
.template-card.tpl-simple .template-swatch { background: linear-gradient(180deg,#1b2333,#111927); }
.template-card.tpl-bistro .template-swatch { background: linear-gradient(160deg,#3a2a10,#1b1206); }
.template-card.tpl-noir .template-swatch { background: linear-gradient(160deg,#151515,#050505); border: 1px solid #d4af37; }
.template-card span { font-size: .72rem; color: var(--text-soft); }
.template-card.selected { border-color: var(--accent); transform: translateY(-2px); }
.template-card.selected span { color: var(--accent); font-weight: 700; }

/* ---------- Teléfono: menú público final ---------- */
.stage-phone { display: flex; flex-direction: column; min-width: 0; }
.phone-viewport { position: relative; flex: 1; background: #05070c; display: flex; flex-direction: column; overflow: hidden; }
.qr-overlay { position: absolute; inset: 0; background: #05070c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 5; transition: opacity .4s ease; }
.qr-overlay.qr-fading { opacity: 0; pointer-events: none; }
.qr-box { width: 96px; height: 96px; background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.qr-overlay p { color: var(--text-soft); font-size: .78rem; margin: 0; }

.menu-public { flex: 1; overflow-y: auto; opacity: 0; transition: opacity .3s ease; }
.menu-public.menu-visible { opacity: 1; }
.menu-public.tpl-bistro { background: linear-gradient(180deg,#241608,#0d0904); }
.menu-public.tpl-noir { background: #0a0a0a; }
.menu-public-header { padding: 22px 18px 14px; text-align: center; border-bottom: 1px solid var(--border); }
.menu-public-header h3 { margin: 0 0 4px; font-size: 1.05rem; }
.menu-public-header span { font-size: .7rem; color: var(--text-soft); }
.menu-public.tpl-noir .menu-public-header h3 { color: #d4af37; font-family: Georgia, serif; }
.menu-public-section { padding: 14px 18px 4px; }
.menu-public-section h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 0 0 8px; }
.menu-public.tpl-noir .menu-public-section h4 { color: #d4af37; }
.menu-public-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.menu-public-item-name { font-size: .82rem; }
.menu-public-item-price { font-size: .82rem; font-weight: 700; color: var(--accent); transition: color .3s ease; }
.menu-public-item-price.price-updated { color: var(--green); animation: priceFlash .8s ease; }

.stage-half, .admin-body, .menu-public { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.stage-half::-webkit-scrollbar, .admin-body::-webkit-scrollbar, .menu-public::-webkit-scrollbar { width: 8px; }
.stage-half::-webkit-scrollbar-thumb, .admin-body::-webkit-scrollbar-thumb, .menu-public::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.25); border-radius: 8px; }

@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.subtitle-bar {
  position: fixed; left: 50%; top: 38vh; transform: translateX(-50%); z-index: 500;
  max-width: min(560px, 88vw); text-align: center; font-size: .9rem; line-height: 1.5; color: var(--text);
  background: rgba(10, 14, 22, .88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 14px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  animation: subtitleIn .2s ease;
}
@keyframes subtitleIn { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.replay-wrap { text-align: center; margin-top: 24px; }
.btn-replay { background: transparent; border: 1px solid var(--accent); color: var(--accent); }

.footnote { max-width: 720px; margin: 40px auto 0; text-align: center; }
.footnote p { color: var(--text-soft); font-size: .78rem; line-height: 1.6; }

@media (max-width: 860px) {
  .stage:not([data-mode="mobile"]) { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: repeat(3, 1fr); }
  .intro h1 { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  #btnModeDesktop { display: none; }
  .stage[data-mode="mobile"] { width: 100%; max-width: 100%; height: 78vh; border-radius: 0; border-width: 6px; }
}
