:root {
  --ink: #061f37;
  --pink: #e63a78;
  --teal: #0b8f8c;
  --cream: #fff4df;
  --frame-ratio: 9 / 16;
  --transition-ms: 760ms;
  --thought-font-scale: 1;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4d1b6;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}


.show-all-thoughts,
.nav-thought {
  position: absolute;
  z-index: 9;
  border: 0;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #e63a78, #0e9c98);
  box-shadow: 0 12px 30px rgba(91, 36, 36, 0.26);
  font-weight: 900;
  pointer-events: auto;
}

.show-all-thoughts {
  left: 50%;
  top: calc(0.25rem + env(safe-area-inset-top));
  transform: translateX(-50%);
  min-height: 34px;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  font-size: clamp(0.78rem, 1.9vw, 0.96rem);
  white-space: nowrap;
}

.nav-thought {
  top: 75%;
  width: 32px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 2.15rem;
  line-height: 1;
}

.nav-thought-prev {
  left: 0;
  border-radius: 0 999px 999px 0;
}

.nav-thought-next {
  right: 0;
  border-radius: 999px 0 0 999px;
}

.show-all-thoughts:hover,
.show-all-thoughts:focus-visible,
.nav-thought:hover,
.nav-thought:focus-visible {
  outline: none;
  filter: brightness(1.06);
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 250, 223, 0.9), transparent 22rem),
    radial-gradient(circle at 86% 88%, rgba(248, 190, 176, 0.52), transparent 24rem),
    linear-gradient(135deg, #f5d3b5, #edc5b0 50%, #d8eee6);
}

.desktop-glow {
  position: absolute;
  inset: -4%;
  background: url("../assets/sfondo-pensieri-felici.png") center / cover no-repeat;
  filter: blur(24px) saturate(1.12);
  opacity: 0.38;
  transform: scale(1.07);
}

.device-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #f7d9be;
  z-index: 1;
}

.wall {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-image: url("../assets/sfondo-pensieri-felici.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  isolation: isolate;
}

.stage {
  position: absolute;
  left: 50%;
  top: 56.4%;
  width: 100%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  align-items: center;
  gap: clamp(0.32rem, 1.15svh, 0.8rem);
  pointer-events: none;
}

.postit {
  position: relative;
  margin-bottom: 20px;
  width: clamp(95%, min(67vw, 48svh), 760px);
  aspect-ratio: 1 / 1;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 26px 44px rgba(64, 38, 16, 0.28));
  transform: rotate(var(--postit-rot, 0deg));
  transform-origin: 50% 11%;
  transition: filter 0.25s ease;
  pointer-events: auto;
}

.postit:hover {
  filter: drop-shadow(0 30px 54px rgba(64, 38, 16, 0.34));
}

.postit:focus-visible {
  outline: 4px solid rgba(230, 58, 120, 0.8);
  outline-offset: 8px;
  border-radius: 32px;
}

.postit-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.postit-copy {
  position: absolute;
  inset: 28% 18% 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Comic Sans MS", "Bradley Hand", "Segoe Print", "Trebuchet MS", cursive;
  color: #051f36;
  line-height: 1.08;
  pointer-events: none;
  text-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.26);
}


.thought-meta {
  display: block;
  margin-top: 0.22rem;
  max-width: 100%;
  color: #263d4c;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.82rem, min(1.95vw, 1.05svh), 0.98rem);
  font-weight: 900;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.thought {
  --thought-base-font-size: clamp(1.65rem, min(5.9vw, 3.45svh), 3.05rem);
  display: block;
  font-size: calc(var(--thought-base-font-size) * var(--thought-font-scale, 1));
  font-weight: 900;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.author {
  display: block;
  margin-top: 0.65rem;
  color: #087672;
  font-size: clamp(1.60rem, min(3.1vw, 1.78svh), 1.18rem);
  font-weight: 800;
}

.author:not(:empty)::before {
  content: "— ";
}

.contacts {
  display: block;
  margin-top: 0.25rem;
  max-width: 100%;
  color: #263d4c;
  font-size: clamp(1.20rem, min(2.45vw, 1.34svh), 0.9rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.add-thought {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0.68rem 1rem;
  margin-bottom: 25px;
  color: white;
  background: linear-gradient(135deg, #e63a78, #0e9c98);
  box-shadow: 0 10px 24px rgba(91, 36, 36, 0.23);
  font-weight: 900;
  cursor: pointer;
  font-size: clamp(1.20rem, 2.7vw, 1.46rem);
  pointer-events: auto;
}

.add-thought:active {
  transform: translateY(1px) scale(0.99);
}

.visitor {
  position: absolute;
  left: 50%;
  bottom: calc(2.55rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 0.23rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.35);
  color: rgba(6, 31, 55, 0.62);
  font-size: 1.66rem;
  font-weight: 800;
  backdrop-filter: blur(3px);
  white-space: nowrap;
  z-index: 7;
}


.credits-link {
  position: absolute;
  left: 50%;
  bottom: calc(0.55rem + env(safe-area-inset-bottom));
  z-index: 7;
  transform: translateX(-50%);
  max-width: 92%;
  padding: 0.34rem 0.78rem;
  border-radius: 999px;
  color: #b52258;
  background: rgba(255, 246, 232, 0.72);
  box-shadow: 0 8px 22px rgba(91, 36, 36, 0.16);
  backdrop-filter: blur(5px);
  font-size: clamp(0.78rem, 2.25vw, 1.02rem);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.credits-link::before {
  content: "💖 ";
}

.credits-link:hover,
.credits-link:focus-visible {
  color: #0b6570;
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

.passed-panel {
  position: absolute;
  left: 50%;
  top: calc(0.8rem + env(safe-area-inset-top));
  bottom: calc(0.8rem + env(safe-area-inset-bottom));
  z-index: 12;
  width: min(96%, 820px);
  max-height: none;
  transform: translate(-50%, 106%);
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: clamp(0.82rem, 2.5vw, 1.25rem);
  border-radius: 28px;
  background: rgba(255, 248, 231, 0.97);
  box-shadow: 0 24px 80px rgba(45, 23, 5, 0.35);
  backdrop-filter: blur(12px);
  transition:
    transform 0.42s cubic-bezier(0.2, 0.86, 0.2, 1),
    opacity 0.3s ease;
}

.passed-panel.open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.58rem;
}

.panel-head p {
  margin: 0;
  color: var(--pink);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.panel-head strong {
  display: block;
  font-size: 0.9rem;
}

.resume-btn,
.submit-btn,
.modal-close {
  border: 0;
  cursor: pointer;
}

.resume-btn,
.submit-btn {
  border-radius: 999px;
  padding: 0.65rem 0.85rem;
  color: white;
  background: #0f8f8b;
  font-weight: 900;
}

.passed-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 0.6rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.1rem 0.1rem 0.5rem;
}

.mini-postit {
  min-height: auto;
  border-radius: 11px;
  padding: 0.85rem;
  background: linear-gradient(135deg, #eef6a8, #ffc5d4);
  box-shadow: 0 8px 18px rgba(50, 20, 0, 0.14);
  transform: rotate(var(--mini-rot, 0deg));
}

.mini-date-time {
  margin: 0 0 0.32rem;
  color: #b52258;
  font-size: 0.78rem;
  font-weight: 900;
}

.mini-place {
  margin: 0 0 0.45rem;
  color: #087672;
  font-size: 0.8rem;
  font-weight: 900;
}

.mini-thought {
  margin: 0 0 0.55rem;
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  font-weight: 800;
  line-height: 1.15;
}

.mini-postit footer {
  display: grid;
  gap: 0.15rem;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(70, 35, 15, 0.28);
  backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: min(94%, 510px);
  max-height: 88dvh;
  overflow: auto;
  padding: 1.05rem;
  border-radius: 26px;
  background: #fff6e8;
  box-shadow: 0 28px 80px rgba(38, 20, 4, 0.35);
}

.modal-close {
  position: absolute;
  right: 0.75rem;
  top: 0.65rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffe0e9;
  color: #b52258;
  font-size: 1.8rem;
  font-weight: 900;
}

.modal-card h2 {
  margin: 0.4rem 2.5rem 0.35rem 0;
  color: #0b6570;
  font-size: 1.35rem;
}

.modal-intro {
  margin: 0 2.5rem 1rem 0;
  color: #5b4a3f;
}

form {
  display: grid;
  gap: 0.65rem;
}

label {
  display: grid;
  gap: 0.28rem;
  font-weight: 900;
  color: #113852;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid #f4c7b5;
  border-radius: 16px;
  padding: 0.75rem 0.85rem;
  background: white;
  outline: none;
  color: #113852;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input[readonly] {
  color: rgba(6, 31, 55, 0.72);
  background: rgba(255, 255, 255, 0.62);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0fa09b;
  box-shadow: 0 0 0 4px rgba(15, 160, 155, 0.16);
}

.form-error {
  min-height: 1.1em;
  margin: 0.1rem 0;
  color: #b52258;
  font-weight: 800;
}

.toast {
  position: absolute;
  left: 50%;
  top: calc(0.8rem + env(safe-area-inset-top));
  z-index: 30;
  transform: translate(-50%, -150%);
  max-width: 88%;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #0b6570;
  box-shadow: 0 10px 30px rgba(30, 20, 0, 0.18);
  font-weight: 900;
  text-align: center;
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translate(-50%, 0);
}

.postit.anim-slideRight {
  animation: slideRight var(--transition-ms) both;
}

.postit.anim-fade {
  animation: fadeIn var(--transition-ms) both;
}

.postit.anim-zoomSoft {
  animation: zoomSoft var(--transition-ms) both;
}

.postit.anim-flipCard {
  animation: flipCard var(--transition-ms) both;
}

.postit.anim-swingDrop {
  animation: swingDrop var(--transition-ms) both;
  transform-origin: 50% 8%;
}

.postit.anim-rotateIn {
  animation: rotateIn var(--transition-ms) both;
}

.postit.anim-bounceIn {
  animation: bounceIn var(--transition-ms) both;
}

.postit.anim-floatUp {
  animation: floatUp var(--transition-ms) both;
}

.postit.anim-blurIn {
  animation: blurIn var(--transition-ms) both;
}

.postit.anim-paperTurn {
  animation: paperTurn var(--transition-ms) both;
}

.postit.anim-elasticPop {
  animation: elasticPop var(--transition-ms) both;
}

.postit.anim-diagonalSlide {
  animation: diagonalSlide var(--transition-ms) both;
}

.postit.anim-heartBeat {
  animation: heartBeat var(--transition-ms) both;
}

.postit.anim-starSpin {
  animation: starSpin var(--transition-ms) both;
}

.postit.anim-pinSwing {
  animation: pinSwing var(--transition-ms) both;
  transform-origin: 50% 8%;
}

.postit.anim-softShake {
  animation: softShake var(--transition-ms) both;
}

.postit.anim-rollIn {
  animation: rollIn var(--transition-ms) both;
}

.postit.anim-scaleRotate {
  animation: scaleRotate var(--transition-ms) both;
}

.postit.anim-curtainDown {
  animation: curtainDown var(--transition-ms) both;
}

.postit.anim-lightFlash {
  animation: lightFlash var(--transition-ms) both;
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(72%) rotate(var(--postit-rot, 0deg));
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes zoomSoft {
  from {
    opacity: 0;
    transform: scale(0.92) rotate(var(--postit-rot, 0deg));
  }

  to {
    opacity: 1;
    transform: scale(1) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes flipCard {
  from {
    opacity: 0;
    transform: perspective(800px) rotateY(80deg) rotate(var(--postit-rot, 0deg));
  }

  to {
    opacity: 1;
    transform: perspective(800px) rotateY(0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes swingDrop {
  0% {
    opacity: 0;
    transform: translateY(-45%) rotate(-10deg);
  }

  55% {
    opacity: 1;
    transform: translateY(0) rotate(5deg);
  }

  100% {
    opacity: 1;
    transform: rotate(var(--postit-rot, 0deg));
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-12deg) scale(0.95);
  }

  to {
    opacity: 1;
    transform: rotate(var(--postit-rot, 0deg)) scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.75);
  }

  60% {
    opacity: 1;
    transform: scale(1.06);
  }

  100% {
    transform: scale(1) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes floatUp {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(var(--postit-rot, 0deg));
  }

  to {
    opacity: 1;
    transform: translateY(0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes blurIn {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: scale(1.03);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes paperTurn {
  from {
    opacity: 0;
    transform: perspective(700px) rotateX(65deg);
  }

  to {
    opacity: 1;
    transform: perspective(700px) rotateX(0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes elasticPop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }

  70% {
    opacity: 1;
    transform: scale(1.08);
  }

  100% {
    transform: scale(1) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes diagonalSlide {
  from {
    opacity: 0;
    transform: translate(55%, 35%) rotate(8deg);
  }

  to {
    opacity: 1;
    transform: translate(0, 0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes heartBeat {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }

  45% {
    opacity: 1;
    transform: scale(1.08);
  }

  70% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes starSpin {
  from {
    opacity: 0;
    transform: rotate(38deg) scale(0.86);
  }

  to {
    opacity: 1;
    transform: rotate(var(--postit-rot, 0deg)) scale(1);
  }
}

@keyframes pinSwing {
  0% {
    opacity: 0;
    transform: rotate(-18deg);
  }

  55% {
    opacity: 1;
    transform: rotate(9deg);
  }

  100% {
    transform: rotate(var(--postit-rot, 0deg));
  }
}

@keyframes softShake {
  0% {
    opacity: 0;
    transform: translateX(25px);
  }

  35% {
    opacity: 1;
    transform: translateX(-10px);
  }

  65% {
    transform: translateX(6px);
  }

  100% {
    transform: translateX(0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes rollIn {
  from {
    opacity: 0;
    transform: translateX(65%) rotate(35deg);
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes scaleRotate {
  from {
    opacity: 0;
    transform: scale(0.72) rotate(-18deg);
  }

  to {
    opacity: 1;
    transform: scale(1) rotate(var(--postit-rot, 0deg));
  }
}

@keyframes curtainDown {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
  }

  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}

@keyframes lightFlash {
  0% {
    opacity: 0;
    filter: brightness(1.5);
  }

  50% {
    opacity: 1;
    filter: brightness(1.12);
  }

  100% {
    filter: brightness(1);
  }
}


@media (max-width: 520px) {
  .passed-panel {
    width: 96%;
    top: calc(0.55rem + env(safe-area-inset-top));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
    border-radius: 24px;
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding: clamp(10px, 2vh, 22px);
  }

  .device-frame {
    height: min(100dvh - 28px, 1040px);
    width: auto;
    aspect-ratio: var(--frame-ratio);
    border-radius: 28px;
    box-shadow: 0 25px 90px rgba(76, 38, 12, 0.38);
  }

  .stage {
    top: 56.5%;
  }

  .postit {
    width: clamp(95%, min(65vh * 9 / 16, 68vh), 730px);
  }
}

@media (max-height: 760px) {
  .stage {
    top: 57.5%;
    gap: 0.25rem;
  }

  .postit {
    width: clamp(95%, min(62vw, 45svh), 500px);
  }

  .add-thought {
    padding: 0.54rem 0.82rem;
    margin-bottom: 25px;
    min-height: 42px;
  }

  .thought {
    --thought-base-font-size: clamp(1.65rem, min(4.6vw, 2.8svh), 2.1rem);
  }
}

@media (max-height: 620px) {
  .stage {
    top: 59%;
  }

  .postit {
    width: clamp(95%, min(58vw, 41svh), 390px);
  }

  .add-thought {
    font-size: 1.74rem;
  }

  .visitor {
    font-size: 1.58rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
/* Correzioni definitive pulsanti e card: valgono per tutte le risoluzioni */
.show-all-thoughts {
  top: calc(0.05rem + env(safe-area-inset-top)) !important;
  margin-top: 10px !important;
  min-height: 28px !important;
  padding: 0.22rem 0.56rem !important;
  font-size: clamp(0.68rem, 1.55vw, 0.82rem) !important;
  line-height: 1 !important;
  z-index: 40 !important;
}

.nav-thought {
  width: 32px !important;
  height: 52px !important;
  min-width: 32px !important;
  min-height: 52px !important;
  max-width: 32px !important;
  max-height: 52px !important;
  padding: 0 !important;
  font-size: 2.15rem !important;
  line-height: 1 !important;
  z-index: 40 !important;
}

.mini-postit {
  min-height: auto !important;
}

/* Contenuto semantico per accessibilità e SEO, senza alterare la grafica del muro. */
.seo-summary {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
