* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2a3a3a;
  font-family: "Segoe UI", system-ui, sans-serif;
}

#wrap {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e2a2a;
}

#game {
  display: block;
  background: #F5E6C8;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  max-width: 420px;
  max-height: 100vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  cursor: grab;
}

#game:active {
  cursor: grabbing;
}

#hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, calc(100vh * 9 / 16), 420px);
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  row-gap: 2px;
  pointer-events: none;
  color: #3d5a5a;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(245, 230, 200, 0.8);
  z-index: 2;
}

#score {
  font-size: 22px;
  letter-spacing: 0.02em;
}

#hiscore {
  font-size: 13px;
  opacity: 0.85;
}

#coin-wrap {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8a6a18;
  opacity: 0.95;
  margin: 0 8px;
}

#coin-glyph {
  color: #c9a227;
  font-size: 13px;
}


#vitals {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #c45a5a;
  opacity: 0.95;
  margin: 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#health.hearts,
#health {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #d45a5a;
  text-shadow: none;
  line-height: 0;
}

#health .hud-heart {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  flex-shrink: 0;
}

#lives {
  color: #3d6b6b;
  letter-spacing: 0.08em;
  font-size: 12px;
}

#lives-sep {
  color: #8a9e9e;
  opacity: 0.7;
  font-weight: 600;
}


#mode-bar {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: min(100vw, calc(100vh * 9 / 16), 420px);
  display: flex;
  justify-content: center;
  padding: 0 12px;
}

#mode-btn {
  appearance: none;
  border: 2px solid #5a9e9e;
  background: rgba(245, 230, 200, 0.92);
  color: #2f5555;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

#mode-btn[aria-pressed="true"] {
  background: #5a9e9e;
  color: #F5E6C8;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 70, 70, 0.45);
  z-index: 4;
  padding: 20px;
}

#overlay.hidden {
  display: none;
}

#overlay-card {
  background: #F5E6C8;
  color: #2f4a4a;
  border-radius: 18px;
  padding: 28px 24px;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  border: 3px solid #7eb8b8;
}

#overlay-card h1 {
  font-size: 26px;
  margin-bottom: 10px;
  color: #3d6b6b;
}

#overlay-card p {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 18px;
  opacity: 0.92;
}

#start-btn, #mode-btn, #overlay {
  touch-action: manipulation;
}

#start-btn {
  appearance: none;
  border: none;
  background: #e07a6a;
  color: #fff8f0;
  font-weight: 800;
  font-size: 16px;
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b85a4e;
}

#start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b85a4e;
}

#proto-version {
  flex: 1 0 100%;
  order: 3;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0.72;
  color: #3d5a5a;
  text-shadow: 0 1px 0 rgba(245, 230, 200, 0.8);
}

#overlay-version {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.65;
  color: #3d5a5a;
}


/* --- v0.8.0 Marketing / stamps / share --- */
#stamp-progress {
  flex: 1 0 100%;
  order: 2;
  margin-top: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  color: #3D5A5C;
  opacity: 0.88;
}

#proto-version {
  order: 4;
}

#overlay-card {
  max-width: 320px;
  padding: 22px 18px 24px;
}

#share-card {
  margin: 0 auto 12px;
  padding: 0;
  background: transparent;
  border: none;
  color: #3D5A5C;
  text-align: center;
}

#share-card .share-pc {
  position: relative;
  margin: 0 auto;
  padding: 14px 16px 16px;
  max-width: 280px;
  background: #F5E6C8;
  border: 3px solid #B47830;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #E8C460;
  overflow: hidden;
}

#share-card .share-pc-stamp {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 48px;
  height: 48px;
  background: #EDE4D4;
  border: 2px dashed #B47830;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}

#share-card .share-pc-stamp img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 36px;
  height: 36px;
}

#share-card .share-postmark {
  position: absolute;
  bottom: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 2px solid #E07A6A;
  border-radius: 50%;
  color: #E07A6A;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transform: rotate(-12deg);
}

#share-card.hidden {
  display: none;
}

#share-card .share-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7BA8A0;
  margin-bottom: 4px;
}

#share-card .share-meters {
  font-size: 28px;
  font-weight: 800;
  color: #3D5A5C;
  line-height: 1.1;
}

#share-card .share-meta {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.85;
}

#share-card .share-stamps {
  font-size: 12px;
  margin-top: 6px;
  color: #C9A227;
  font-weight: 700;
}

#stamp-atlas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 12px;
}

#stamp-atlas.hidden {
  display: none;
}

.stamp-slot {
  background: #EDE4D4;
  border: 2px solid #D4C4A8;
  border-radius: 8px;
  padding: 6px 2px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.stamp-slot.unlocked {
  border-color: #E8C460;
  background: #F5E6C8;
}

.stamp-slot.fresh {
  box-shadow: 0 0 0 2px #E07A6A;
}

.stamp-slot.locked {
  opacity: 0.45;
}

.stamp-badge {
  font-size: 14px;
  line-height: 1;
  color: #C9A227;
}

.stamp-slot.locked .stamp-badge {
  color: #7BA8A0;
}

.stamp-label {
  font-size: 10px;
  font-weight: 700;
  color: #3D5A5C;
}

.daily-line {
  font-size: 12px !important;
  margin-bottom: 12px !important;
  color: #3D5A5C;
  opacity: 0.9;
}

#overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

#share-btn {
  appearance: none;
  border: 2px solid #7BA8A0;
  background: #F5E6C8;
  color: #3D5A5C;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}

#share-btn.hidden {
  display: none;
}

#share-btn:active {
  transform: translateY(1px);
}


/* --- v0.8.3 Milestone freeze postcard (Shiela) --- */
#milestone-card {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(61, 90, 92, 0.38);
  pointer-events: auto;
  cursor: pointer;
}

#milestone-card.hidden {
  display: none;
}

#milestone-card .pc-board {
  width: min(92vw, 300px);
  pointer-events: none;
}

#milestone-card .pc-rim {
  position: relative;
  background: #F5E6C8;
  border: 3px solid #B47830;
  border-radius: 3px;
  padding: 14px 14px 16px;
  box-shadow: inset 0 0 0 2px #E8C460;
  overflow: hidden;
}

/* Thin UL gold_highlight on rim corners only — no drop shadow / neon */
#milestone-card .pc-ul-hi {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-top: 3px solid #FFF8DC;
  border-left: 3px solid #FFF8DC;
  pointer-events: none;
  opacity: 0.95;
}

#milestone-card .pc-stamp-inset {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 72px;
  height: 84px;
  background: #EDE4D4;
  border: 2px solid #3D5A5C;
  border-radius: 2px;
  overflow: hidden;
}

/* Perforated postage motif */
#milestone-card .pc-stamp-perf {
  position: absolute;
  inset: -2px;
  border: 2px dashed #B47830;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.9;
}

#milestone-card .pc-cavern {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: linear-gradient(180deg, transparent 0%, #7BA8A0 55%, #3D5A5C 100%);
  opacity: 0.85;
}

#milestone-card .pc-hero {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 1;
  image-rendering: pixelated;
}

#milestone-card .pc-hero img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

#milestone-card .pc-body {
  position: relative;
  padding-right: 84px;
  text-align: left;
  color: #3D5A5C;
  min-height: 110px;
}

#milestone-card .pc-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7BA8A0;
  margin-bottom: 4px;
}

#milestone-card .pc-title {
  font-size: 18px;
  font-weight: 800;
  color: #3D5A5C;
  line-height: 1.15;
  margin-bottom: 6px;
}

#milestone-card .pc-meters {
  font-size: 32px;
  font-weight: 800;
  color: #3D5A5C;
  line-height: 1;
}

#milestone-card .pc-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #7BA8A0;
  font-weight: 700;
}

#milestone-card .pc-postmark {
  position: absolute;
  left: 8px;
  bottom: 28px;
  width: 40px;
  height: 40px;
  border: 2px solid #E07A6A;
  border-radius: 50%;
  color: #E07A6A;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transform: rotate(-18deg);
}

#milestone-card .pc-hint {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #B47830;
  opacity: 0.9;
}
