/* Mots laissés sur le bureau des collègues (desk-notes.js) : la pastille de ses mots, leur place
   dans la fiche du bureau, la fenêtre qui en écrit un, le paquet qu'on tient pour le poser, et la
   fenêtre qui ouvre le paquet. Le papier
   reste clair, même en thème sombre : c'est une feuille. */

/* --- Pastille, en haut à gauche, à côté de la pièce --- */
.note-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 6px 8px 6px 11px;
  font: inherit;
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  flex: none;
  animation: note-pill-in var(--dur-slow) var(--ease-spring) backwards;
}
.note-pill .ic {
  flex: none;
}
.note-pill .ic svg {
  width: 16px;
  height: 16px;
  display: block;
  color: var(--accent);
}
.note-pill:active {
  transform: scale(0.96);
}
.note-pill.bump .ic {
  animation: note-pill-bump 900ms var(--ease-spring);
}
.note-pill.leaving {
  animation: pop-out var(--dur-fast) var(--ease-in) forwards;
}
@keyframes note-pill-in {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.9);
  }
}
@keyframes note-pill-bump {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateY(-3px) rotate(-12deg);
  }
  45% {
    transform: translateY(0) rotate(9deg);
  }
  70% {
    transform: rotate(-4deg);
  }
}

/* --- Fiche du bureau --- */
.card-notes {
  margin: 8px 4px 2px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--fill);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-sub);
}
.notes-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.notes-head .grow {
  flex: 1;
  min-width: 0;
}
.notes-head .ic svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  display: block;
}
.notes-waiting {
  color: var(--text-2);
  font-size: var(--fs-footnote);
}
.note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  padding: 5px 6px;
  margin: 0 -6px;
  border-radius: var(--r-sm);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.note-row:hover {
  background: var(--fill);
}
.note-dot {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: color-mix(in srgb, var(--paper) 30%, #fffdf7);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--paper) 70%, transparent);
}
.note-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.note-row-first {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-row small {
  color: var(--text-2);
  font-size: var(--fs-caption);
}
.notes-more {
  border: 0;
  background: none;
  padding: 2px 0;
  font: inherit;
  font-size: var(--fs-footnote);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px;
}

/* --- Écrire un mot --- */
.note-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.note-title canvas {
  border-radius: 50%;
  background: var(--fill);
}
.note-sub {
  color: var(--text-2);
  font-size: var(--fs-sub);
  margin-top: 2px;
}
.note-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--text-2);
}
.note-label small {
  font-weight: 500;
  color: var(--text-3);
}
.note-count {
  font-weight: 500;
  font-size: var(--fs-caption);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.note-input {
  min-height: 92px;
  resize: none;
  font-size: var(--fs-callout);
  line-height: 1.45;
}
.note-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-emojis,
.note-papers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.note-emoji-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  transition: transform var(--dur-slow) var(--ease-spring), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.note-emoji-btn[data-e=""] {
  font-size: var(--fs-footnote);
  font-weight: 600;
  color: var(--text-2);
}
.note-emoji-btn:hover {
  background: var(--fill-2);
}
.note-emoji-btn[aria-pressed="true"],
.note-paper-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 0 2px var(--accent);
}
.note-emoji-btn[aria-pressed="true"] {
  transform: scale(1.08);
}
.note-paper-btn {
  width: 52px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill);
  cursor: pointer;
  transition: transform var(--dur-slow) var(--ease-spring), box-shadow var(--dur-fast) var(--ease-out);
}
.note-paper-btn canvas {
  width: 40px;
  height: 48px;
  image-rendering: pixelated;
}
.note-paper-btn[aria-pressed="true"] canvas {
  animation: note-hop 1.6s var(--ease-out) infinite;
}
.note-emoji-btn:active,
.note-paper-btn:active {
  transform: scale(0.94);
  transition-duration: var(--dur-press);
}
.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.note-next {
  flex: 1 1 180px;
  font-size: var(--fs-footnote);
  color: var(--text-3);
}
/* Boutons avec une icône : l'icône et le texte sur la même ligne, centrés. */
.note-composer .btn,
.note-actions .btn,
.note-hand-tip .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.note-composer .btn .ic,
.note-actions .btn .ic {
  display: inline-flex;
}
.note-composer .btn .ic svg,
.note-actions .btn .ic svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* --- Le paquet en main : il suit la souris, la bulle dit quoi faire --- */
#world.holding-gift {
  cursor: none !important;
}
#app:has(#world.holding-gift) #hint {
  opacity: 0;
  pointer-events: none;
}
.note-hand-tip {
  position: absolute;
  left: var(--dock-left, 50%);
  bottom: calc(var(--edge) + var(--dock-h) + var(--gap));
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sub);
  white-space: nowrap;
  animation: note-tip-in var(--dur-slow) var(--ease-spring) backwards;
}
.note-hand-tip > .ic svg {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--accent);
}
.note-hand-tip > span {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.note-hand-tip small {
  color: var(--text-2);
  font-size: var(--fs-footnote);
}
.note-hand-tip.nudge {
  animation: note-nudge 420ms var(--ease-out);
}
.note-hand-tip.leaving {
  animation: note-tip-out var(--dur-fast) var(--ease-in) forwards;
}
@keyframes note-tip-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.96);
  }
}
@keyframes note-tip-out {
  to {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.97);
  }
}
@keyframes note-nudge {
  0%,
  100% {
    transform: translateX(-50%);
  }
  25% {
    transform: translateX(calc(-50% - 7px));
  }
  50% {
    transform: translateX(calc(-50% + 6px));
  }
  75% {
    transform: translateX(calc(-50% - 3px));
  }
}

/* --- Ouvrir un mot --- */
.modal.note-reader {
  width: min(440px, 100%);
  overflow: hidden;
}
.note-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 250px;
}
.note-stage > * {
  grid-area: 1 / 1;
}
.note-stage.sheet {
  min-height: 0;
  padding: 4px 0;
}
/* (Hors du flux : le halo ne compte pas dans la hauteur de la fenêtre.) */
.note-glow {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--paper) 45%, transparent) 0%, transparent 68%);
  animation: note-glow 2.4s ease-in-out infinite;
  pointer-events: none;
}
.note-gift {
  border: 0;
  padding: 10px;
  background: none;
  border-radius: var(--r-xl);
  cursor: pointer;
  outline: none;
  z-index: 2;
  animation: note-wiggle 2.8s var(--ease-out) infinite;
}
.note-gift:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.note-big {
  display: block;
  image-rendering: pixelated;
}
.note-gift.shake {
  animation: note-shake 420ms ease-in-out;
}
.note-gift.open {
  animation: none;
  pointer-events: none;
  box-shadow: none;
}
.note-split {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.note-gift.open .lid {
  animation: note-lid 760ms var(--ease-out) forwards;
}
.note-gift.open .box {
  animation: note-box 520ms var(--ease-in) 120ms forwards;
}
.note-tap {
  margin: 0;
  text-align: center;
  font-size: var(--fs-sub);
  color: var(--text-2);
}
.note-tap small {
  font-size: inherit;
  color: var(--text-3);
}
.note-burst {
  width: 0;
  height: 0;
  position: relative;
  z-index: 4;
  pointer-events: none;
}
.note-burst i {
  position: absolute;
  left: -4px;
  top: -6px;
  width: 8px;
  height: 11px;
  border-radius: 2px;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(31, 23, 53, 0.12);
  opacity: 0;
  animation: note-confetti 1000ms cubic-bezier(0.15, 0.7, 0.3, 1) var(--d) forwards;
}

/* La feuille : une moitié du bas posée, une moitié du haut (le rabat) qui se relève. */
.note-paper {
  position: relative;
  width: min(340px, 100%);
  perspective: 1100px;
  z-index: 3;
}
.note-face {
  box-sizing: border-box;
  padding: 26px 24px 16px;
  border-radius: 8px;
  color: #2a2140;
  background:
    linear-gradient(color-mix(in srgb, var(--paper) 75%, white) 0 5px, transparent 5px),
    repeating-linear-gradient(transparent 0 25px, rgba(121, 68, 192, 0.07) 25px 26px),
    color-mix(in srgb, var(--paper) 10%, #fffdf7);
  box-shadow:
    0 18px 34px -16px rgba(31, 23, 53, 0.45),
    0 2px 6px -2px rgba(31, 23, 53, 0.18);
}
.note-emoji {
  font-size: 34px;
  line-height: 1;
  text-align: center;
  margin-bottom: 12px;
}
.note-text {
  margin: 0;
  font-size: 16px;
  line-height: 26px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-sign {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: var(--fs-footnote);
  color: rgba(42, 33, 64, 0.6);
}
.note-sign b {
  color: #2a2140;
  font-weight: 650;
}
.note-sign b::before {
  content: "— ";
  font-weight: 400;
}
.note-paper.unfolding {
  animation: note-rise 560ms var(--ease-spring) both;
}
.note-paper.unfolding > .note-face {
  clip-path: inset(50% 0 0 0);
}
.note-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(var(--h) / 2);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  animation: note-unfold 640ms var(--ease-sheet) 460ms both;
}
.note-flap-front,
.note-flap-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px 8px 0 0;
}
.note-flap-front {
  overflow: hidden;
}
.note-flap-front .note-face {
  box-shadow: none;
}
.note-flap-back {
  transform: rotateX(180deg);
  background:
    linear-gradient(to top, rgba(31, 23, 53, 0.1), transparent 30%),
    color-mix(in srgb, var(--paper) 22%, #f4efe4);
}
.note-actions.later {
  animation: note-actions-in var(--dur-slow) var(--ease-out) 1050ms backwards;
}
.note-paper.crumple .note-face {
  animation: note-crumple 520ms var(--ease-in) forwards;
}

@keyframes note-wiggle {
  0%,
  62%,
  100% {
    transform: none;
  }
  68% {
    transform: translateY(-8px) rotate(-6deg) scale(1.03);
  }
  74% {
    transform: translateY(0) rotate(5deg);
  }
  80% {
    transform: translateY(-4px) rotate(-3deg);
  }
  86% {
    transform: rotate(0);
  }
}
@keyframes note-shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: rotate(-9deg) scale(1.04);
  }
  40% {
    transform: rotate(8deg) scale(1.06);
  }
  60% {
    transform: rotate(-6deg) scale(1.08);
  }
  80% {
    transform: rotate(4deg) scale(1.1, 0.94);
  }
}
@keyframes note-lid {
  to {
    transform: translate(-46px, -150px) rotate(-38deg);
    opacity: 0;
  }
}
@keyframes note-box {
  to {
    transform: translateY(40px) scale(0.8, 0.5);
    opacity: 0;
  }
}
@keyframes note-confetti {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.4);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), calc(var(--dy) + 70px)) rotate(var(--r)) scale(1);
  }
}
@keyframes note-glow {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}
@keyframes note-hop {
  0%,
  70%,
  100% {
    transform: none;
  }
  80% {
    transform: translateY(-4px);
  }
  90% {
    transform: translateY(0) scale(1.06, 0.94);
  }
}
@keyframes note-rise {
  from {
    opacity: 0;
    transform: translateY(70px) scale(0.35);
  }
  30% {
    opacity: 1;
  }
}
@keyframes note-unfold {
  from {
    transform: rotateX(-180deg);
  }
  to {
    transform: rotateX(0deg);
  }
}
@keyframes note-actions-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes note-crumple {
  40% {
    border-radius: 40%;
    transform: scale(0.45) rotate(90deg);
  }
  to {
    opacity: 0;
    border-radius: 50%;
    transform: translateY(90px) scale(0.12) rotate(240deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .note-gift,
  .note-glow,
  .note-paper-btn[aria-pressed="true"] canvas,
  .note-pill.bump .ic {
    animation: none;
  }
}
