:root {
  --bg: #23170f;
  --bg-deeper: #160f0a;
  --sand: #ead8bf;
  --sand-soft: rgba(234, 216, 191, 0.76);
  --sand-faint: rgba(234, 216, 191, 0.18);
  --accent: #9b6b42;
  --accent-soft: rgba(155, 107, 66, 0.30);
  --shadow: rgba(0,0,0,0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--sand);
  font-family: "Inter", system-ui, sans-serif;
}
body { overflow: hidden; }
.app { position: relative; width: 100vw; height: 100vh; height: 100dvh; background: radial-gradient(circle at top, #402a1a, #2b1c12 40%, var(--bg-deeper) 72%, #0c0907 100%); }
#video, #captureCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #090705;
}
.grain {
  position: absolute; inset: 0; pointer-events: none; opacity: .12;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.08) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 40%, rgba(255,255,255,.05) 0 1px, transparent 1px),
    radial-gradient(circle at 50% 80%, rgba(255,255,255,.04) 0 1px, transparent 1px);
  background-size: 13px 13px, 17px 17px, 19px 19px;
  mix-blend-mode: soft-light;
}
.camera-guide {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(90px, env(safe-area-inset-top)) 24px max(110px, calc(env(safe-area-inset-bottom) + 88px));
}
.guide-frame {
  position: relative; width: min(78vw, 360px); aspect-ratio: 0.82 / 1;
  border: 1.5px solid rgba(234, 216, 191, 0.34);
  border-radius: 34px;
  box-shadow: 0 0 0 1px rgba(155,107,66,0.12) inset, 0 0 36px rgba(0,0,0,0.16);
  background: linear-gradient(180deg, rgba(35,23,15,0.05), rgba(35,23,15,0.01));
}
.guide-frame::before, .guide-frame::after {
  content: ""; position: absolute; inset: 14px; border-radius: 24px;
}
.guide-frame::before { border: 1px solid rgba(234, 216, 191, 0.12); }
.guide-frame::after {
  inset: auto; width: 36px; height: 36px; right: 14px; bottom: 14px;
  border-right: 2px solid rgba(234, 216, 191, 0.42);
  border-bottom: 2px solid rgba(234, 216, 191, 0.42);
  border-radius: 0 0 16px 0;
}
.guide-copy {
  margin-top: 12px; font-size: .8rem; letter-spacing: .06em; text-transform: lowercase;
  color: rgba(234, 216, 191, 0.72); text-shadow: 0 2px 12px rgba(0,0,0,.45);
}
.topbar, .bottombar, .overlay { position: absolute; inset: 0; }
.topbar {
  z-index: 7; display: flex; justify-content: space-between; align-items: center;
  padding: max(18px, calc(env(safe-area-inset-top) + 8px)) 18px 0 18px; height: 76px; pointer-events: none;
}
.brand {
  font-family: "Cormorant Garamond", serif; font-size: 1.45rem; letter-spacing: .12em;
  color: var(--sand); text-shadow: 0 2px 18px rgba(0,0,0,.55);
}
.icon-btn, .text-btn, .ghost-btn, .primary-btn {
  appearance: none; border: none; background: transparent; color: var(--sand); cursor: pointer;
}
.icon-btn {
  pointer-events: auto; width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--sand-faint); background: rgba(30, 20, 13, 0.50); backdrop-filter: blur(8px);
  font-size: 1rem; box-shadow: 0 8px 20px var(--shadow);
}
.overlay { z-index: 5; }
.stage { position: absolute; inset: 0; display: none; }
.stage.active { display: block; }
.prompt-wrap {
  position: absolute; inset-inline: 0; top: 11vh; display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 0 24px; text-align: center; pointer-events: none; z-index: 6;
}
.prompt {
  max-width: 20rem; font-family: "Cormorant Garamond", serif; font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.05; text-shadow: 0 2px 16px rgba(0,0,0,.6);
}
.subprompt {
  font-size: .86rem; color: var(--sand-soft); letter-spacing: .04em; text-transform: lowercase;
}
.full-tap { position: absolute; inset: 0; background: transparent; border: none; }
.center-card, .reading-wrap {
  position: absolute; inset-inline: 20px; bottom: max(32px, calc(env(safe-area-inset-bottom) + 12px));
  background: linear-gradient(180deg, rgba(38,25,17,.58), rgba(18,12,8,.84));
  border: 1px solid rgba(231,214,190,.1); backdrop-filter: blur(14px);
  border-radius: 24px; box-shadow: 0 18px 46px rgba(0,0,0,.38); padding: 22px 20px;
}
.loading, .paywall-line, .coffee-title { font-family: "Cormorant Garamond", serif; }
.loading { font-size: 1.8rem; text-align: center; }
.reading-text {
  min-height: 10.5rem; font-family: "Cormorant Garamond", serif; font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.12; letter-spacing: .01em;
}
.reading-line {
  opacity: 0; transform: translateY(8px); animation: fadeRise .55s forwards;
  margin-bottom: 10px;
}
.reading-actions, .actions { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.ghost-btn, .primary-btn, .text-btn {
  padding: 10px 14px; border-radius: 999px; font-size: .92rem; letter-spacing: .04em; text-decoration: none;
}
.ghost-btn, .text-btn { color: var(--sand); border: 1px solid rgba(234,216,191,.14); background: rgba(155,107,66,.10); }
.primary-btn { color: #221811; background: var(--sand); }
.paywall-card, .coffee-card { text-align: center; }
.paywall-line { font-size: 1.85rem; line-height: 1.02; margin-bottom: 18px; }
.coffee-title { font-size: 2rem; margin-bottom: 8px; letter-spacing: .08em; }
.coffee-copy { color: var(--sand-soft); margin-bottom: 18px; }
.bottombar {
  z-index: 7; display: flex; justify-content: center; align-items: end;
  padding: 0 18px max(24px, calc(env(safe-area-inset-bottom) + 18px));
  pointer-events: none;
}
.text-btn { pointer-events: auto; position: relative; z-index: 8; min-width: 148px; }
.hidden { display: none !important; }
@keyframes fadeRise { to { opacity: 1; transform: translateY(0); } }
@media (min-width: 768px) {
  .center-card, .reading-wrap { left: 50%; transform: translateX(-50%); max-width: 540px; }
}
@media (max-width: 480px) {
  .brand { font-size: 1.3rem; }
  .prompt { max-width: 18rem; font-size: clamp(1.55rem, 7vw, 1.95rem); }
  .reading-text { min-height: 9.5rem; font-size: clamp(1.4rem, 6.2vw, 1.85rem); }
  .guide-frame { width: min(80vw, 330px); }
  .bottombar { padding-bottom: max(30px, calc(env(safe-area-inset-bottom) + 28px)); }
  .text-btn { font-size: .88rem; }
}
.ui-hidden { opacity: 0; pointer-events: none !important; transition: opacity .22s ease; }
.camera-guide, .bottombar, .topbar { transition: opacity .22s ease; }
.paywall-subline {
  margin-top: 10px; margin-bottom: 18px; font-size: 14px; line-height: 1.4;
  color: rgba(232, 214, 188, 0.78); letter-spacing: 0.05em;
}

.nohand-card { text-align: center; }

.app.mode-coffee .guide-frame { aspect-ratio: 1 / 1; width: min(72vw, 340px); border-radius: 999px; }
.app.mode-coffee .guide-frame::before { border-radius: 999px; inset: 16px; }
.app.mode-coffee .guide-frame::after { width: 32px; height: 32px; right: 26px; bottom: 26px; border-radius: 0 0 18px 0; }
.app.mode-coffee .brand { letter-spacing: .16em; }

.share-hint {
  margin-top: 14px;
  text-align: center;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: lowercase;
  color: rgba(232, 214, 188, 0.68);
  cursor: pointer;
  user-select: none;
}
.share-hint:hover, .share-hint:focus { color: rgba(232, 214, 188, 0.92); outline: none; }
.toast {
  position: absolute; left: 50%; bottom: max(90px, calc(env(safe-area-inset-bottom) + 78px));
  transform: translateX(-50%) translateY(8px); z-index: 10;
  padding: 10px 14px; border-radius: 999px; pointer-events: none;
  background: rgba(24, 16, 11, 0.78); border: 1px solid rgba(234,216,191,.14);
  color: rgba(234,216,191,.94); font-size: .84rem; letter-spacing: .04em;
  opacity: 0; transition: opacity .25s ease, transform .25s ease; backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.toast.active { opacity: 1; transform: translateX(-50%) translateY(0); }


.map-link {
  margin-top: 18px;
  font-size: 14px;
  opacity: 0.68;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
  display: none;
  user-select: none;
}

.map-link.visible {
  display: block;
}

.map-link:hover,
.map-link:focus {
  opacity: 1;
  outline: none;
}
