@font-face {
  font-family: 'SamsungSharp';
  src: url('/fonts/samsungsharpsans.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'SamsungSharp';
  src: url('/fonts/samsungsharpsans-medium.otf') format('opentype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'SamsungSharp';
  src: url('/fonts/samsungsharpsans-bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #120a2e;
  --bg-deep: #0b0620;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-solid: #1b1242;
  /* pannelli quasi opachi: le linee neon dello sfondo non devono passare sotto il testo */
  --panel: rgba(27, 17, 64, 0.94);
  --border: rgba(168, 121, 255, 0.22);
  --border-strong: rgba(190, 150, 255, 0.5);
  --neon: #a879ff;
  --neon-deep: #7b4dff;
  --neon-glow: rgba(140, 90, 255, 0.55);
  --blue: #3d6bff;
  --text: #ffffff;
  --muted: #b3a8d6;
  --faint: #7c719f;
  --ok: #3fe0a5;
  --warn: #ffbf57;
  --danger: #ff5d7a;
  --grad: linear-gradient(90deg, #3d6bff 0%, #8a5cff 55%, #c27dff 100%);
  --grad-soft: linear-gradient(135deg, rgba(61, 107, 255, 0.25), rgba(194, 125, 255, 0.18));
  --radius: 18px;
  --radius-sm: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'SamsungSharp', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--neon);
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 0.82rem;
}
.center {
  text-align: center;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row.wrap {
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.stack {
  display: grid;
  gap: 14px;
}
.upper {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ───────────── Sfondo neon (ispirato alle pareti dello stand) ───────────── */
.neon-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(123, 77, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -20% 110%, rgba(61, 107, 255, 0.14), transparent 60%),
    var(--bg);
}
.neon-line {
  position: absolute;
  border: 2px solid rgba(214, 186, 255, 0.85);
  border-radius: 3px;
  box-shadow:
    0 0 6px rgba(168, 121, 255, 0.9),
    0 0 22px var(--neon-glow),
    inset 0 0 6px rgba(168, 121, 255, 0.8),
    inset 0 0 18px var(--neon-glow);
  opacity: 0.55;
}
.app-layer {
  position: relative;
  z-index: 1;
}

/* ───────────── Bottoni ───────────── */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.12s ease,
    box-shadow 0.2s ease,
    opacity 0.2s;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 24px rgba(123, 77, 255, 0.45);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 32px rgba(123, 77, 255, 0.65);
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-strong);
}
.btn-danger {
  background: rgba(255, 93, 122, 0.14);
  color: var(--danger);
  border: 1px solid rgba(255, 93, 122, 0.4);
}
.btn-ok {
  background: linear-gradient(90deg, #1fbf87, #3fe0a5);
  color: #06281c;
  box-shadow: 0 6px 24px rgba(63, 224, 165, 0.35);
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 18px 26px;
  font-size: 1.1rem;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.1rem;
  flex: none;
}
.icon-btn:disabled {
  opacity: 0.35;
}

/* ───────────── Card / campi ───────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.card-glow {
  border-color: var(--border-strong);
  box-shadow:
    0 0 0 1px rgba(168, 121, 255, 0.15),
    0 10px 40px rgba(60, 20, 140, 0.35);
}

.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.input,
select.input,
textarea.input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(168, 121, 255, 0.2);
}
textarea.input {
  resize: vertical;
  min-height: 80px;
}
.input-lg {
  font-size: 1.25rem;
  padding: 16px 18px;
  text-align: center;
  font-weight: 700;
}

.error-box {
  background: rgba(255, 93, 122, 0.12);
  border: 1px solid rgba(255, 93, 122, 0.4);
  color: #ffb3c1;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-points {
  background: var(--grad);
  border: 0;
  color: #fff;
}
.badge-ok {
  background: rgba(63, 224, 165, 0.15);
  border-color: rgba(63, 224, 165, 0.45);
  color: var(--ok);
}
.badge-warn {
  background: rgba(255, 191, 87, 0.14);
  border-color: rgba(255, 191, 87, 0.4);
  color: var(--warn);
}

/* ───────────── Photo booth ───────────── */
.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(16px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  position: relative;
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--grad);
  opacity: 0.8;
  box-shadow: 0 0 14px var(--neon-glow);
}
.brand-logo {
  height: 15px;
  width: auto;
}
.brand-sub {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  padding-top: 8px;
  border-top: 3px solid var(--surface-2);
  border-radius: 2px;
}
.steps li::before {
  content: counter(step) ' · ';
}
.steps li.done {
  color: var(--muted);
  border-top-color: var(--neon-deep);
}
.steps li.active {
  color: var(--text);
  border-image: var(--grad) 1;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}
.hero {
  display: grid;
  gap: 4px;
  padding-top: 8px;
}
.hero p {
  margin: 8px 0 0;
  line-height: 1.4;
}
.title {
  font-size: clamp(1.6rem, 7.4vw, 2.3rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.section-head h2 {
  font-size: 1.15rem;
}

.shot {
  flex: 1;
  min-height: 300px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border-radius: var(--radius);
  border: 2px dashed var(--border-strong);
  background: var(--grad-soft);
  cursor: pointer;
  text-align: center;
}
.shot b {
  font-size: 1.25rem;
}
.shot-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad);
  box-shadow: 0 8px 32px rgba(123, 77, 255, 0.55);
  margin-bottom: 8px;
}
.preview {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-deep);
}
.preview img {
  width: 100%;
  max-height: 62dvh;
  object-fit: contain;
  margin: 0 auto;
}

.actions {
  display: flex;
  gap: 10px;
}
.actions > * {
  flex: 1;
}
.actions.sticky {
  position: sticky;
  bottom: calc(12px + var(--safe-bottom));
  margin-top: auto;
  padding: 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.personas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.persona {
  appearance: none;
  text-align: left;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.15s ease,
    border-color 0.2s,
    box-shadow 0.2s;
}
.persona:active {
  transform: scale(0.98);
}
.persona img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.persona-body {
  padding: 10px 12px 12px;
  display: grid;
  gap: 3px;
}
.persona-name {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.persona-sub {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.persona-desc {
  font-size: 0.74rem;
  color: var(--faint);
  line-height: 1.3;
  margin-top: 4px;
}
.persona.selected {
  border-color: var(--neon);
  box-shadow:
    0 0 0 2px var(--neon),
    0 10px 36px var(--neon-glow);
}

.gen-stage {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding-top: 8px;
}
.gen-photo {
  position: relative;
  width: min(70vw, 300px);
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 50px var(--neon-glow);
}
.gen-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.6) brightness(0.75);
}
.scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(168, 121, 255, 0.55) 48%, rgba(255, 255, 255, 0.9) 50%, rgba(61, 107, 255, 0.45) 52%, transparent 100%);
  background-size: 100% 40%;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  animation: scan 2.4s ease-in-out infinite alternate;
}
.failed .scan {
  display: none;
}
@keyframes scan {
  from {
    background-position: 0 -40%;
  }
  to {
    background-position: 0 140%;
  }
}
.gen-stage h2 {
  font-size: 1.5rem;
}
.gen-status {
  margin: 0;
  font-weight: 500;
}
.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--grad);
  box-shadow: 0 0 14px var(--neon-glow);
  transition: width 0.8s ease;
}
.gen-stage .error-box,
.gen-stage .actions {
  width: 100%;
}

.editor {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-deep);
  touch-action: none;
  user-select: none;
}
.editor canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
}
.zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.zoom-row input[type='range'] {
  flex: 1;
  accent-color: var(--neon);
}

/* ───────────── Admin ───────────── */
.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  gap: 16px;
}
.admin .btn {
  justify-self: start;
}
.jobs {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.jobs th,
.jobs td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.jobs th {
  color: var(--muted);
  font-weight: 500;
}

/* ───────────── Avviso crediti ───────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(11, 6, 32, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-box {
  width: min(100%, 380px);
  justify-items: center;
}
.modal-box h2 {
  font-size: 1.3rem;
}
.modal-box p {
  margin: 0;
  font-size: 1.05rem;
}
.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #2b1800;
  background: var(--warn);
  box-shadow: 0 0 28px rgba(255, 191, 87, 0.55);
}
