:root {
  --bg1: #ffe6ee;
  --bg2: #ffd3e2;
  --bg3: #f1e2ff;
  --pink: #ff8fb1;
  --rose: #ff6f9c;
  --pink-deep: #e2507f;
  --text: #5b3a4b;
  --muted: #9a7486;
  --card: rgba(255, 255, 255, 0.75);
  --shadow: 0 10px 30px rgba(226, 80, 127, 0.18);
  --radius: 22px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 14px rgba(226, 80, 127, 0.12);
}

.nav-brand {
  font-family: 'Pacifico', cursive;
  font-size: 1.35rem;
  color: var(--pink-deep);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}
.nav-links a:hover { background: rgba(255, 143, 177, 0.22); }
.nav-links a:active { transform: scale(0.95); }
.nav-links a.active { background: var(--pink); color: #fff; }

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* ---------- Buttons & inputs ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 30px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--rose), var(--pink-deep));
  box-shadow: 0 6px 16px rgba(226, 80, 127, 0.35);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(226, 80, 127, 0.4); }
.btn:active { transform: scale(0.96); }

.input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #ffc2d4;
  border-radius: 16px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 143, 177, 0.25); }

/* ---------- Login ---------- */
.page-login .main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(100%, 380px);
  padding: 32px 24px;
  text-align: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.login-card.shake { animation: shake 0.45s ease both; }
.login-card h1 { margin: 8px 0 4px; font-family: 'Pacifico', cursive; font-weight: 400; color: var(--pink-deep); }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-emoji { font-size: 2.6rem; }
.error { margin: 0 !important; color: var(--pink-deep) !important; font-weight: 500; }

/* ---------- Home ---------- */
.hero {
  min-height: calc(100vh - 140px);
  min-height: calc(100dvh - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
}

.love-message {
  margin: 0;
  font-family: 'Pacifico', cursive;
  font-weight: 400;
  font-size: clamp(2.2rem, 9vw, 4.5rem);
  line-height: 1.35;
  color: var(--pink-deep);
  text-shadow: 0 3px 0 #fff, 0 8px 24px rgba(226, 80, 127, 0.35);
  animation: heartbeat 2.6s ease-in-out 2.4s infinite;
}
.love-message .word { display: inline-block; white-space: nowrap; }
.love-message .letter { display: inline-block; }

.anim-bounce .letter {
  animation: bounceIn 0.8s cubic-bezier(0.28, 0.84, 0.42, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
.anim-wave .letter {
  animation: riseIn 0.7s ease-out both, wave 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 55ms), calc(var(--i) * 90ms + 1.3s);
}
.anim-pop .letter {
  animation: popLetter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i) * 70ms);
}
.anim-spin .letter {
  animation: spinIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i) * 65ms);
}

.polaroid {
  margin: 0;
  width: min(78vw, 340px);
  padding: 12px 12px 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(91, 58, 75, 0.22);
  animation: dropIn 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s both, sway 6s ease-in-out 2s infinite;
}
.polaroid img,
.photo-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
}
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #fff0f5, #fff0f5 14px, #ffe4ee 14px, #ffe4ee 28px);
  color: var(--muted);
}
.photo-placeholder span { font-size: 3rem; }
.photo-placeholder p { margin: 6px 0 0; }
.polaroid figcaption {
  padding: 10px 0 14px;
  font-family: 'Pacifico', cursive;
  font-size: 1.3rem;
  color: var(--text);
}

.hint {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  animation: fadeIn 1s ease 2.2s both;
}

.hearts-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
}
.float-heart {
  position: absolute;
  font-size: var(--size, 24px);
  opacity: 0;
  animation: floatUp var(--dur, 3s) ease-out var(--delay, 0s) forwards;
  will-change: transform, opacity;
}

/* ---------- Games gallery ---------- */
.page-head { text-align: center; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-family: 'Pacifico', cursive; font-weight: 400; font-size: clamp(2rem, 7vw, 3rem); color: var(--pink-deep); }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 18px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
a.game-card:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 16px 34px rgba(226, 80, 127, 0.25); }
a.game-card:active { transform: scale(0.97); }
.game-card h2 { margin: 4px 0 0; font-size: 1.3rem; }
.game-card p { margin: 0; color: var(--muted); }
.game-emoji { font-size: 3rem; }
.play-pill {
  margin-top: 10px;
  padding: 6px 18px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  background: var(--pink);
}
.coming-soon { opacity: 0.6; border: 2px dashed #ffb6cb; box-shadow: none; background: rgba(255, 255, 255, 0.4); }

/* ---------- Sausage dog game ---------- */
.game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}
.game-header { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-header h1 { margin: 0; font-size: clamp(1.3rem, 5vw, 1.7rem); color: var(--pink-deep); }
.back-link { color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.back-link:hover { color: var(--pink-deep); }

/* Board fits the screen width, and shrinks on short screens so the d-pad stays visible. */
.scoreboard, .board { width: min(100%, 480px, max(260px, calc(100vh - 340px))); }
@supports (height: 100dvh) {
  .scoreboard, .board { width: min(100%, 480px, max(260px, calc(100dvh - 340px))); }
}

.scoreboard { display: flex; gap: 8px; }
.pill {
  flex: 1;
  padding: 8px 12px;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  background: var(--card);
  box-shadow: 0 4px 12px rgba(226, 80, 127, 0.12);
}
.icon-btn {
  flex: 0 0 auto;
  width: 48px;
  border: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.board {
  position: relative;
  border: 4px solid #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.board.shake { animation: shake 0.45s ease; }
.board canvas { display: block; width: 100%; aspect-ratio: 1; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(255, 240, 246, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 0.25s;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.overlay { overflow-y: auto; }
.overlay-card { max-width: 300px; margin: auto; text-align: center; }
.overlay-card h2 { margin: 2px 0; color: var(--pink-deep); font-size: 1.35rem; }
.overlay-card p { margin: 0 0 12px; color: var(--text); }
.overlay-emoji { font-size: 2.6rem; animation: bob 1.6s ease-in-out infinite; }

/* ---------- Player picker ---------- */
.player-picker { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; }
.player-picker[hidden] { display: none; }
.player-picker.needs-pick { animation: shake 0.45s ease; }
.player-picker.needs-pick .picker-label { color: var(--pink-deep); }
.picker-label { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.picker-options { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  box-shadow: 0 3px 10px rgba(226, 80, 127, 0.15);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.player-chip:active { transform: scale(0.95); }
.player-chip[aria-pressed="true"] { border-color: var(--pink-deep); background: #fff0f5; }
.player-chip[aria-pressed="true"]::after { content: '✓'; color: var(--pink-deep); }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 600;
  color: #fff;
}
.avatar-1 { background: linear-gradient(135deg, #7fb5ff, #5a8de6); }
.avatar-2 { background: linear-gradient(135deg, #ff9ec0, #e2507f); }

/* ---------- Leaderboard ---------- */
.leaderboard {
  width: min(100%, 480px);
  margin-top: 8px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.leaderboard h2 { margin: 0 0 10px; font-size: 1.2rem; text-align: center; color: var(--pink-deep); }
.leaderboard-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #fff;
}
.leaderboard-row.is-current { border-color: #ffc2d4; }
.leaderboard-row.flash { animation: flash 1.2s ease; }
.leaderboard-row .avatar { width: 36px; height: 36px; font-size: 1.1rem; }
.lb-name { font-weight: 600; }
.lb-plays { font-size: 0.85rem; color: var(--muted); }
.lb-best { font-weight: 600; font-size: 1.1rem; min-width: 3.5em; text-align: right; }

@keyframes flash {
  0%, 100% { background: #fff; }
  30%      { background: #ffe0ea; transform: scale(1.02); }
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  grid-template-rows: repeat(2, 60px);
  gap: 8px;
  margin-top: 4px;
}
.dpad button {
  border: 0;
  border-radius: 18px;
  font-size: 1.5rem;
  color: var(--pink-deep);
  background: #fff;
  box-shadow: 0 5px 0 #ffc2d4, 0 8px 16px rgba(226, 80, 127, 0.18);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.dpad button:active { transform: translateY(4px); box-shadow: 0 1px 0 #ffc2d4; }
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }

.controls-hint { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); text-align: center; }

/* Show keyboard hints on desktop, touch controls on phones */
@media (hover: hover) and (pointer: fine) {
  .dpad, .hint-touch { display: none; }
}
@media (hover: none), (pointer: coarse) {
  .hint-keys { display: none; }
}

/* ---------- Match 3 ---------- */
/* No d-pad on this game, so the board can use more of the screen height. */
.no-dpad .scoreboard, .no-dpad .board { width: min(100%, 480px, max(260px, calc(100vh - 250px))); }
@supports (height: 100dvh) {
  .no-dpad .scoreboard, .no-dpad .board { width: min(100%, 480px, max(260px, calc(100dvh - 250px))); }
}
.board-match3 canvas { cursor: pointer; }
.moves-pill { white-space: nowrap; }
.moves-pill.low { color: var(--pink-deep); animation: heartbeat 1s ease-in-out infinite; }

.how-to {
  width: min(100%, 480px);
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.how-to summary { cursor: pointer; font-weight: 600; color: var(--pink-deep); text-align: center; }
.how-to ul { display: grid; gap: 6px; margin: 10px 0 0; padding-left: 20px; }

/* ---------- The board ---------- */
.page-board .main { max-width: 1240px; }
.board-page { display: flex; flex-direction: column; gap: 12px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.board-head h1 { margin: 0; font-family: 'Pacifico', cursive; font-weight: 400; font-size: clamp(1.8rem, 6vw, 2.6rem); color: var(--pink-deep); }
.board-head p { margin: 0; color: var(--muted); }
.add-note-btn { padding: 10px 22px; font-size: 1rem; }

.board-frame { position: relative; }
.board-scroll {
  height: calc(100vh - 250px);
  min-height: 340px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 6px solid #fff;
  border-radius: 24px;
  background: #fffefc;
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  /* Pan by dragging instead of with scrollbars. */
  scrollbar-width: none;
}
.board-scroll::-webkit-scrollbar { display: none; }
.board-scroll.panning { cursor: grabbing; }
@supports (height: 100dvh) {
  .board-scroll { height: calc(100dvh - 250px); }
}
.whiteboard {
  position: relative;
  background-color: #fffefc;
  background-image: radial-gradient(circle, #f6cbda 1.4px, transparent 1.8px);
  background-size: 28px 28px;
}
.board-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
  font-family: 'Patrick Hand', 'Fredoka', cursive;
  font-size: 1.5rem;
  color: var(--muted);
  pointer-events: none;
}
.board-empty[hidden] { display: none; }
.board-hint { margin: 0; text-align: center; font-size: 0.9rem; color: var(--muted); }

.note-yellow   { --note-bg: #fff3a6; }
.note-pink     { --note-bg: #ffd3e2; }
.note-blue     { --note-bg: #d2e8ff; }
.note-green    { --note-bg: #d6f5cf; }
.note-lavender { --note-bg: #e7dcff; }

.note {
  position: absolute;
  padding: 14px 14px 8px;
  font-family: 'Patrick Hand', 'Fredoka', cursive;
  font-size: 1.25rem;
  line-height: 1.25;
  color: #4a3340;
  background: var(--note-bg);
  border-radius: 3px 3px 16px 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05), 0 10px 18px rgba(91, 58, 75, 0.18);
  transform: rotate(var(--tilt, 0deg));
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: left 0.35s ease, top 0.35s ease, transform 0.15s, box-shadow 0.15s;
  animation: noteIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.note::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffb3cd, #e2507f 70%);
  box-shadow: 0 2px 3px rgba(91, 58, 75, 0.3);
  transform: translateX(-50%);
}
.note.dragging {
  cursor: grabbing;
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 22px 36px rgba(91, 58, 75, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}
.note.removing { animation: noteOut 0.25s ease forwards; pointer-events: none; }
.note-img {
  display: block;
  width: 100%;
  max-height: 190px;
  margin-bottom: 8px;
  object-fit: cover;
  border: 4px solid #fff;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(91, 58, 75, 0.15);
  pointer-events: none;
  -webkit-user-drag: none;
}
.note-img[hidden] { display: none; }
.note-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-text:empty { display: none; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.note .avatar { width: 24px; height: 24px; font-family: 'Fredoka', sans-serif; font-size: 0.8rem; }
.note-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.note:hover .note-actions, .note:focus-within .note-actions { opacity: 1; }
.note-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  touch-action: manipulation;
}
.note-actions button:hover { background: #fff; }
@media (hover: none) {
  .note-actions { opacity: 0.9; }
}

/* ---------- Note dialogs ---------- */
.note-dialog {
  width: min(92vw, 400px);
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: #fff8fb;
  box-shadow: var(--shadow);
  font-family: inherit;
  overflow-y: auto;
}
.note-dialog[open] { animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.note-dialog::backdrop { background: rgba(91, 58, 75, 0.35); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.note-dialog h2 { margin: 0; text-align: center; font-size: 1.35rem; color: var(--pink-deep); }
.note-form { display: flex; flex-direction: column; gap: 12px; }
.note-form .player-picker { margin: 0; }

.note-editor {
  padding: 12px;
  background: var(--note-bg);
  border-radius: 3px 3px 16px 3px;
  box-shadow: 0 8px 16px rgba(91, 58, 75, 0.14);
  transition: background 0.2s;
}
.note-editor textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: 0;
  border: 0;
  outline: none;
  resize: vertical;
  font-family: 'Patrick Hand', 'Fredoka', cursive;
  font-size: 1.3rem;
  line-height: 1.25;
  color: #4a3340;
  background: transparent;
}
.editor-photo { position: relative; margin-bottom: 8px; }
.editor-photo[hidden] { display: none; }
.editor-photo img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 4px solid #fff;
  border-radius: 3px;
  background: #fff;
}
.photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  font: inherit;
  color: var(--pink-deep);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.editor-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; }
.swatch {
  position: relative;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(91, 58, 75, 0.15);
  border-radius: 50%;
  background: var(--note-bg);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:hover { transform: scale(1.1); }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--pink-deep); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--pink-deep); outline-offset: 4px; }
.photo-btn {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 500;
  background: #fff;
  box-shadow: 0 3px 10px rgba(226, 80, 127, 0.15);
  cursor: pointer;
}
.photo-btn:has(input:focus-visible) { outline: 2px solid var(--pink-deep); outline-offset: 2px; }
.form-error { margin: 0; text-align: center; font-size: 0.95rem; font-weight: 500; color: var(--pink-deep); }
.form-error:empty { display: none; }

.dialog-actions { display: flex; justify-content: center; gap: 10px; }
.dialog-actions .btn { padding: 10px 24px; font-size: 1rem; }
.btn-soft { color: var(--pink-deep); background: #fff; box-shadow: 0 4px 12px rgba(226, 80, 127, 0.15); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.confirm-dialog { width: min(90vw, 320px); text-align: center; }
.confirm-dialog p { margin: 6px 0 16px; color: var(--muted); }
.confirm-emoji { font-size: 2.4rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 500;
  color: #fff;
  background: rgba(91, 58, 75, 0.9);
  box-shadow: 0 8px 20px rgba(91, 58, 75, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 420px) {
  .nav-links a { padding: 8px 9px; }
  .main { padding-top: 16px; }
  .board-scroll { border-width: 4px; border-radius: 18px; }
}

/* ---------- Keyframes ---------- */
@keyframes bounceIn {
  0%   { opacity: 0; transform: translateY(-120%) scale(0.6); }
  60%  { opacity: 1; transform: translateY(12%) scale(1.05); }
  80%  { transform: translateY(-6%); }
  100% { opacity: 1; transform: none; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(40px) rotate(12deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes wave {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes popLetter {
  0%   { opacity: 0; transform: scale(0) rotate(-20deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes spinIn {
  0%   { opacity: 0; transform: rotateY(90deg) scale(0.5); }
  100% { opacity: 1; transform: none; }
}
@keyframes heartbeat {
  0%, 40%, 100% { transform: scale(1); }
  10%, 30%      { transform: scale(1.06); }
  20%           { transform: scale(0.98); }
}
@keyframes dropIn {
  0%   { opacity: 0; transform: translateY(-60px) rotate(-12deg); }
  100% { opacity: 1; transform: rotate(-3deg); }
}
@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(2deg) translateY(-4px); }
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - var(--rise, 200px))) rotate(var(--rot, 0deg)); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: none; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes noteIn {
  from { opacity: 0; transform: rotate(var(--tilt, 0deg)) scale(0.6); }
  to   { opacity: 1; transform: rotate(var(--tilt, 0deg)); }
}
@keyframes noteOut {
  to { opacity: 0; transform: rotate(var(--tilt, 0deg)) scale(0.6); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .polaroid { transform: rotate(-3deg); }
}
