:root {
  --app-height: 100vh;
  --bg: #ebdcd3;
  --sand: #d5c586;
  --text: #45372f;
  --muted: rgba(69, 55, 47, 0.72);
  --overlay: rgba(246, 237, 231, 0.8);
  --overlay-strong: rgba(235, 220, 211, 0.92);
  --panel: rgba(255, 249, 244, 0.72);
  --panel-border: rgba(213, 197, 134, 0.42);
  --grid: rgba(213, 197, 134, 0.5);
  --shadow: 0 24px 80px rgba(124, 101, 61, 0.18);
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  --safe-top: max(18px, env(safe-area-inset-top));
  --accent: #d5c586;
  --accent-strong: rgba(213, 197, 134, 0.42);
  --accent-border: rgba(171, 151, 83, 0.72);
  --surface-soft: rgba(255, 251, 247, 0.56);
  --surface-softer: rgba(255, 251, 247, 0.34);
  --surface-border: rgba(213, 197, 134, 0.28);
  --text-on-accent: #4d401f;
  --modal-bg: rgba(243, 231, 224, 0.97);
  --thumb: #fffaf6;
  --thumb-border: rgba(213, 197, 134, 0.95);
  --thumb-shadow: 0 10px 24px rgba(124, 101, 61, 0.22);
  --frame-shadow: 0 24px 70px rgba(83, 61, 37, 0.18);
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: var(--app-height);
  background:
    radial-gradient(circle at top left, rgba(255, 248, 241, 0.92), transparent 34%),
    linear-gradient(180deg, #f4ece6 0%, #ebdcd3 52%, #e1cfb9 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100%;
  height: var(--app-height);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 250, 246, 0.9), transparent 24%),
    radial-gradient(circle at 82% 88%, rgba(213, 197, 134, 0.18), transparent 22%),
    linear-gradient(180deg, #efe3db 0%, #e8d7cc 60%, #dfceb8 100%);
}

.ambient {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.9;
}

.ambient-top {
  top: -10%;
  right: -8%;
  width: min(54vw, 460px);
  height: min(54vw, 460px);
  background: radial-gradient(circle, rgba(255, 251, 247, 0.62), rgba(255, 251, 247, 0) 68%);
}

.ambient-bottom {
  left: -12%;
  bottom: -14%;
  width: min(62vw, 520px);
  height: min(62vw, 520px);
  background: radial-gradient(circle, rgba(213, 197, 134, 0.22), rgba(213, 197, 134, 0) 70%);
}

.top-bar {
  position: absolute;
  top: var(--safe-top);
  left: 0;
  right: 0;
  z-index: 25;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 16px;
}

.brand-mark {
  align-self: center;
  padding: 11px 15px 10px;
  border: 1px solid rgba(255, 248, 241, 0.46);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 249, 244, 0.56), rgba(213, 197, 134, 0.24));
  backdrop-filter: blur(20px);
  box-shadow: 0 14px 34px rgba(83, 61, 37, 0.12);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark-hidden {
  visibility: hidden;
  pointer-events: none;
}

.generated-warning-banner {
  position: absolute;
  top: calc(var(--safe-top) + 86px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  width: min(92vw, 520px);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  color: var(--text);
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}

.generated-warning-banner.hidden {
  display: none;
}

body.generated-single-mode .generated-warning-banner {
  top: calc(var(--safe-top) - 18px);
  width: min(92vw, 360px);
}

.account-badge,
.ghost-button {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.72), rgba(246, 235, 228, 0.7));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.account-badge {
  min-width: 0;
  max-width: min(75vw, 340px);
  padding: 10px 14px;
  border-radius: 16px;
}

.account-badge.hidden,
.ghost-button.hidden {
  display: none;
}

.account-badge-email {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.account-badge-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ghost-button {
  border-radius: 14px;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}

.background-video,
.background-blur {
  position: absolute;
  inset: 0;
}

.background-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
  filter: saturate(0.9) sepia(0.12) contrast(0.96);
}

.background-blur {
  backdrop-filter: blur(28px);
  background:
    linear-gradient(180deg, rgba(244, 235, 228, 0.36), rgba(235, 220, 211, 0.54)),
    radial-gradient(circle at top, rgba(213, 197, 134, 0.14), transparent 44%);
}

.camera-stage {
  position: absolute;
  inset: 0;
  display: flex;
}

.pane {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 20px) 12px calc(var(--safe-bottom) + 88px);
  transition: opacity 0.25s ease, width 0.25s ease, flex-basis 0.25s ease;
}

.pane.hidden {
  opacity: 0;
  pointer-events: none;
  width: 0;
  flex: 0 0 0;
  padding-left: 0;
  padding-right: 0;
}

.pane-right.full {
  flex: 1 1 100%;
}

.camera-frame,
.frame-button {
  position: relative;
  width: min(100%, calc((var(--app-height) - var(--safe-top) - var(--safe-bottom) - 130px) * 0.75));
  aspect-ratio: 3 / 4;
  background:
    linear-gradient(180deg, rgba(255, 249, 244, 0.12), rgba(255, 249, 244, 0.02));
  border: 0;
  border-radius: 34px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--frame-shadow);
}

.camera-frame::before,
.frame-button::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 248, 241, 0.82), rgba(213, 197, 134, 0.48));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
}

.camera-frame::after,
.frame-button::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 250, 246, 0.26);
  pointer-events: none;
  z-index: 3;
}

.frame-button {
  cursor: pointer;
}

.frame-button .camera-frame {
  width: 100%;
  height: 100%;
}

.camera-video,
.generated-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.camera-video {
  object-fit: cover;
  transform-origin: center center;
}

.camera-video.hidden,
.preview-generated-image.hidden {
  display: none;
}

.preview-frame,
#leftPane .frame-button {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transform: translateY(-75px);
}

.generated-image {
  object-fit: cover;
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.42), rgba(235, 220, 211, 0.3));
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.preview-generated-image {
  z-index: 2;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background-image:
    linear-gradient(to right, transparent 33.1%, var(--grid) 33.1%, var(--grid) 33.7%, transparent 33.7%, transparent 66.3%, var(--grid) 66.3%, var(--grid) 66.9%, transparent 66.9%),
    linear-gradient(to bottom, transparent 33.1%, var(--grid) 33.1%, var(--grid) 33.7%, transparent 33.7%, transparent 66.3%, var(--grid) 66.3%, var(--grid) 66.9%, transparent 66.9%);
}

.swipe-coach-mark {
  position: absolute;
  left: 50%;
  bottom: 88px;
  z-index: 4;
  max-width: min(78%, 260px);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 248, 241, 0.42);
  background: rgba(69, 55, 47, 0.72);
  backdrop-filter: blur(12px);
  color: rgba(255, 251, 247, 0.96);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
  pointer-events: none;
  transform: translateX(-50%);
}

.swipe-coach-mark.hidden {
  display: none;
}

.focus-ring {
  position: absolute;
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 248, 241, 0.98);
  border-radius: 18px;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0);
}

.focus-ring.hidden {
  display: none;
}

.focus-ring.show {
  display: block;
  animation: focus-pop 0.6s ease forwards;
}

@keyframes focus-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.25);
  }

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

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
}

.zoom-controls {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 376px);
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 380px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 6;
}

body.generated-single-mode .zoom-controls {
  bottom: calc(var(--safe-bottom) + 188px);
  width: min(calc(100% - 24px), 360px);
}

.zoom-slider-wrap {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.zoom-value {
  min-width: 64px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 241, 0.86);
  border: 1px solid var(--surface-border);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(18px);
  color: var(--text);
}

.zoom-dial {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  background: transparent;
}

.zoom-dial::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(213, 197, 134, 0.96), rgba(255, 255, 255, 0.72));
}

.zoom-dial::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7.5px;
  border: 2px solid var(--thumb-border);
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
}

.zoom-dial::-moz-range-track {
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(213, 197, 134, 0.96), rgba(255, 255, 255, 0.72));
}

.zoom-dial::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid var(--thumb-border);
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
}

.gallery-thumb-wrap {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 56px;
  height: 56px;
}

.gallery-thumb-wrap.hidden {
  display: none;
}

.gallery-thumb {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  border: 0;
  padding: 0;
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.76), rgba(235, 220, 211, 0.68));
  border: 1px solid rgba(255, 247, 240, 0.5);
  box-shadow: var(--shadow);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(235, 220, 211, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.gallery-thumb-close span {
  font-size: 16px;
  line-height: 1;
}

.status-wrap {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 216px);
  transform: translateX(-50%);
  width: min(95vw, 620px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  z-index: 15;
}

.status-wrap.hidden {
  display: none;
}

.status-label {
  padding: 11px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 249, 244, 0.86), rgba(239, 225, 215, 0.72));
  border: 1px solid var(--surface-border);
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: pre-line;
  box-shadow: var(--shadow);
}

.progress-wrap {
  width: min(72vw, 380px);
  height: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(213, 197, 134, 0.28);
}

.progress-wrap.hidden {
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #d5c586, #ebdcd3);
  transition: width 0.18s ease;
}

.auth-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top, rgba(213, 197, 134, 0.28), transparent 32%),
    linear-gradient(180deg, rgba(250, 245, 241, 0.74), rgba(235, 220, 211, 0.94));
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  width: min(100%, 430px);
  border-radius: 32px;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 251, 248, 0.84), rgba(248, 238, 231, 0.72));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow);
}

.auth-copy h1 {
  margin: 6px 0 12px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.02;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.auth-tab,
.auth-submit,
.auth-input {
  border: 1px solid transparent;
  border-radius: 16px;
  font: inherit;
}

.auth-tab {
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
}

.auth-tab.active {
  background: linear-gradient(180deg, rgba(213, 197, 134, 0.48), rgba(235, 220, 211, 0.6));
  border-color: var(--accent-border);
}

.auth-form {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.auth-label {
  font-size: 13px;
  color: var(--muted);
}

.auth-input {
  width: 100%;
  padding: 14px 15px;
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--surface-border);
}

.auth-submit {
  margin-top: 8px;
  padding: 14px 18px;
  color: var(--text-on-accent);
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-line;
}

.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 38;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top, rgba(213, 197, 134, 0.24), transparent 34%),
    linear-gradient(180deg, rgba(249, 245, 242, 0.76), rgba(235, 220, 211, 0.95));
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-card {
  width: min(100%, 720px);
  height: min(calc(100dvh - 40px), 920px);
  max-height: min(calc(100dvh - 40px), 920px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 32px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 251, 248, 0.86), rgba(248, 238, 231, 0.74));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow);
  touch-action: pan-x;
}

.tutorial-copy h2 {
  margin: 6px 0 0;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.05;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.tutorial-slides {
  margin-top: 22px;
  flex: 1 1 auto;
  min-height: 0;
}

.tutorial-slide.hidden {
  display: none;
}

.tutorial-image-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 249, 244, 0.72);
  border: 1px solid var(--surface-border);
  box-shadow: 0 16px 34px rgba(124, 101, 61, 0.16);
}

.tutorial-image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tutorial-slide {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tutorial-text {
  margin: 14px 0 0;
  color: var(--text);
  font-size: clamp(14px, 2.8vw, 16px);
  font-weight: 600;
  line-height: 1.45;
}

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.tutorial-pagination {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.photo-type-overlay {
  position: absolute;
  inset: 0;
  z-index: 36;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top, rgba(213, 197, 134, 0.24), transparent 32%),
    linear-gradient(180deg, rgba(250, 246, 243, 0.7), rgba(235, 220, 211, 0.92));
}

.photo-type-overlay.hidden {
  display: none;
}

.photo-type-card {
  width: min(100%, 420px);
  border-radius: 32px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 251, 248, 0.84), rgba(248, 238, 231, 0.72));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow);
}

.photo-type-copy h2 {
  margin: 6px 0 12px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.05;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.photo-type-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.photo-type-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.photo-type-option {
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  padding: 16px 18px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.photo-type-option:hover,
.photo-type-option:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-border);
  background: linear-gradient(180deg, rgba(255, 249, 244, 0.88), rgba(235, 220, 211, 0.62));
}

.photo-type-cancel {
  margin-top: 14px;
  width: 100%;
}

.ai-selection-overlay {
  position: absolute;
  inset: 0;
  z-index: 37;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top, rgba(213, 197, 134, 0.24), transparent 34%),
    linear-gradient(180deg, rgba(249, 245, 242, 0.76), rgba(235, 220, 211, 0.95));
}

.ai-selection-overlay.hidden {
  display: none;
}

.ai-selection-card {
  width: min(100%, 980px);
  max-height: min(92vh, 920px);
  overflow: auto;
  border-radius: 32px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 251, 248, 0.86), rgba(248, 238, 231, 0.74));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow);
}

.ai-selection-copy h2 {
  margin: 6px 0 12px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.05;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.ai-selection-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ai-selection-loading {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.ai-selection-loading.hidden {
  display: none;
}

.ai-selection-spinner {
  position: static;
  margin: 0;
}

.ai-selection-loading-text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.ai-selection-meta {
  margin-top: 18px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ai-selection-meta.hidden {
  display: none;
}

.ai-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.ai-selection-grid.hidden {
  display: none;
}

.ai-selection-option {
  border: 1px solid var(--surface-border);
  border-radius: 22px;
  padding: 12px;
  background: var(--surface-softer);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ai-selection-option:hover,
.ai-selection-option:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 14px 30px rgba(124, 101, 61, 0.12);
}

.ai-selection-option.is-selected {
  border-color: rgba(21, 23, 28, 0.88);
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.98), rgba(238, 228, 220, 0.94));
  box-shadow: 0 18px 36px rgba(21, 23, 28, 0.14);
}

.ai-selection-option img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.28);
  max-height: 240px;
}

.ai-selection-option-copy {
  margin-top: 12px;
}

.ai-selection-option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-selection-option-label {
  font-size: 14px;
  font-weight: 600;
}

.ai-selection-option-status {
  flex-shrink: 0;
  color: rgba(21, 23, 28, 0.9);
  font-size: 12px;
  font-weight: 600;
}

.ai-selection-option-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-selection-option-button {
  width: 100%;
  margin-top: 12px;
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: rgba(21, 23, 28, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.ai-selection-option-button:hover,
.ai-selection-option-button:focus-visible {
  transform: translateY(-1px);
}

.ai-selection-option.is-selected .ai-selection-option-button {
  background: rgba(117, 95, 58, 0.9);
}

.ai-selection-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 18px;
  padding: 14px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(248, 238, 231, 0), rgba(248, 238, 231, 0.9) 16%, rgba(248, 238, 231, 0.98) 100%);
}

.ai-selection-footer::before {
  content: "";
  position: absolute;
  inset: 6px -12px 0;
  border-top: 1px solid rgba(117, 95, 58, 0.18);
  border-radius: 22px 22px 0 0;
  background: rgba(255, 251, 248, 0.86);
  box-shadow: 0 -10px 30px rgba(21, 23, 28, 0.06);
  backdrop-filter: blur(18px);
  z-index: -1;
}

.ai-selection-footer.hidden {
  display: none;
}

.ai-selection-cancel,
.ai-selection-confirm {
  min-height: 52px;
}

.ai-selection-cancel {
  flex: 0 0 auto;
  margin-top: 0;
}

.generated-reaction-bar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 304px);
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px));
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 18;
}

body.generated-single-mode .generated-reaction-bar {
  bottom: calc(var(--safe-bottom) + 36px);
  width: min(360px, calc(100vw - 32px));
}

.generated-reaction-bar.hidden {
  display: none;
}

.generated-reaction-button {
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.62), rgba(246, 235, 228, 0.52));
  color: var(--text);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 20px rgba(83, 61, 37, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.generated-reaction-button:hover,
.generated-reaction-button:focus-visible {
  transform: translateY(-2px);
}

.generated-reaction-button.is-selected {
  border-color: var(--accent-border);
  box-shadow: 0 14px 24px rgba(124, 101, 61, 0.1);
}

.generated-reaction-button img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
}

.generated-reaction-button span {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.bottom-bar {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--safe-bottom) + 72px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
  z-index: 20;
}

body.generated-single-mode .bottom-bar {
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  transform: none;
  bottom: calc(var(--safe-bottom) + 108px);
  width: auto;
  grid-template-columns: 1fr auto 1fr;
  justify-content: normal;
  gap: 12px;
}

body.split-mode-active .generated-reaction-bar {
  left: 25%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 256px);
  width: clamp(156px, calc(50vw - 28px), 220px);
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

body.split-mode-active .zoom-controls {
  bottom: calc(var(--safe-bottom) + 396px);
}

body.split-mode-active .bottom-bar {
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--safe-bottom) + 72px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
}

body.split-mode-active .bottom-bar-slot-ai {
  grid-column: 1;
  justify-self: start;
  width: 124px;
  height: 76px;
}

body.split-mode-active #captureButton {
  justify-self: center;
}

body.split-mode-active #flipButton {
  justify-self: end;
}

body.generated-single-mode .bottom-bar-slot-ai {
  grid-column: 1;
  justify-self: start;
  width: 124px;
  height: 76px;
}

body.generated-single-mode #aiButton {
  justify-self: start;
}

body.generated-single-mode #captureButton {
  justify-self: center;
}

body.generated-single-mode #flipButton {
  display: inline-flex;
  justify-self: end;
}

.bottom-bar-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-bar-slot-ai {
  width: 124px;
  height: 96px;
  grid-column: 2;
  justify-self: center;
}

.bottom-bar-logout {
  padding-top: 8px;
  padding-bottom: 8px;
}

.settings-widget {
  position: absolute;
  left: max(28px, env(safe-area-inset-left));
  bottom: calc(var(--safe-bottom) + 14px);
  z-index: 21;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.settings-menu {
  width: min(300px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.settings-menu.hidden {
  display: none;
}

.settings-menu .account-badge,
.settings-menu .ghost-button,
.settings-menu .feedback-panel {
  width: 100%;
  max-width: 100%;
}

.settings-menu .account-badge {
  text-align: center;
}

.settings-toggle {
  min-width: 52px;
  min-height: 52px;
  padding: 0 16px 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(249, 241, 234, 0.92), rgba(233, 217, 206, 0.88));
  border-color: rgba(171, 151, 83, 0.36);
  box-shadow: 0 18px 36px rgba(83, 61, 37, 0.16);
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.08em;
}

.feedback-panel {
  padding: 12px;
  border-radius: 18px;
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.84), rgba(246, 235, 228, 0.8));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.feedback-panel.hidden {
  display: none;
}

.feedback-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.feedback-textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.feedback-action {
  padding-top: 8px;
  padding-bottom: 8px;
}

.action-button {
  border: 0;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.action-button:disabled {
  opacity: 0.45;
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-2px);
}

.action-button:active:not(:disabled) {
  transform: translateY(2px) scale(0.97);
}

.action-button-ai {
  width: 152px;
  height: 96px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  box-shadow: none;
}

.action-button-ai img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.action-button-ai.action-button-return {
  width: 124px;
  height: 56px;
  padding: 0 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 251, 247, 0.92), rgba(235, 220, 211, 0.82));
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(18px);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

body.generated-single-mode .action-button-ai.action-button-return {
  width: 118px;
  height: 58px;
}

.action-button-capture {
  width: 75px;
  height: 75px;
}

.action-button-capture img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.action-button-flip {
  grid-column: 3;
  justify-self: end;
  width: 90px;
  height: 75px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  box-shadow: none;
  font-size: 38px;
  line-height: 1;
}

.spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin-left: -31px;
  margin-top: -31px;
  border-radius: 50%;
  border: 4px solid rgba(218, 205, 157, 0.35);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.viewer-modal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--modal-bg);
  z-index: 40;
}

.viewer-modal.hidden {
  display: none;
}

.viewer-chrome {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--safe-top);
  display: flex;
  justify-content: space-between;
  padding: 14px;
  z-index: 2;
}

.viewer-close,
.viewer-save {
  border: 0;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.8), rgba(239, 225, 215, 0.72));
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 24px rgba(83, 61, 37, 0.1);
}

.viewer-body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: calc(var(--safe-top) + 40px) 12px calc(var(--safe-bottom) + 70px);
}

.viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer-nav {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.8), rgba(239, 225, 215, 0.72));
  color: var(--text);
  font-size: 34px;
  line-height: 1;
}

.viewer-dots {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 14px);
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.viewer-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(214, 198, 188, 0.48);
}

.viewer-dot.active {
  background: rgba(235, 220, 211, 0.98);
}

@media (max-width: 900px) {
  .camera-frame,
  .frame-button {
    width: min(100%, calc((var(--app-height) - var(--safe-top) - var(--safe-bottom) - 150px) * 0.75));
  }

  .pane {
    padding-bottom: calc(var(--safe-bottom) + 98px);
  }

  .bottom-bar {
    bottom: calc(var(--safe-bottom) + 64px);
  }

  .zoom-controls {
    bottom: calc(var(--safe-bottom) + 146px);
    width: min(calc(100% - 24px), 360px);
  }

  body.generated-single-mode .zoom-controls {
    bottom: calc(var(--safe-bottom) + 212px);
  }

  body.split-mode-active .zoom-controls {
    bottom: calc(var(--safe-bottom) + 164px);
  }

  body.generated-single-mode .bottom-bar {
    bottom: calc(var(--safe-bottom) + 96px);
  }
}

@media (max-width: 680px) {
  .top-bar {
    padding: 0 10px;
  }

  .pane {
    padding-top: calc(var(--safe-top) + 82px);
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: calc(var(--safe-bottom) + 136px);
  }

  .bottom-bar {
    bottom: calc(var(--safe-bottom) + 76px);
  }

  .bottom-bar-slot-ai {
    width: 132px;
    height: 84px;
  }

  .zoom-controls {
    bottom: calc(var(--safe-bottom) + 168px);
    width: min(calc(100% - 16px), 332px);
  }

  body.generated-single-mode .generated-warning-banner {
    top: calc(var(--safe-top) - 10px);
    width: min(92vw, 332px);
  }

  .generated-warning-banner {
    font-size: 17px;
  }

  body.generated-single-mode .zoom-controls {
    bottom: calc(var(--safe-bottom) + 178px);
    width: min(calc(100% - 16px), 332px);
  }

  body.split-mode-active .zoom-controls {
    bottom: calc(var(--safe-bottom) + 186px);
  }

  body.generated-single-mode .bottom-bar {
    bottom: calc(var(--safe-bottom) + 98px);
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    gap: 12px;
  }

  body.generated-single-mode .bottom-bar-slot-ai {
    width: 112px;
    height: 72px;
  }

  .action-button-ai {
    width: 132px;
    height: 84px;
    padding: 0;
  }

  .action-button-ai.action-button-return {
    width: 112px;
    height: 52px;
    font-size: 18px;
  }

  body.generated-single-mode .action-button-ai.action-button-return {
    width: 104px;
    height: 52px;
  }

  .action-button-flip {
    width: 88px;
    height: 72px;
  }

  .action-button-capture {
    width: 74px;
    height: 74px;
  }

  .action-button-flip {
    border-radius: 16px;
    font-size: 32px;
  }

  .auth-card {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .tutorial-card {
    padding: 20px 16px;
    border-radius: 24px;
    height: min(calc(100dvh - 24px), 920px);
    max-height: min(calc(100dvh - 24px), 920px);
  }

  .ai-selection-card {
    padding: 20px 16px;
    border-radius: 24px;
  }

  .ai-selection-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-selection-cancel {
    flex-basis: auto;
  }

  .generated-reaction-bar {
    bottom: calc(var(--safe-bottom) + 276px);
    width: min(360px, calc(100vw - 24px));
  }

  body.split-mode-active .generated-reaction-bar {
    width: clamp(148px, calc(50vw - 20px), 194px);
  }

  body.generated-single-mode .generated-reaction-bar {
    bottom: calc(var(--safe-bottom) + 34px);
    width: min(320px, calc(100vw - 24px));
  }

  .ai-selection-grid {
    grid-template-columns: 1fr;
  }

  .tutorial-footer {
    margin-top: 14px;
  }

  .settings-widget {
    left: max(18px, env(safe-area-inset-left));
    bottom: calc(var(--safe-bottom) + 2px);
  }

  .settings-menu .account-badge {
    padding: 8px 10px;
  }

  .settings-menu .account-badge-email {
    font-size: 12px;
  }

  .settings-menu .account-badge-meta {
    font-size: 11px;
  }

  .settings-menu .ghost-button {
    padding: 8px 10px;
    font-size: 13px;
  }

  .settings-toggle {
    min-width: 48px;
    min-height: 48px;
    font-size: 26px;
  }

  .feedback-panel {
    width: min(280px, calc(100vw - 24px));
  }
}
