:root {
  --bordeaux: #68142b;
  --ombra: rgba(44, 46, 44, 0.25);
  --fondo: #e0fff8;
  --chiaro: #e0fff8;
  --scuro: #054041;
  --sh: 4px;
  --curva: cubic-bezier(0.215, 0.61, 0.355, 1);
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: 'Inter Variable', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--scuro);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.pagina {
  position: relative;
  height: 100vh;
  height: 100svh;
  background: var(--fondo);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* a very light weave over the tint, like the paper of a printed dictionary */
.pagina::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg, rgba(44, 46, 44, 0.035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(44, 46, 44, 0.025) 0 1px, transparent 1px 5px);
}

.colonna {
  position: relative;
  width: min(540px, 88vw, 62vh);
  margin: 0 auto;
  padding-top: clamp(14px, 14vh, 170px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(10px, 2.6vh, 26px);
}

/* an invisible frame as tall as the column with the entry open: the preview is framed on it */
.cornice {
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(14px, 14vh, 170px);
  height: var(--alto, 60vh);
  pointer-events: none;
  visibility: hidden;
}

/* ---- the house and the name of the dictionary ---- */
.testata { text-align: center; }

.marchio {
  font-family: var(--serif);
  font-size: clamp(15px, min(4.4vw, 3.4vh), 30px);
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: var(--scuro);
  line-height: 1.1;
}

.sottotitolo {
  margin-top: 0.35em;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(10.5px, min(3vw, 1.9vh), 17px);
  color: var(--scuro);
  opacity: 0.72;
}

/* ---- the tabs: one stamped square per word ---- */
.linguette {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2.4vw, 12px);
}

.linguetta {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  width: clamp(28px, min(8.4vw, 5.6vh), 46px);
  height: clamp(28px, min(8.4vw, 5.6vh), 46px);
  filter: drop-shadow(calc(var(--sh) * 0.75) calc(var(--sh) * 0.75) 0 var(--ombra));
  transition: filter 0.5s var(--curva);
  -webkit-tap-highlight-color: transparent;
}

.linguetta-faccia {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--chiaro-l);
  border: 1px solid var(--scuro-l);
  border-radius: 7px;
  box-shadow: inset 0 0 0 2px var(--chiaro-l), inset 0 0 0 3px var(--scuro-l);
  font-family: var(--serif);
  font-size: clamp(12px, min(3.6vw, 2.4vh), 20px);
  color: var(--scuro-l);
  line-height: 1;
  transition: background-color 0.45s var(--curva), color 0.45s var(--curva), transform 0.3s var(--curva);
}

.linguetta.attiva { filter: drop-shadow(0 0 0 transparent); }
.linguetta.attiva .linguetta-faccia {
  background: var(--scuro-l);
  color: var(--chiaro-l);
  transform: translate(1px, 1px);
}

.linguetta.su { filter: drop-shadow(0 0 0 transparent); }

@media (hover: hover) {
  .linguetta:hover { filter: drop-shadow(0 0 0 transparent); }
}

.linguetta:focus-visible { outline: 1.5px solid var(--scuro); outline-offset: 4px; border-radius: 8px; }

/* ---- the entry ---- */
.maschera {
  overflow: hidden;
  padding: 2px 12px 12px 2px;
  margin: -2px -12px -12px -2px;
}

.voce {
  position: relative;
  will-change: transform;
}

.carta-ombra {
  filter: drop-shadow(var(--sh) var(--sh) 0 var(--ombra));
  transition: filter 0.5s var(--curva);
}

.voce.su .carta-ombra { filter: drop-shadow(0 0 0 transparent); }

@media (hover: hover) {
  .voce:hover .carta-ombra { filter: drop-shadow(0 0 0 transparent); }
}

.carta {
  background: var(--chiaro);
  border: 1px solid var(--scuro);
  padding: 3px;
}

.carta-dentro {
  border: 1.5px solid var(--scuro);
  padding: clamp(12px, min(4vw, 2.6vh), 22px) clamp(14px, 4.4vw, 24px) clamp(12px, min(3.6vw, 2.4vh), 20px);
}

.capo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.parola {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, min(6.4vw, 4.6vh), 42px);
  line-height: 1.12;
  letter-spacing: -0.005em;
  color: var(--scuro);
  overflow-wrap: anywhere;
}

.fonetica {
  margin-top: 0.3em;
  font-family: var(--serif);
  font-size: clamp(11px, min(3.2vw, 2vh), 17px);
  color: var(--scuro);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.trascrizione { opacity: 0.85; }

.cursore-testo {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  margin-left: 2px;
  background: var(--scuro);
}

.genere {
  margin-left: 0.4em;
  font-family: var(--serif);
}

.genere b { font-weight: 700; font-family: var(--sans); font-size: 0.92em; letter-spacing: 0.01em; }

/* the round button with the plus that turns into a minus */
.tasto {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  flex: none;
  width: clamp(30px, min(8.6vw, 5.6vh), 50px);
  height: clamp(30px, min(8.6vw, 5.6vh), 50px);
  margin-top: 2px;
  filter: drop-shadow(calc(var(--sh) * 0.6) calc(var(--sh) * 0.6) 0 var(--ombra));
  transition: filter 0.5s var(--curva);
  -webkit-tap-highlight-color: transparent;
}

.tasto-faccia {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--chiaro);
  border: 1px solid var(--scuro);
  box-shadow: inset 0 0 0 2px var(--chiaro), inset 0 0 0 3px var(--scuro);
  transition: transform 0.3s var(--curva);
}

.tasto svg { width: 44%; height: 44%; overflow: visible; }
.tasto path { stroke: var(--scuro); stroke-width: 1.6; stroke-linecap: round; fill: none; }

.tasto.su { filter: drop-shadow(0 0 0 transparent); }
.tasto.giu .tasto-faccia { transform: translate(1px, 1px) scale(0.96); }

@media (hover: hover) {
  .tasto:hover { filter: drop-shadow(0 0 0 transparent); }
}

.tasto:focus-visible { outline: 1.5px solid var(--scuro); outline-offset: 3px; border-radius: 50%; }

.filo {
  display: block;
  height: 1.5px;
  margin-top: clamp(10px, 2vh, 16px);
  background: var(--scuro);
  transform-origin: left center;
}

/* the body that unfolds */
.corpo { height: 0; overflow: hidden; }

.corpo-dentro {
  padding-top: clamp(10px, 2.2vh, 18px);
  font-size: clamp(11.5px, min(3.4vw, 2.05vh), 18px);
  line-height: 1.45;
  color: var(--scuro);
}

.etimo { opacity: 0.9; }

.etimo i {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02em;
  padding: 0 0.12em;
  background-image: linear-gradient(var(--velo), var(--velo));
  background-repeat: no-repeat;
  background-position: 0 78%;
  background-size: var(--segno, 0%) 0.7em;
}

.def { margin-top: clamp(7px, 1.4vh, 12px); }
.def b { font-weight: 650; }

.sep {
  display: block;
  width: 22px;
  height: 1px;
  margin-top: clamp(7px, 1.4vh, 12px);
  background: var(--scuro);
  opacity: 0.45;
  transform-origin: left center;
}

/* the drawn pointer of the autopilot */
.puntatore {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  filter: drop-shadow(1px 1.5px 0 rgba(44, 46, 44, 0.3));
}

.puntatore path { fill: #fff; stroke: #1c1c1c; stroke-width: 1.3; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
  .linguetta, .tasto, .carta-ombra, .linguetta-faccia, .tasto-faccia { transition: none; }
}
