/* Date minigame (date.js). Everything is scoped under .nd. */
.nd { position: absolute; inset: 0; overflow: hidden; font-family: Nunito, system-ui, sans-serif; color: #fff; background: #120a1a;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; container-type: size; animation: ndIn .35s ease-out; }
.nd.out { animation: ndOut .26s ease-in forwards; }
.nd.shake { animation: ndShake .45s; }
.nd-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nd :where(button) { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* top-left bar (the lead's HUD lives top-right) */
.nd-top { position: absolute; top: calc(env(safe-area-inset-top) + 8px); left: 8px; z-index: 6; display: flex; gap: 6px; align-items: center; }
.nd-pill { background: #000a; backdrop-filter: blur(6px); border: 1px solid #ffffff22; border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.nd-count { min-width: 46px; text-align: center; }
.nd-count.bump { animation: ndBump .5s; }
.nd-round { width: 30px; height: 30px; border-radius: 999px; border: 1px solid #ffffff22; background: #000a; color: #fff; font-size: 13px; padding: 0; }
.nd-hint { position: absolute; top: calc(env(safe-area-inset-top) + 46px); left: 10px; z-index: 5; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .5s; background: #0008; padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.nd-hint.show { opacity: .8; }
@media (hover: none) { .nd-hint { display: none; } }

/* narration (arrival: the reality check) */
.nd-narr { position: absolute; left: 16px; right: 16px; top: calc(env(safe-area-inset-top) + 76px); z-index: 4; padding: 12px 16px; border-radius: 14px;
  background: #1a0d24e6; border: 1px solid #ffffff1f; border-left: 4px solid #ff4fa3; box-shadow: 0 10px 30px #0008;
  font-style: italic; font-weight: 700; font-size: clamp(14px, 4.2cqw, 18px); line-height: 1.35; min-height: 3.1em;
  opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; pointer-events: none; }
.nd-narr.show { opacity: 1; transform: none; }

/* his speech bubble, above his head */
.nd-say { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 68px); z-index: 4; width: max-content; max-width: min(calc(100% - 28px), 420px);
  background: #fff; color: #2a1433; border-radius: 20px; padding: 8px 15px 11px; box-shadow: 0 8px 0 #0002, 0 14px 30px #0007;
  transform: translateX(-50%) scale(.9); opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; }
.nd-say.show { opacity: 1; transform: translateX(-50%) scale(1); }
.nd-say.pop.show { animation: ndPop .28s ease-out; }
.nd-say::after { content: ''; position: absolute; left: 50%; bottom: -11px; margin-left: -10px; border: 11px solid transparent; border-bottom: 0; border-top-color: #fff; }
.nd-who { font-size: 12px; font-weight: 900; color: #c2187a; text-transform: uppercase; letter-spacing: .5px; }
.nd-text { font-weight: 800; font-size: clamp(15px, 4.5cqw, 20px); line-height: 1.3; min-height: 1.3em; }

/* the heroine: thought cloud and spoken bubble, above her head (bottom-left) */
.nd-think, .nd-mine { position: absolute; left: 12px; z-index: 4; max-width: min(66%, 320px); padding: 9px 14px; border-radius: 18px;
  font-weight: 800; font-size: clamp(14px, 4cqw, 17px); line-height: 1.3; opacity: 0; transform: translateY(8px) scale(.95); transform-origin: 20% 100%;
  transition: opacity .2s, transform .2s; pointer-events: none; }
.nd-think { background: #f3eaffee; color: #3a2350; font-style: italic; box-shadow: 0 8px 22px #0007; }
.nd-think::before, .nd-think::after { content: ''; position: absolute; background: #f3eaffee; border-radius: 50%; }
.nd-think::before { width: 14px; height: 14px; left: 34px; bottom: -12px; }
.nd-think::after { width: 8px; height: 8px; left: 28px; bottom: -22px; }
.nd-mine { background: linear-gradient(90deg, #ff4fa3, #a93cff); color: #fff; box-shadow: 0 6px 0 #5a1c8a, 0 12px 24px #0008; }
.nd-mine::after { content: ''; position: absolute; left: 30px; bottom: -10px; border: 10px solid transparent; border-bottom: 0; border-top-color: #e04aae; }
.nd-think.show, .nd-mine.show { opacity: 1; transform: none; }
.nd-mine.show + .nd-cameo { z-index: 3; }

/* the ex cameo popup */
.nd-cameo { position: absolute; right: 10px; z-index: 4; display: flex; gap: 8px; align-items: center; max-width: min(58%, 280px);
  background: #120a1ae6; border: 1px solid #ffd54f99; border-radius: 14px; padding: 6px 10px 6px 6px; box-shadow: 0 10px 26px #0009;
  font-size: 13px; font-weight: 800; line-height: 1.25; opacity: 0; transform: translateX(30px); transition: opacity .3s, transform .3s; pointer-events: none; }
.nd-cameo.show { opacity: 1; transform: none; }
.nd-cameo-av { width: 44px; height: 44px; border-radius: 50%; background: #ffd54f33; flex: none; }
.nd-cameo-t::before { content: '👀 '; }

/* reply options */
.nd-replies { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 5; display: none; flex-direction: column; gap: 8px; }
.nd-replies.show { display: flex; }
.nd-opt { position: relative; text-align: left; border: 0; border-radius: 16px; padding: 11px 14px 11px 46px; background: #fff; color: #2a1433;
  font-weight: 800; font-size: clamp(14px, 4cqw, 17px); line-height: 1.25; box-shadow: 0 5px 0 #c9b6d8, 0 10px 22px #0008; animation: ndUp .3s ease-out backwards; }
.nd-opt:hover { background: #ffeaf6; }
.nd-opt:active { transform: translateY(3px); box-shadow: 0 2px 0 #c9b6d8; }
.nd-k { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #2a1433; color: #fff; font-size: 13px; font-weight: 900; }

/* the big flag button */
.nd-flag { position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 18px); z-index: 5; width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid #fff; background: radial-gradient(circle at 35% 30%, #ff7a7a, #e0193a 55%, #a30d27); color: #fff; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  box-shadow: 0 6px 0 #6e0717, 0 12px 26px #000a; transition: opacity .2s, transform .2s, filter .2s; touch-action: none; }
.nd-flag:active { transform: translateY(4px); box-shadow: 0 2px 0 #6e0717, 0 6px 14px #000a; }
.nd-flag-e { font-size: 32px; line-height: 1; }
.nd-flag-l { font-size: 14px; font-weight: 1000; letter-spacing: .2px; text-shadow: 0 1px 0 #6e0717; }
.nd-key { position: absolute; right: -6px; top: 4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #a30d27; border: 2px solid #a30d27; font-size: 12px; font-weight: 900; }
@media (hover: none) { .nd-flag .nd-key { display: none; } }
.nd-flag.off { filter: grayscale(.7) brightness(.8); opacity: .6; }
.nd-flag.hide { opacity: 0; transform: scale(.5); pointer-events: none; }
.nd-flag.hit { animation: ndHit .45s; }
.nd-flag.miss { animation: ndWobble .45s; }
.nd-flag.nope { animation: ndWobble .3s; }

/* end choice */
.nd-end { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px); z-index: 6; display: none; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 22px; background: #1a0d24ee; border: 1px solid #ffffff26; box-shadow: 0 16px 40px #000c; animation: ndUp .35s ease-out; }
.nd-end.show { display: flex; }
.nd-end-t { font-size: clamp(20px, 6cqw, 26px); font-weight: 1000; text-align: center; }
.nd-end-s { font-size: 14px; font-weight: 700; text-align: center; opacity: .8; }
.nd-end-b { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.nd-yes, .nd-no { position: relative; border: 0; border-radius: 999px; padding: 14px 20px 14px 44px; font-weight: 900; font-size: 18px; color: #fff; }
.nd-yes { background: linear-gradient(90deg, #ff4fa3, #8a3cff); box-shadow: 0 6px 0 #5a1c8a, 0 12px 24px #0008; }
.nd-no { background: #ffffff14; border: 1px solid #ffffff33; }
.nd-yes .nd-k { background: #fff; color: #8a3cff; }
.nd-no .nd-k { background: #ffffff33; }
.nd-yes:active, .nd-no:active { transform: translateY(3px); }

/* floating emojis */
.nd-fx { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
.nd-fx span { position: absolute; font-size: 30px; transform: translate(-50%, -50%); animation: ndFloat 1.5s ease-out backwards; }

/* pause */
.nd-pausebox { position: absolute; inset: 0; z-index: 10; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: #0d0614b3; backdrop-filter: blur(4px); text-align: center; padding: 20px; }
.nd-pausebox.show { display: flex; }
.nd-pause-t { font-size: 34px; font-weight: 1000; }
.nd-pause-s { font-weight: 700; opacity: .8; max-width: 280px; }
.nd-btn { border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 900; font-size: 18px; color: #fff; background: linear-gradient(90deg, #ff4fa3, #8a3cff); box-shadow: 0 6px 0 #5a1c8a, 0 12px 24px #0008; }

@keyframes ndIn { from { opacity: 0; } }
@keyframes ndOut { to { opacity: 0; } }
@keyframes ndPop { 0% { transform: translateX(-50%) scale(.85); } 60% { transform: translateX(-50%) scale(1.04); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes ndUp { from { opacity: 0; transform: translateY(16px); } }
@keyframes ndBump { 30% { transform: scale(1.35); background: #e0193a; } }
@keyframes ndHit { 30% { transform: scale(1.15) rotate(-6deg); } 60% { transform: scale(.96) rotate(3deg); } }
@keyframes ndWobble { 20% { transform: translateX(-6px) rotate(-4deg); } 40% { transform: translateX(6px) rotate(4deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes ndShake { 15% { transform: translate(-7px, 3px); } 30% { transform: translate(6px, -4px); } 45% { transform: translate(-5px, -2px); } 60% { transform: translate(4px, 3px); } 80% { transform: translate(-2px, 1px); } }
@keyframes ndFloat { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -260%) scale(.9) rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .nd.shake { animation: none; } }
