* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  color: #fff; background: linear-gradient(#0b1030, #1b2260); user-select: none; -webkit-user-select: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; }

.schermo { position: fixed; inset: 0; display: none; flex-direction: column; pointer-events: none;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.schermo.on { display: flex; }
.schermo > * { pointer-events: auto; }
.schermo > .vuoto { flex: 1; pointer-events: none; position: relative; min-height: 0; }
.vuoto > * { pointer-events: auto; position: absolute; right: 4px; bottom: 12px; }
.vuoto > .sx { right: auto; left: 4px; }

header { display: flex; gap: 8px; align-items: center; }
.tondo { width: 48px; height: 48px; flex: none; border-radius: 50%; font-size: 22px; background: rgba(255,255,255,.16);
  border: 2px solid rgba(255,255,255,.7); backdrop-filter: blur(6px); }
.tondo.grosso { width: 68px; height: 68px; font-size: 34px; background: rgba(120,90,255,.55); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.tondo:active, .chip:active, .quadro:active, .cerchio:active, .carta:active { transform: scale(.93); }

.tab { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tab button { flex: 1; padding: 11px 10px; border-radius: 14px; background: rgba(255,255,255,.14); border: 2px solid rgba(255,255,255,.55);
  font-weight: 800; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; white-space: nowrap; }
.tab button.on { background: #ffd54f; color: #1b1440; border-color: #fff; }

.pannello { background: rgba(14,16,48,.72); backdrop-filter: blur(10px); border: 2px solid rgba(255,255,255,.3); border-radius: 20px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-width: 760px; width: 100%; align-self: center; }
.pannello:empty { display: none; }
.riga { display: flex; align-items: center; gap: 10px; min-width: 0; }
.riga .et { flex: none; width: 74px; font-size: 13px; font-weight: 700; opacity: .85; }
.voci { display: flex; gap: 8px; overflow-x: auto; padding: 3px 2px; scrollbar-width: none; min-width: 0; }
.voci::-webkit-scrollbar, .tab::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 14px; border-radius: 999px; background: rgba(255,255,255,.14); border: 2px solid rgba(255,255,255,.4);
  font-weight: 700; font-size: 15px; white-space: nowrap; }
.chip.on { background: #ffd54f; color: #1b1440; border-color: #fff; }
.chip.emo { font-size: 24px; padding: 4px 10px; }
.col { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.45); }
.col.on { border-color: #fff; box-shadow: 0 0 0 3px #ffd54f; }
.suggerimento { margin: 2px 0; text-align: center; font-size: 15px; opacity: .9; }
.grande { flex: none; padding: 11px 18px; border-radius: 999px; background: #7c5cff; border: 2px solid #fff; font-weight: 800; font-size: 16px; }
.pannello input, header input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px; border: 2px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.12); font-weight: 800; font-size: 17px; text-align: center; outline: none; user-select: text; -webkit-user-select: text; }
.outfit { display: flex; gap: 8px; overflow-x: auto; }
.outfit > div { flex: 1; min-width: 120px; background: rgba(255,255,255,.08); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: center; font-weight: 800; }
.outfit .chip { padding: 7px 8px; font-size: 13px; }
.outfit .chip:disabled { opacity: .35; }

/* home */
#s-home { align-items: center; text-align: center; overflow-y: auto; }
#s-home h1 { margin: 2vh 0 0; font-size: clamp(28px, 7vw, 54px); font-weight: 900; letter-spacing: .02em; text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 24px rgba(140,160,255,.8); border-bottom: 3px solid rgba(255,255,255,.6); padding-bottom: 8px; }
.cerchi { flex: 1; display: flex; gap: clamp(16px, 6vw, 60px); align-items: center; justify-content: center; min-height: 170px; }
.cerchio { width: clamp(130px, 34vw, 210px); aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.12); border: 4px solid #fff;
  backdrop-filter: blur(6px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 0 30px rgba(140,120,255,.5); }
.cerchio b { font-size: clamp(44px, 12vw, 80px); line-height: 1; }
.cerchio span { font-weight: 900; text-transform: uppercase; font-size: clamp(13px, 3.4vw, 18px); }
.nome { display: flex; flex-direction: column; gap: 6px; width: min(420px, 92%); font-weight: 900; text-transform: uppercase; }
.nome input { padding: 13px; border-radius: 999px; border: 3px solid #fff; background: rgba(255,255,255,.14); text-align: center; font-size: 20px; font-weight: 800; outline: none; user-select: text; -webkit-user-select: text; }
.nome input::placeholder, header input::placeholder { color: rgba(255,255,255,.55); }
.basso { align-self: stretch; display: flex; gap: 10px; align-items: center; margin-top: 14px; min-height: 48px; }

/* pianeta */
.targa { flex: 1; font-weight: 900; font-size: 17px; text-shadow: 0 2px 4px rgba(0,0,0,.6); background: rgba(14,16,48,.5); border-radius: 999px; padding: 9px 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comandi { display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none !important; }
.comandi > * { pointer-events: auto; }
#joy { width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.7); position: relative; touch-action: none; margin: 0 0 8px 8px; }
#joy i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 4px 10px rgba(0,0,0,.4); }
.tasti { display: flex; gap: 10px; align-items: flex-end; margin: 0 4px 8px 0; }
.quadro { width: 64px; height: 64px; border-radius: 14px; font-size: 30px; background: rgba(255,255,255,.2); border: 3px solid #fff; backdrop-filter: blur(6px); }
.quadro.on { background: #e53935; animation: pulsa .7s infinite alternate; }
@keyframes pulsa { to { transform: scale(1.1); } }

/* modale equipaggiamenti */
#modale { position: fixed; inset: 0; background: rgba(5,6,25,.6); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 5; }
#modale[hidden] { display: none; }
.finestra { position: relative; width: min(680px, 100%); max-height: min(560px, 94vh); background: #1b1e52; border: 3px solid #fff; border-radius: 22px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.finestra h2 { margin: 0; font-size: 20px; text-align: center; }
.chiudi { position: absolute; right: -8px; top: -8px; background: #e53935; }
.corpo { display: flex; gap: 10px; min-height: 0; flex: 1; }
#mod-cat { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; flex: none; width: 150px; }
#mod-cat button { padding: 9px 8px; border-radius: 10px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.35); font-weight: 800; font-size: 13px; text-transform: uppercase; text-align: left; }
#mod-cat button.on { background: #ffd54f; color: #1b1440; border-color: #fff; }
#mod-voci { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; overflow-y: auto; align-content: start; }
.carta { aspect-ratio: 1; border-radius: 14px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px; }
.carta b { font-size: 36px; line-height: 1; }
.finestra footer { display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .9; }

#avviso { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); background: #ffd54f; color: #1b1440; font-weight: 800; padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 9; text-align: center; max-width: 90vw; }
#avviso.on { opacity: 1; }

@media (max-width: 520px) {
  .tab button { font-size: 12px; padding: 10px 6px; }
  .riga .et { width: 58px; font-size: 12px; }
  #mod-cat { width: 112px; } #mod-cat button { font-size: 11px; padding: 8px 6px; }
  #joy { width: 112px; height: 112px; }
  .quadro { width: 56px; height: 56px; font-size: 26px; }
}
@media (max-height: 480px) {
  #s-home h1 { font-size: 26px; margin-top: 0; }
  .cerchi { min-height: 120px; } .cerchio { width: 120px; } .cerchio b { font-size: 40px; }
  .pannello { padding: 6px 10px; gap: 4px; } .col { width: 32px; height: 32px; } .chip { padding: 6px 12px; }
}

.cerchio b, .tondo, .quadro { font-weight: 900; }
.voci:has(.emo) { flex-wrap: wrap; }

.benvenuto { margin: 1vh 0 0; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .12em; opacity: .85; }
#s-home h1 { margin-top: 2px; border-bottom: 0; padding-bottom: 0; }
.sotto { margin: 2px 0 0; font-size: 16px; font-weight: 700; border-bottom: 3px solid rgba(255,255,255,.6); padding-bottom: 8px; }
