:root{
  --bg:#0f172a;
  --card:#111827;
  --panel:#0b1220;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:rgba(255,255,255,.12);
  --accent:#22c55e;
  --accent2:#38bdf8;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 800px at 20% 10%, rgba(56,189,248,.18), transparent 60%),
              radial-gradient(1200px 800px at 80% 30%, rgba(34,197,94,.16), transparent 60%),
              var(--bg);
  color:var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  border-bottom:1px solid var(--line);
  background:rgba(0,0,0,.15);
  backdrop-filter: blur(8px);
  position:sticky;
  top:0;
  z-index:10;
}
.brand{display:flex; gap:12px; align-items:center}
.brand__logo{width:44px;height:44px;object-fit:contain;border-radius:10px;background:rgba(255,255,255,.06);padding:6px}
.brand__title{font-weight:800;letter-spacing:.2px}
.brand__subtitle{font-size:12px;color:var(--muted)}
.topbar__actions{display:flex; gap:8px}

.app{min-height:calc(100vh - 72px)}
.screen{display:none; padding:18px}
.screen--active{display:block}

.card{
  max-width:720px;
  margin:40px auto;
  padding:22px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius:18px;
}
.card--center{text-align:center}
.heroLogo{width:min(320px, 70vw); height:auto; display:block; margin:0 auto 14px}

.h1{margin:0 0 8px; font-size:28px}
.h2{margin:0 0 8px; font-size:16px}
.p{margin:0 auto 16px; color:rgba(229,231,235,.9); max-width:56ch}
.small{margin:0 0 12px; color:var(--muted); font-size:12px}
.row{display:flex; gap:10px; justify-content:center}
.row--end{justify-content:flex-end}

.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}
.btn:hover{transform:translateY(-1px)}
.btn--primary{
  border-color: rgba(34,197,94,.55);
  background: linear-gradient(180deg, rgba(34,197,94,.25), rgba(34,197,94,.12));
}
.btn--secondary{
  border-color: rgba(56,189,248,.55);
  background: linear-gradient(180deg, rgba(56,189,248,.22), rgba(56,189,248,.10));
  width:100%;
  text-align:left;
}
.btn--ghost{background:transparent}

#screenGame{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:14px;
  align-items:stretch;
}
.panel{
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  border-radius:18px;
  padding:14px;
}
.divider{height:1px;background:var(--line);margin:14px 0}
.soundList{display:grid; gap:8px}

.toolGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
}
.tool{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.04);
  cursor:grab;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  user-select:none;
}
.tool img{width:64px;height:64px;object-fit:contain}
.tool .label{font-size:11px;color:var(--muted)}
.tool[data-selected="true"]{outline:2px solid rgba(34,197,94,.7)}

.stageWrap{display:flex; flex-direction:column; gap:10px}
.stageFrame{
  border-radius:24px;
  border:2px solid rgba(255,255,255,.16);
  padding:14px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  height: min(72vh, 640px);
}
.stage{
  height:100%;
  border-radius:18px;
  border:1px dashed rgba(255,255,255,.22);
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(600px 360px at 20% 20%, rgba(56,189,248,.10), transparent 60%),
    radial-gradient(600px 360px at 80% 70%, rgba(34,197,94,.10), transparent 60%),
    rgba(0,0,0,.18);
}
.stageHint{color:var(--muted); font-size:12px; text-align:center}

.placed{
  position:absolute;
  width:140px;
  height:140px;
  transform: translate(-50%, -50%);
  cursor:pointer;
  user-select:none;
  filter: drop-shadow(0 16px 22px rgba(0,0,0,.45));
}
.placed img{
  width:100%;
  height:100%;
  object-fit:contain;

  /* “Riempimento” (reveal) effect */
  clip-path: inset(100% 0 0 0);
  animation: fillReveal .55s ease-out forwards;
}
@keyframes fillReveal{
  from{clip-path: inset(100% 0 0 0)}
  to{clip-path: inset(0 0 0 0)}
}

.modal{
  border:none;
  border-radius:16px;
  padding:0;
  max-width:560px;
  width:calc(100vw - 28px);
  background:transparent;
}
.modal::backdrop{background: rgba(0,0,0,.55)}
.modal__content{
  padding:16px;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(17,24,39,.92);
}
.list{margin:0 0 12px; color:rgba(229,231,235,.92)}
.list li{margin:6px 0}

@media (max-width: 920px){
  #screenGame{grid-template-columns: 1fr; }
  .stageFrame{height: min(64vh, 560px);}
}
