:root {
  color-scheme: dark;
  --bg: #160e12;
  --panel: rgba(33, 21, 27, 0.92);
  --panel-solid: #21151b;
  --text: #fff7f8;
  --muted: #e6cbd2;
  --accent: #f7c5d6;
  --button: rgba(255, 247, 248, 0.15);
  --button-border: rgba(255, 247, 248, 0.26);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { position: fixed; inset: 0; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; }

.app { position: fixed; inset: 0; width: 100vw; height: 100dvh; overflow: hidden; background: radial-gradient(circle at top, #35202a 0, #160e12 54%, #0b0709 100%); }
.stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: grab; }
.stage:active { cursor: grabbing; }
.zoom-layer { display: grid; place-items: center; width: 100%; height: 100%; transform-origin: center center; will-change: transform; }
#pageImage { max-width: 100%; max-height: 100%; object-fit: contain; display: block; pointer-events: none; box-shadow: 0 14px 46px rgba(0, 0, 0, 0.5); border-radius: 10px; background: #fbf7ef; }
.app.photo-mode #pageImage { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.app.recipe-mode #pageImage { border-radius: 8px; }

.topbar, .bottombar { position: absolute; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); pointer-events: none; }
.topbar { top: 0; padding-top: max(10px, env(safe-area-inset-top)); justify-content: space-between; }
.bottombar { bottom: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); justify-content: center; }
.topbar > *, .bottombar > * { pointer-events: auto; }
.meta { min-width: 0; max-width: calc(100vw - 170px); padding: 8px 12px; border: 1px solid rgba(255,255,255,.13); background: rgba(15, 9, 12, 0.47); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-radius: 999px; text-align: center; box-shadow: var(--shadow); }
.counter { font-size: 12px; line-height: 1.1; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; line-height: 1.2; }
.icon-button, .nav-button, .primary-button, .plain-button, .wide-button { border: 1px solid var(--button-border); background: var(--button); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-radius: 999px; min-height: 44px; padding: 0 14px; box-shadow: var(--shadow); }
.icon-button { width: 54px; font-size: 13px; }
.icon-button.back { width: 64px; }
.primary-button { min-width: 128px; padding: 0 20px; font-weight: 750; background: rgba(246, 179, 203, 0.28); }
.nav-button { min-width: 66px; color: var(--muted); }
button:active { transform: scale(0.985); }
button:disabled { opacity: .45; }
.hidden { display: none !important; }

.menu-panel { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); background: rgba(0,0,0,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.panel-card { width: min(560px, 100%); background: var(--panel); color: var(--text); border: 1px solid rgba(255,255,255,.18); border-radius: 24px; padding: 18px; box-shadow: var(--shadow); }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 8px; }
.plain-button { min-height: 36px; padding: 0 12px; box-shadow: none; }
.muted { color: var(--muted); line-height: 1.45; margin: 8px 0 16px; }
.wide-button { width: 100%; margin-top: 10px; min-height: 48px; font-weight: 700; background: rgba(246, 179, 203, 0.25); }
.wide-button.secondary { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.status { min-height: 22px; margin-top: 12px; color: var(--accent); font-size: 14px; }
.toast { position: absolute; z-index: 30; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(360px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 999px; background: rgba(20, 12, 16, .85); border: 1px solid rgba(255,255,255,.18); color: var(--text); box-shadow: var(--shadow); text-align: center; }

@media (min-width: 720px) {
  .meta { max-width: 520px; }
  .title { font-size: 15px; }
}
