@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f5f0e8;
  font-family: 'Inter', system-ui, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
.m-br, .reveal-hint, .zonk-hint {
  display: none;
}
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

/* ── Setup ── */
#s-setup {
  background: #f5f0e8;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.setup-footer {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.35);
  text-align: center;
  white-space: nowrap;
  z-index: 12;
}

@media (max-width: 768px), (max-height: 500px) {
  .setup-footer {
    bottom: 16px;
  }
}

.setup-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 80px;
  width: 100%;
  max-width: 900px;
  position: relative;
  z-index: 10;
  margin-bottom: 40px;
}

@media (max-width: 768px), (max-height: 500px) {
  #s-setup {
    justify-content: flex-start;
  }

  .setup-content {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
  }

  .setup-footer {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: 40px auto 24px;
    text-align: center;
    width: 100%;
  }

  .setup-left {
    display: contents;
  }

  .landing-title {
    order: 1;
    margin-bottom: 8px !important;
  }

  .guide-list {
    order: 2;
  }

  .setup-right {
    order: 3;
    width: 100%;
    align-items: center;
  }

  .landing-bg {
    order: 4;
  }

  .reveal-scene {
    transform: scale(0.6);
  }

  .m-br {
    display: block;
  }

  #s-result {
    justify-content: flex-start;
  }

  .reveal-stage {
    margin-top: auto;
    margin-bottom: auto;
  }

  .summary-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 16px;
  }

  .summary-row > div {
    justify-content: space-between !important;
    width: 100%;
  }
}

/* Landscape mobile fixes */
@media (max-height: 500px) {
  .reveal-stage {
    margin-top: 40px;
    margin-bottom: auto;
  }

  .reveal-hint {
    display: flex;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.35);
    margin-top: 16px;
    margin-bottom: 8px;
    animation: hblink 2.5s ease-in-out infinite;
    order: 1;
  }

  .reveal-scene {
    order: 2;
    transform: scale(1); /* prevent overflow, fit nice */
  }

  .reveal-header {
    display: none;
  }

  .next-btn {
    order: 3;
    margin-top: 8px; 
  }

  .zonk-layout .next-btn {
    display: none !important;
  }

  .zonk-layout .zonk-hint {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 16px;
    animation: hblink 2.5s ease-in-out infinite;
  }
}

.setup-left {
  flex: 1;
  max-width: 440px;
}

.landing-title {
  font-size: 56px;
  font-weight: 800;
  color: #1a1a1a;
  letter-spacing: -2px;
  margin-bottom: 20px;
}

@media (max-width: 768px), (max-height: 500px) {
  .landing-title {
    font-size: 40px;
    text-align: center;
  }
  .guide-list {
    max-width: 320px;
    margin: 0 auto;
  }
}

.guide-list {
  list-style: none;
  padding: 0;
  counter-reset: guide-counter;
}

.guide-list li {
  font-size: 16px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.7);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.guide-list li::before {
  counter-increment: guide-counter;
  content: counter(guide-counter) ".";
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  min-width: 18px;
}

.setup-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

.landing-bg {
  width: 130%;
  max-width: none;
  height: auto;
  margin-top: 24px;
  margin-left: -15%;
  pointer-events: none;
  display: block;
}

@media (max-width: 768px), (max-height: 500px) {
  .landing-bg {
    width: 100%;
    margin-top: 16px;
    margin-left: 0;
  }
}

.setup-panel {
  width: 100%;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.panel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.3);
  margin-bottom: 14px;
}

.drow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dleft .dname {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
}

.dleft .dsub {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.35);
  margin-top: 2px;
}

.dright {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 100px;
  padding: 3px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
}

.dbtn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.dbtn.p {
  background: #1a1a1a;
  color: #fff;
}

.dbtn:active {
  transform: scale(0.9);
}

.dval {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  width: 40px;
  text-align: center;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}

.dval::-webkit-outer-spin-button,
.dval::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.dval[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  margin-top: 8px;
}

.summary-row .sl {
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.4);
}

.summary-row .sv {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a1a;
}

.start-btn {
  width: 100%;
  max-width: 400px;
  padding: 17px;
  background: #1a1a1a;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.12s;
}

.start-btn:active {
  transform: scale(0.98);
}

.start-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ── Game ── */
#s-game {
  overflow: hidden;
  position: fixed;
  inset: 0;
  display: none;
  background: #f5f0e8;
}

#s-game.active {
  display: block;
}

.game-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.pool-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 100px;
  padding: 4px 10px 4px 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chip-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chip .cn {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
}

.chip.zero {
  opacity: 0.2;
}

.setup-link, .note-link {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.5);
}

.setup-link:active, .note-link:active {
  background: #f0f0f0;
}

#canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hint {
  position: absolute;
  bottom: 32px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.35);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  animation: hblink 2.5s ease-in-out infinite;
  z-index: 5;
}

@keyframes hblink {

  0%,
  100% {
    opacity: .3
  }

  50% {
    opacity: .8
  }
}

.env {
  position: absolute;
  cursor: pointer;
  z-index: 10;
}

.env img {
  width: 100%;
  height: 100%;
  display: block;
}

.env:active {
  transform: scale(0.9) !important;
}

/* ── Reveal Overlay ── */
#s-result {
  background: #fff;
  align-items: center;
  justify-content: center;
  z-index: 100;
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 24px 20px;
}

#s-result.active {
  display: flex;
}

/* Only the stage content captures taps */
.reveal-stage {
  pointer-events: all;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: stageFadeIn 0.2s ease both;
}

/* Header Text */
.reveal-header {
  text-align: center;
  margin-bottom: 44px;
}

.reveal-title {
  font-size: 40px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.reveal-body {
  font-size: 18px;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1.5;
}

@keyframes stageFadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

/* Scene container */
.reveal-scene {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  height: 340px;
  overflow: visible;
  transform: scale(1.25); /* Scale to make it bigger */
}


/* Open envelope — z:1 back */
.reveal-envelope {
  position: absolute;
  width: 320px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  animation: envIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.reveal-envelope img {
  width: 100%;
  display: block;
}

@keyframes envIn {
  from {
    transform: translate(-50%, calc(-50% + 30px));
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* Postcard — z:3, in front of money */
.reveal-postcard {
  position: absolute;
  width: 120px;
  left: 20px;
  bottom: 0;
  top: auto;
  /* override previous top */
  z-index: 3;
  rotate: -12deg;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  animation: sideIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.1s both;
}

@keyframes sideIn {
  from {
    transform: translateY(50px) scale(0.8);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Money — z:2, slides up from envelope */
.reveal-money-container {
  position: absolute;
  top: 0;
  bottom: 130px; /* Clips below envelope front lip boundary */
  left: 0;
  right: 0;
  overflow: hidden;
  z-index: 2;
}

.reveal-money {
  position: absolute;
  width: 280px;
  left: 50%;
  top: 50px;
  transform: translateX(-50%);
  rotate: -2deg;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  animation: moneyUp 0.6s cubic-bezier(0.34, 1.35, 0.64, 1) 0.18s both;
}

@keyframes moneyUp {
  from {
    transform: translateX(-50%) translateY(60px);
    opacity: 0;
  }

  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}


/* Sticker — z:4, on top of money */
.reveal-sticker {
  position: absolute;
  max-height: 72px;
  /* expect 72px max height */
  height: 72px;
  width: auto;
  right: 72px;
  bottom: 130px;
  /* Adjusted to float above nastar */
  z-index: 4;
  rotate: 6deg;
  animation: stickerPop 0.45s cubic-bezier(0.34, 1.6, 0.64, 1) 0.32s both;
}

@keyframes stickerPop {
  from {
    transform: scale(0) rotate(20deg);
    opacity: 0;
  }

  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Nastar — z:5, front right */
.reveal-nastar {
  position: absolute;
  width: 200px;
  right: 40px;
  bottom: 0;
  z-index: 5;
  animation: nastarIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.4s both;
}

@keyframes nastarIn {
  from {
    transform: translateY(30px) scale(0.8);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Amount text — below scene, no card */
.reveal-amount-area {
  text-align: center;
  padding: 28px 0 0;
}

.reveal-amount-area .lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 8px;
}

.reveal-amount-area .amt {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}

.reveal-amount-area .sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 28px;
}

.next-btn {
  width: auto;
  padding: 14px 40px;
  background: #1a1a1a;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.12s, transform 0.12s;
  margin-top: 80px;
  z-index: 10;
}

.next-btn:active {
  transform: scale(0.98);
  opacity: 0.85;
}

/* ── Empty ── */
#s-empty {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  position: fixed;
  inset: 0;
  display: none;
}

#s-empty.active {
  display: flex;
}

.empty-card {
  background: #fff;
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  width: 300px;
  animation: pop 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.empty-icon-area {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #f5f5f5;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-card h2 {
  font-size: 20px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.empty-card p {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 24px;
  line-height: 1.6;
}

.reset-btn {
  width: 100%;
  padding: 14px;
  background: #1a1a1a;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.reset-btn:active {
  opacity: 0.8;
}

@keyframes pop {
  from {
    transform: scale(0.8) translateY(16px);
    opacity: 0
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1
  }
}

/* ── Confetti ── */
.cc {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 2px;
  animation: ccfall linear forwards;
}

@keyframes ccfall {
  0% {
    opacity: 1
  }

  100% {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0
  }
}

/* ── Icons ── */
.dbtn svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.start-btn svg {
  width: 16px;
  height: 16px;
}

.next-btn svg {
  width: 16px;
  height: 16px;
}

.reset-btn svg {
  width: 15px;
  height: 15px;
}

.setup-link svg, .note-link svg {
  width: 15px;
  height: 15px;
  display: block;
}

.hint svg {
  width: 14px;
  height: 14px;
}

.empty-icon-area svg {
  width: 28px;
  height: 28px;
}

.chip-icon svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  width: 320px;
  max-width: 90%;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.5, 0.64, 1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-icon-area {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #FEF3C7;
  color: #D97706;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon-area i {
  width: 28px;
  height: 28px;
}

.modal-card h2 {
  font-size: 20px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-btn.secondary {
  background: #F3F4F6;
  color: #4B5563;
}

.modal-btn.primary {
  background: #1a1a1a;
  color: #fff;
}

.modal-btn:active {
  transform: scale(0.97);
}

/* ── Note Modal Custom Styles ── */
#m-note {
  flex-direction: column;
  background: #F2F1EE !important; /* match screenshot solid background style */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 2000;
}

.note-card {
  width: 520px !important; /* fit nicely */
  max-width: 90%;
  border-radius: 4px;
  overflow: hidden;
  padding: 0 !important;
  text-align: left;
  background: url('../assets/note-bg.webp') center center / cover no-repeat !important; /* USE ASSET */
  display: flex !important;
  flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04); /* soft shadow */
}

.note-sparkle {
  margin-bottom: 24px !important;
}

.note-content-text {
  padding: 48px 48px !important;
  text-align: left !important;
  background: transparent !important;
}

.serif-section {
  margin-bottom: 8px;
}

.serif-section .sf {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 38px !important;
  letter-spacing: -0.6px;
  color: #1a1a1a !important;
  margin-bottom: 0px !important;
  line-height: 1.1 !important;
}

.note-content-text .quote {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: 16px !important;
  color: rgba(0, 0, 0, 0.45) !important;
  margin: 8px 0 32px 0 !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.base-section p {
  font-size: 13px !important;
  color: #1a1a1a;
  font-weight: 500;
  margin-bottom: 4px !important;
  line-height: 1.4;
}

.base-section .footer-note {
  margin-top: 18px !important;
  color: rgba(0, 0, 0, 0.5) !important;
  text-align: left !important;
}

.note-dismiss-hint {
  margin-top: 20px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.35);
  pointer-events: none;
  animation: hblink 2.5s ease-in-out infinite;
}

/* ── Responsive Scaling for small screens ── */
@media (max-width: 395px) {
  .reveal-scene {
    transform: scale(1.15);
  }
  .reveal-nastar {
    width: 150px;
    right: 20px;
  }
  .reveal-postcard {
    bottom: -20px;
  }
}

@media (max-width: 370px) {
  .reveal-scene {
    transform: scale(1.05);
  }
}

@media (max-width: 340px) {
  .reveal-scene {
    transform: scale(0.95);
  }
  .reveal-title {
    font-size: 32px;
  }
}

@media (max-width: 320px) {
  .reveal-scene {
    transform: scale(0.85);
  }
}