@keyframes pulseRing { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes floatSlow { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-16px); } }
@keyframes floatSlow2 { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(14px); } }
@keyframes pulseCta { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

:root {
  --navy-950: #0b1730;
  --navy-900: #12203f;
  --navy-800: #14213d;
  --navy-700: #1b2a6b;
  --ink: #12203f;
  --muted: #8b95b8;
  --muted-2: #c7cee6;
  --panel-bg: #f4f5f8;
  --card-bg: #ffffff;
  --field-bg: #f0f2f8;
  --orange: #f4801e;
  --orange-light: #ffe9d2;
  --red: #e5383b;
  --teal: #17a398;
  --purple: #8e3aa3;
  --green: #4a8c3c;
  --gold: #f2b705;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #0b1730;
  font-family: 'Poppins', sans-serif;
  overflow: hidden;
}

a { color: var(--orange); }
a:hover { color: #ff9c4d; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #d8dce6; border-radius: 6px; }

#stage-outer {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#stage {
  width: 1920px;
  height: 1080px;
  position: relative;
  overflow: hidden;
  background: var(--panel-bg);
  font-family: 'Poppins', sans-serif;
  color: var(--ink);
  transform-origin: center center;
  flex: none;
}

.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }

/* ── ATTRACT ─────────────────────────────────────────────────────────── */
#screen-attract {
  background: linear-gradient(135deg, #0b1730 0%, #14213d 55%, #1b2a6b 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.attract-blob { position: absolute; border-radius: 50%; }
.attract-logo { width: 640px; height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35)); }
.attract-tagline { margin-top: 22px; font-size: 30px; font-weight: 500; color: var(--muted-2); letter-spacing: 2px; }
.attract-cta { margin-top: 100px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.attract-cta-ring {
  width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--orange);
  display: flex; align-items: center; justify-content: center;
  animation: pulseCta 2.2s ease-in-out infinite;
}
.attract-cta-text { font-size: 26px; font-weight: 600; color: #ffffff; letter-spacing: 1px; }

/* ── APP SHELL ───────────────────────────────────────────────────────── */
#screen-app { display: flex; flex-direction: column; }

#app-header {
  height: 120px; flex: 0 0 120px; background: var(--navy-900);
  display: flex; align-items: center; justify-content: space-between; padding: 0 48px;
}
.header-left { display: flex; align-items: center; gap: 20px; cursor: pointer; }
.header-back {
  width: 56px; height: 56px; border-radius: 50%; background: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
}
.header-logo { height: 44px; width: auto; display: block; }
.header-title { font-size: 30px; font-weight: 600; color: #ffffff; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 28px; }
.header-clock { text-align: right; }
.header-clock-time { font-size: 26px; font-weight: 700; color: #ffffff; }
.header-clock-date { font-size: 16px; color: var(--muted); text-transform: capitalize; }
.header-home {
  width: 56px; height: 56px; border-radius: 50%; background: var(--orange);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

#app-body { flex: 1; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; }

/* ── HOME ────────────────────────────────────────────────────────────── */
#view-home {
  padding: 56px; display: grid;
  grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); gap: 32px;
}
.tile {
  border-radius: 28px; padding: 36px; display: flex; flex-direction: column;
  justify-content: space-between; cursor: pointer;
}
.tile-title { font-size: 26px; font-weight: 700; color: #ffffff; }
.tile-desc { font-size: 16px; margin-top: 6px; }
.tile-mappa { grid-column: span 2; background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); padding: 40px; box-shadow: 0 12px 28px rgba(18, 32, 63, 0.25); }
.tile-mappa .tile-title { font-size: 34px; }
.tile-mappa .tile-desc { font-size: 19px; color: var(--muted-2); }
.tile-eventi { grid-column: span 2; background: var(--purple); box-shadow: 0 12px 28px rgba(142, 58, 163, 0.25); padding: 40px; }
.tile-eventi .tile-title { font-size: 34px; }
.tile-eventi .tile-desc { font-size: 19px; color: #f1dcf5; }
.tile-card { background: var(--orange); box-shadow: 0 12px 28px rgba(244, 128, 30, 0.25); }
.tile-card .tile-title { font-size: 26px; }
.tile-card .tile-desc { color: var(--orange-light); }
.tile-foodcourt { background: var(--teal); box-shadow: 0 12px 28px rgba(23, 163, 152, 0.25); }
.tile-foodcourt .tile-desc { color: #d9f5f2; }
.tile-cinema { background: linear-gradient(135deg, #1a6b7a, #0e9bac); box-shadow: 0 12px 28px rgba(14, 155, 172, 0.28); }
.tile-cinema .tile-desc { color: #cdf0f5; }
.tile-servizi { background: var(--green); box-shadow: 0 12px 28px rgba(74, 140, 60, 0.25); }
.tile-servizi .tile-desc { color: #dff1da; }
.tile-giftcard { background: linear-gradient(135deg, #e8622a, #f4a020); box-shadow: 0 12px 28px rgba(232, 98, 42, 0.28); }
.tile-giftcard .tile-desc { color: #fde8d0; }

/* ── MAPPA ───────────────────────────────────────────────────────────── */
#view-mappa { display: flex; }
.mappa-panel {
  width: 520px; flex: 0 0 520px; background: #ffffff; border-right: 1px solid #e6e9f2;
  display: flex; flex-direction: column; padding: 28px;
}
.floor-switch { display: flex; gap: 10px; background: var(--field-bg); border-radius: 16px; padding: 6px; }
.floor-tab { flex: 1; text-align: center; padding: 14px 0; border-radius: 12px; font-size: 18px; font-weight: 700; cursor: pointer; color: #556; }
.floor-tab.active { background: var(--navy-900); color: #ffffff; }

.search-box {
  margin-top: 20px; height: 64px; border-radius: 16px; background: var(--field-bg);
  display: flex; align-items: center; padding: 0 20px; gap: 14px; cursor: pointer;
}
.search-box-text { font-size: 20px; color: var(--ink); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-clear {
  width: 32px; height: 32px; border-radius: 50%; background: #dfe3ee;
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #556; cursor: pointer;
}

.chips { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 10px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer; background: var(--field-bg); color: #556; white-space: nowrap; }
.chip.active { background: var(--navy-900); color: #ffffff; }

.list-count { margin-top: 22px; font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }
.store-list { flex: 1; overflow-y: auto; margin-top: 10px; padding-right: 6px; }
.store-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px;
  margin-bottom: 8px; cursor: pointer; background: #ffffff; border: 2px solid var(--field-bg);
}
.store-item.active { background: #fff4ec; border-color: var(--orange); }
.store-dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; }
.store-item-name { font-size: 19px; font-weight: 600; color: var(--ink); }
.store-item-cat { font-size: 15px; color: var(--muted); }
.no-results { padding: 24px 4px; font-size: 17px; color: var(--muted); }

.mappa-map-wrap { flex: 1; position: relative; background: #e9ecf3; overflow: hidden; padding: 28px; }
.mappa-map-box {
  position: relative; width: 100%; height: 100%; border-radius: 24px; overflow: hidden;
  box-shadow: 0 20px 40px rgba(18, 32, 63, 0.18); background: #fff;
}
.mappa-map-box > img#map-img { display: block; width: 100%; height: 100%; object-fit: contain; }
#map-dots { position: absolute; inset: 0; pointer-events: none; }
@keyframes map-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.map-selected-polygon { animation: map-pulse 1.4s ease-in-out infinite; }
#map-svg { position: absolute; pointer-events: all; }
.map-dot { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); cursor: pointer; transition: all 0.15s ease; }

.store-popup {
  position: absolute; bottom: 56px; left: 56px; z-index: 50; background: #ffffff; border-radius: 20px;
  padding: 26px 30px; box-shadow: 0 16px 32px rgba(18, 32, 63, 0.25); min-width: 340px;
}
.store-popup-top { display: flex; justify-content: space-between; align-items: flex-start; }
.store-popup-left { display: flex; align-items: center; gap: 12px; }
.store-popup-dot { width: 16px; height: 16px; border-radius: 50%; }
.store-popup-name { font-size: 24px; font-weight: 700; color: var(--ink); }
.store-popup-close {
  width: 32px; height: 32px; border-radius: 50%; background: var(--field-bg);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #556; cursor: pointer;
}
.store-popup-sub { margin-top: 8px; font-size: 18px; color: var(--muted); }

/* ── OFFERTE ─────────────────────────────────────────────────────────── */
#view-offerte { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #a02020 0%, #e5383b 100%); }
.offerte-intro { font-size: 20px; color: var(--muted); margin-bottom: 32px; max-width: 1000px; }
.offerte-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.offer-card { border-radius: 24px; background: #ffffff; box-shadow: 0 8px 20px rgba(18, 32, 63, 0.08); overflow: hidden; }
.offer-bar { height: 12px; }
.offer-body { padding: 30px; }
.offer-cat { font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.offer-title { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 10px; }
.offer-desc { font-size: 17px; color: #556; margin-top: 8px; }
.offer-valid { font-size: 15px; color: var(--muted); margin-top: 16px; }

/* ── EVENTI ──────────────────────────────────────────────────────────── */
#view-eventi { overflow-y: auto; padding: 48px 56px; }
.eventi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 28px; width: 100%; }
.event-card { background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 8px 24px rgba(18,32,63,0.10); display: flex; flex-direction: column; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.event-card:active { transform: scale(0.98); box-shadow: 0 4px 12px rgba(18,32,63,0.12); }
.event-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.event-card-body { padding: 24px 28px 28px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.event-card-title { font-size: 23px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.event-card-date { font-size: 17px; color: var(--purple); font-weight: 600; }
.event-card-place { font-size: 16px; color: var(--muted); }
.event-card-empty { font-size: 22px; color: var(--muted); padding: 60px 0; text-align: center; grid-column: 1/-1; }

/* ── EVENTO DETTAGLIO (overlay fixed sotto l'header) ─────────────────── */
#evento-detail { position: fixed; top: 120px; left: 0; right: 0; bottom: 0; background: #fff; display: flex; flex-direction: column; overflow-y: auto; z-index: 200; }
#evento-detail.hidden { display: none; }
.ev-detail-topbar { padding: 28px 56px 0; flex-shrink: 0; }
.ev-detail-back { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; color: var(--navy); cursor: pointer; }
.ev-detail-back svg { flex-shrink: 0; }
.ev-detail-columns { display: flex; flex: 1; gap: 0; min-height: 0; }
.ev-detail-left { flex: 0 0 48%; background: #f4f6fb; display: flex; align-items: flex-start; justify-content: center; padding: 36px; }
.ev-detail-left img { width: 100%; max-width: 560px; border-radius: 18px; object-fit: contain; box-shadow: 0 12px 40px rgba(18,32,63,0.14); }
.ev-detail-right { flex: 1; padding: 48px 64px 64px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.ev-detail-title { font-size: 42px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.ev-detail-date { font-size: 22px; color: var(--ink); font-weight: 600; }
.ev-detail-place { font-size: 20px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ev-detail-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.ev-detail-content { font-size: 20px; color: var(--ink); line-height: 1.7; white-space: pre-line; }

/* ── CINEMA / FOOD COURT ─────────────────────────────────────────────── */
.info-screen { padding: 56px; display: flex; gap: 40px; height: 100%; }
.info-main { flex: 1; border-radius: 28px; padding: 48px; color: #ffffff; display: flex; flex-direction: column; justify-content: center; }
.info-main-title { font-size: 40px; font-weight: 800; letter-spacing: 1px; }
.info-main-desc { font-size: 20px; margin-top: 16px; line-height: 1.6; }
.info-main-meta { font-size: 18px; margin-top: 6px; }
.info-main-cta { margin-top: 36px; align-self: flex-start; font-size: 20px; font-weight: 700; padding: 18px 32px; border-radius: 16px; cursor: pointer; }
.info-side {
  flex: 0 0 420px; background: #ffffff; border-radius: 28px; box-shadow: 0 8px 20px rgba(18, 32, 63, 0.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
.info-side-text { font-size: 19px; color: var(--muted); text-align: center; padding: 0 30px; }
.info-side-restaurants { flex: 0 0 560px; align-items: stretch; justify-content: flex-start; padding: 28px 24px; overflow: hidden; }
.info-side-header { font-size: 22px; font-weight: 700; color: var(--navy); padding: 0 4px 16px; border-bottom: 2px solid #f0f2f8; flex-shrink: 0; }
.restaurant-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.restaurant-item { display: flex; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 14px; cursor: pointer; transition: background 0.15s; }
.restaurant-item:hover { background: #f4f6fb; }
.restaurant-item-logo { width: 52px; height: 52px; border-radius: 10px; object-fit: contain; background: #f4f6fb; flex-shrink: 0; padding: 4px; }
.restaurant-item-logo-placeholder { width: 52px; height: 52px; border-radius: 10px; background: #f0f2f8; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.restaurant-item-name { font-size: 18px; font-weight: 600; color: var(--navy); flex: 1; }
.restaurant-item--clickable { cursor: pointer; }
.restaurant-item--clickable:hover { background: #eef1f8; }
.restaurant-item-zone { font-size: 13px; font-weight: 700; color: #fff; background: var(--navy); border-radius: 8px; padding: 2px 8px; min-width: 28px; text-align: center; flex-shrink: 0; align-self: center; }

/* ── WIP SCREEN ──────────────────────────────────────────────────────── */
.wip-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 28px; text-align: center; padding: 60px; }
.wip-icon { opacity: 0.5; }
.wip-badge { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.7); font-size: 15px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; padding: 8px 22px; border-radius: 40px; }
.wip-title { font-size: 62px; font-weight: 800; color: #ffffff; letter-spacing: -1px; margin-top: 4px; }
.wip-subtitle { font-size: 22px; color: rgba(255,255,255,0.55); line-height: 1.6; max-width: 680px; }

/* ── SERVIZI ─────────────────────────────────────────────────────────── */
#view-servizi  { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2d6b22 0%, #4a8c3c 100%); }
#view-giftcard { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #b84010 0%, #f4a020 100%); }
.service-card { background: #ffffff; border-radius: 24px; padding: 30px; box-shadow: 0 8px 20px rgba(18, 32, 63, 0.08); display: flex; flex-direction: column; gap: 14px; }
.service-icon { width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.service-icon-dot { width: 14px; height: 14px; border-radius: 50%; background: #ffffff; }
.service-title { font-size: 23px; font-weight: 700; color: var(--ink); }
.service-desc { font-size: 16px; color: var(--muted); flex: 1; }
.service-link { font-size: 16px; font-weight: 600; color: var(--orange); cursor: pointer; }

/* ── CARD WIZARD ─────────────────────────────────────────────────────── */
#view-card { display: flex; align-items: center; justify-content: center; padding: 40px; transition: padding-bottom 0.2s ease; }
.card-panel { width: 760px; background: #ffffff; border-radius: 32px; padding: 56px; box-shadow: 0 16px 40px rgba(18, 32, 63, 0.14); }
.card-step-label { font-size: 16px; font-weight: 700; color: var(--orange); letter-spacing: 1px; text-transform: uppercase; }
.card-title { font-size: 34px; font-weight: 800; color: var(--ink); margin-top: 10px; }
.card-subtitle { font-size: 18px; color: var(--muted); margin-top: 8px; }
.card-fields { margin-top: 36px; display: flex; flex-direction: column; gap: 20px; }
.card-field {
  height: 68px; border-radius: 16px; display: flex; align-items: center; padding: 0 22px;
  font-size: 21px; cursor: pointer; background: var(--field-bg); border: 2px solid transparent; color: var(--ink);
}
.card-field.active { border-color: var(--orange); }
.card-btn-row { display: flex; gap: 16px; margin-top: 36px; }
.card-btn-back { flex: 0 0 160px; background: var(--field-bg); color: var(--ink); font-size: 20px; font-weight: 600; padding: 22px 0; border-radius: 16px; cursor: pointer; text-align: center; }
.card-btn-primary { flex: 1; background: var(--orange); color: #ffffff; font-size: 20px; font-weight: 700; padding: 22px 0; border-radius: 16px; cursor: pointer; text-align: center; }
.card-btn-primary.full { margin-top: 36px; width: 100%; }
.card-btn-primary:disabled, .card-btn-primary.disabled { background: #f0d9c4; cursor: default; }

.card-summary { margin-top: 32px; background: #f8f9fc; border-radius: 20px; padding: 28px 32px; display: flex; flex-direction: column; gap: 14px; }
.card-summary-row { display: flex; justify-content: space-between; font-size: 19px; }
.card-summary-row span:first-child { color: var(--muted); }
.card-summary-row span:last-child { font-weight: 600; color: var(--ink); }

.card-error { margin-top: 20px; font-size: 16px; color: var(--red); }

.card-done { text-align: center; animation: fadeUp 0.4s ease; }
.card-done-check { width: 80px; height: 80px; border-radius: 50%; background: #e9f7ea; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.card-done-title { font-size: 32px; font-weight: 800; color: var(--ink); margin-top: 24px; }
.card-done-sub { font-size: 18px; color: var(--muted); margin-top: 10px; }
.card-qr-wrap { margin-top: 32px; display: inline-flex; background: var(--navy-900); border-radius: 24px; padding: 24px; }
.card-qr-wrap canvas { display: block; border-radius: 8px; }
.card-done-name { margin-top: 14px; font-size: 20px; font-weight: 700; color: var(--ink); }
.card-done-code { margin-top: 4px; font-size: 15px; letter-spacing: 1px; color: var(--muted); }

/* ── VIRTUAL KEYBOARD ────────────────────────────────────────────────── */
#keyboard {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 9999; background: var(--navy-900);
  padding: 22px 40px 30px; box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.25);
}
.kb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kb-field-label { font-size: 18px; color: var(--muted); }
.kb-close { font-size: 16px; color: var(--muted-2); cursor: pointer; }
.kb-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.kb-key {
  flex: 1; height: 58px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600; cursor: pointer; background: #1c3050; color: #ffffff; user-select: none;
}
.kb-key.wide { flex: 1.8; }
.kb-key.space { flex: 5; }
.kb-key.action { background: var(--navy-700); }
