:root {
  --bg: #07100b;
  --bg-soft: #0f1f17;
  --panel: rgba(11, 19, 15, 0.84);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f4f8f4;
  --muted: #adc0b3;
  --green: #1fb56d;
  --green-strong: #45e49a;
  --white: #ffffff;
  --headline-font: "Bahnschrift", "Arial Narrow", sans-serif;
  --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --transition: 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --shell-width: 720px;
  --camera-height: 520px;
  --capture-screen-height: 100%;
  --template-section-height: 1fr;
  --template-columns: 2;
  --template-min-height: 148px;
  --panel-gap: 20px;
  --shell-padding: 22px;
  --menu-offset-y: -600px;
  --menu-button-min-height: 72px;
  --menu-button-font-size: 1.2rem;
  --menu-gap: 16px;
  --button-xl-min-height: 94px;
  --button-xl-font-size: 1.58rem;
  --capture-button-offset: -810px;
  --capture-button-min-height: 96px;
  --capture-button-font-size: 1.3rem;
  --capture-button-width: 420px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background-color: #07100b !important;
  background-image:
    radial-gradient(circle at top, rgba(35, 90, 61, 0.35), transparent 34%),
    linear-gradient(180deg, #07100b 0%, #09140e 45%, #060d09 100%) !important;
  color: var(--text);
  font-family: var(--body-font);
}

body {
  display: grid;
  place-items: center;
  padding: 0;
  touch-action: manipulation;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  width: min(100vw, var(--shell-width));
  height: 100vh;
  padding: var(--shell-padding);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.topbar,
.screen-frame,
.screen {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 50px;
  display: grid;
  gap: 5px;
}

.brand-mark-line {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.28), var(--green-strong));
}

.brand-kicker,
.welcome-kicker,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
}

.brand-kicker,
.welcome-kicker {
  color: rgba(255, 255, 255, 0.72);
}

.eyebrow {
  color: var(--green-strong);
  font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--headline-font);
  letter-spacing: 0.02em;
}

h1 {
  font-size: 1.46rem;
}

.topbar-badge,
.camera-status,
.selection-chip,
.template-tag {
  border-radius: 999px;
  font-weight: 700;
}

.topbar-badge {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: #d9e5de;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.screen-frame {
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.985);
  transition: opacity var(--transition), transform var(--transition);
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.screen[data-screen="template-selection"],
.screen[data-screen="capture"] {
  display: grid;
  align-items: stretch;
}

.glass-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.welcome-panel,
.countdown-panel,
.processing-panel {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 34px;
  border-radius: 36px;
}

/* Hub Panel - Full Screen Breakdown */
.hub-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  padding: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border: none !important;
  background: #000;
}

.welcome-video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.welcome-video-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay-tint {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(7, 16, 11, 0.2) 0%, rgba(7, 16, 11, 0.8) 100%);
  z-index: 2;
}

.menu-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 40px;
}

.main-menu-brand {
  margin-bottom: 80px;
  text-align: center;
}

.main-menu-brand .brand-mark {
  margin: 0 auto 32px;
  transform: scale(2.2);
}

.hub-title {
  font-size: 5rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: 4px;
  text-shadow: 0 10px 40px rgba(0,0,0,0.6);
  margin-bottom: 12px;
}

.hub-subtitle {
  font-size: 1.8rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 1px;
}

.main-menu-actions {
  display: flex;
  flex-direction: column;
  gap: var(--menu-gap);
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  transform: translate(12px, 230px);
}

.menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  min-height: var(--menu-button-min-height) !important;
  font-size: var(--menu-button-font-size) !important;
  letter-spacing: 1px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4) !important;
}

.menu-icon {
  font-size: 3rem;
}

.welcome-panel {
  background:
    radial-gradient(circle at 20% 22%, rgba(69, 228, 154, 0.12), transparent 24%),
    radial-gradient(circle at 80% 18%, rgba(69, 228, 154, 0.08), transparent 18%),
    linear-gradient(180deg, rgba(10, 24, 17, 0.96), rgba(7, 16, 11, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.welcome-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  width: 62vw;
  height: 62vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  background: radial-gradient(circle, rgba(69, 228, 154, 0.95), transparent 70%);
}

.glow-1 {
  top: -10%;
  left: -30%;
}

.glow-2 {
  top: 6%;
  right: -28%;
}

.glow-3 {
  bottom: -22%;
  left: 6%;
}

.grid-mask {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.95), transparent 88%);
  opacity: 0.3;
}

.welcome-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 26px;
  max-width: 520px;
}

.welcome-content h2,
.countdown-panel h2,
.processing-panel h2,
.result-preview h2 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.96;
  text-wrap: balance;
}

.lead {
  color: #d7e1db;
  font-size: 1.08rem;
  line-height: 1.55;
}

.supporting-text {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.98rem;
}

.primary-button,
.secondary-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  font-family: var(--headline-font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
}

.primary-button:hover,
.secondary-button:hover,
.primary-button:active,
.secondary-button:active {
  transform: translateY(-2px);
}

.primary-button {
  color: #021108;
  background: linear-gradient(180deg, rgba(71, 228, 155, 0.86), rgba(25, 167, 93, 0.78));
  box-shadow: 0 14px 34px rgba(31, 181, 109, 0.22);
}

.secondary-button {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.primary-button.xl,
.secondary-button.xl {
  min-width: min(100%, 340px);
  min-height: var(--button-xl-min-height);
  padding: 24px 40px;
  border-radius: 999px;
  font-size: var(--button-xl-font-size);
}

.primary-button.full,
.capture-actions button {
  min-height: 64px;
  border-radius: 999px;
  font-size: 1rem;
}

.mode-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.primary-button.full {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 18px 24px;
}

.close-capture-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.close-capture-btn svg {
  width: 28px;
  height: 28px;
}

.close-capture-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.06);
}

.close-capture-btn:active {
  transform: scale(0.94);
}

.capture-layout,
.result-layout {
  height: 100%;
  display: grid;
  gap: var(--panel-gap);
}

.capture-layout {
  height: var(--capture-screen-height);
  grid-template-rows: minmax(0, 1.2fr) minmax(0, 0.9fr);
  align-content: stretch;
}

.camera-only-layout {
  grid-template-rows: minmax(0, 1.28fr) auto;
  gap: 12px;
}

.capture-layout.selection-mode {
  grid-template-rows: minmax(0, 1fr);
}

.capture-layout.selection-mode .camera-controls-panel {
  height: var(--capture-screen-height);
  padding-top: 84px;
}

.camera-stage,
.template-panel,
.camera-controls-panel,
.template-selection-panel,
.result-preview,
.qr-panel,
.thankyou-panel {
  padding: 22px;
}

.camera-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding-top: 84px;
}

.camera-controls-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.capture-layout:not(.selection-mode) .camera-controls-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  align-items: center;
  justify-content: flex-end;
  margin-top: var(--capture-button-offset);
  position: relative;
  z-index: 12;
  pointer-events: auto;
}

.stage-header,
.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.stage-header h2,
.panel-header-row h3,
.result-side h3 {
  font-size: 1.5rem;
}

.camera-status,
.selection-chip {
  padding: 10px 14px;
  background: rgba(31, 181, 109, 0.12);
  border: 1px solid rgba(69, 228, 154, 0.22);
  color: var(--green-strong);
  font-size: 0.85rem;
}

.camera-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, #122019, #0a120d);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 620px;
}

video,
.capture-canvas,
.result-image-wrap img,
.qr-code img,
.share-image-wrap img {
  width: 100%;
  height: 100%;
}

.camera-viewport video {
  display: block;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.camera-viewport .capture-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 5;
}

.capture-canvas {
  display: none;
}

.camera-overlay,
.camera-fallback {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.camera-overlay {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: stretch;
  padding: 18px;
  background: linear-gradient(180deg, rgba(3, 10, 6, 0.22), rgba(3, 10, 6, 0.02) 35%, rgba(3, 10, 6, 0.28));
}

.camera-overlay p {
  max-width: 280px;
  padding: 10px 14px;
  text-align: center;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.34);
  font-size: 0.85rem;
  justify-self: center;
  align-self: end;
}

.face-guide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

body.photo-frozen .face-guide {
  display: none;
}

.face-guide-oval {
  width: min(46vw, 370px);
  height: min(62vw, 470px);
  border-radius: 50%;
  border: 3px solid rgba(69, 228, 154, 0.62);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 28px rgba(31, 181, 109, 0.18),
    inset 0 0 28px rgba(31, 181, 109, 0.12);
  background: radial-gradient(circle at center, rgba(69, 228, 154, 0.04), rgba(69, 228, 154, 0.01) 62%, transparent 74%);
}


.frame-corners span {
  position: absolute;
  width: 36px;
  height: 36px;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.82);
}

.frame-corners span:nth-child(1) {
  top: 24px;
  left: 24px;
  border-width: 5px 0 0 5px;
  border-top-left-radius: 18px;
}

.frame-corners span:nth-child(2) {
  top: 24px;
  right: 24px;
  border-width: 5px 5px 0 0;
  border-top-right-radius: 18px;
}

.frame-corners span:nth-child(3) {
  right: 24px;
  bottom: 24px;
  border-width: 0 5px 5px 0;
  border-bottom-right-radius: 18px;
}

.frame-corners span:nth-child(4) {
  left: 24px;
  bottom: 24px;
  border-width: 0 0 5px 5px;
  border-bottom-left-radius: 18px;
}

.camera-fallback {
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  background: rgba(4, 10, 7, 0.86);
}

.hidden {
  display: none !important;
}

.template-grid,
.template-selection-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  grid-template-rows: auto;
  gap: 12px;
  align-items: stretch;
  justify-content: stretch;
  justify-items: stretch;
}

.template-panel,
.template-selection-panel {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

.template-selection-panel {
  width: 100%;
  height: var(--capture-screen-height);
  min-height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  padding-top: 84px;
}

.template-selection-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  height: 100%;
  width: 100%;
}

.template-selection-actions {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.template-selection-actions .primary-button {
  width: min(100%, 420px);
}

.panel-state-select {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  height: 100%;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.mode-button {
  appearance: none;
  min-height: 58px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font: 700 0.98rem var(--headline-font);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: border-color var(--transition), background var(--transition), transform 180ms ease;
}

.mode-button.active {
  background: linear-gradient(180deg, rgba(31, 181, 109, 0.22), rgba(31, 181, 109, 0.08));
  border-color: rgba(69, 228, 154, 0.5);
  color: var(--green-strong);
}

.ai-controls {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.result-note {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(69, 228, 154, 0.16);
  background: rgba(31, 181, 109, 0.08);
}

.status-note {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(69, 228, 154, 0.16);
  background: rgba(31, 181, 109, 0.08);
}

.template-card {
  appearance: none;
  cursor: pointer;
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 16px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(7, 16, 11, 0.4);
  color: var(--text);
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), filter var(--transition);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  justify-self: stretch;
}

.template-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  z-index: 1;
  pointer-events: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.template-card::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--green-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2305150a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 5;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.template-card .card-bg {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: 0;
  transition: transform 0.4s ease;
}

.template-selection-grid .template-card .card-bg {
  background-size: cover;
  background-position: center;
}

.template-card .card-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 16, 11, 0.94) 0%, rgba(7, 16, 11, 0.52) 34%, rgba(7, 16, 11, 0.16) 62%, rgba(7, 16, 11, 0.05) 100%);
  transition: background 0.3s ease;
}

.template-card.active .card-bg::after {
  background: linear-gradient(to top, rgba(7, 16, 11, 0.94) 0%, rgba(7, 16, 11, 0.52) 40%, rgba(31, 181, 109, 0.15) 100%);
}

.template-card>*:not(.card-bg) {
  position: relative;
  z-index: 1;
}

.template-card:active {
  transform: scale(0.98);
}

.template-card:hover .card-bg {
  transform: scale(1.05);
}

.template-card.active {
  border-color: rgba(69, 228, 154, 0.2);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 40px rgba(31, 181, 109, 0.15);
}

.template-card.active::before {
  border-color: var(--green-strong);
  box-shadow: 0 0 0 1px var(--green-strong);
}

.template-card.active::after {
  opacity: 1;
  transform: scale(1);
}

.template-thumb {
  height: 80px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.template-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #d7e2db;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.template-card.active .template-tag {
  background: rgba(69, 228, 154, 0.16);
  color: var(--green-strong);
}

.template-preview-card {
  cursor: default;
}

.template-card h4 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.15;
}

.template-card p {
  color: #b8c7be;
  max-width: 22ch;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.25;
  text-wrap: balance;
}

.mt-auto {
  margin-top: auto;
}

.main-capture-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  width: 100%;
}

.main-capture-wrap .primary-button {
  width: min(100%, var(--capture-button-width));
  min-height: var(--capture-button-min-height);
  padding: 20px 32px;
  font-size: var(--capture-button-font-size);
  border-radius: 999px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.capture-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.capture-actions.single-action {
  grid-template-columns: 1fr;
}

.countdown-panel,
.processing-panel {
  gap: 18px;
}

.processing-panel {
  position: relative;
  overflow: hidden;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: 56px 30px;
  background:
    radial-gradient(circle at 50% 16%, rgba(69, 228, 154, 0.14), transparent 24%),
    radial-gradient(circle at 50% 85%, rgba(255, 255, 255, 0.04), transparent 30%),
    linear-gradient(180deg, rgba(7, 17, 12, 0.97), rgba(5, 11, 8, 0.99));
}

.processing-eyebrow {
  letter-spacing: 0.22em;
  position: relative;
  z-index: 1;
}

.processing-aura {
  position: relative;
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.5;
}

.processing-aura-1 {
  width: 42vw;
  height: 42vw;
  top: -10%;
  left: -18%;
  background: radial-gradient(circle, rgba(69, 228, 154, 0.26), transparent 68%);
}

.processing-aura-2 {
  width: 46vw;
  height: 46vw;
  right: -24%;
  bottom: -12%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 72%);
}

.processing-stage {
  display: grid;
  justify-items: center;
  gap: 20px;
  width: min(100%, 560px);
  position: relative;
  z-index: 1;
}

.processing-preview-card {
  width: min(100%, 320px);
  aspect-ratio: 2 / 3;
  padding: 14px;
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(69, 228, 154, 0.18), rgba(255, 255, 255, 0.04));
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(69, 228, 154, 0.14) inset;
  animation: processing-card-float 4.4s ease-in-out infinite;
}

.processing-preview-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
    #0d1712;
}

.processing-preview-art {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(69, 228, 154, 0.3), transparent 16%),
    radial-gradient(circle at 50% 62%, rgba(255, 255, 255, 0.14), transparent 20%),
    linear-gradient(180deg, rgba(17, 36, 25, 0.88), rgba(7, 13, 10, 0.98));
  transform: scale(1.02);
}

.processing-preview-shine {
  position: absolute;
  inset: -15% auto -15% -55%;
  width: 56%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  filter: blur(4px);
  animation: processing-shine 2.8s ease-in-out infinite;
}

.processing-preview-grain {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 0.8px, transparent 0.8px);
  background-size: 12px 12px;
  opacity: 0.08;
  mix-blend-mode: screen;
}

.processing-label-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(7, 18, 12, 0.82);
  border: 1px solid rgba(69, 228, 154, 0.22);
  color: #f3f8f4;
  font-family: var(--headline-font);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.processing-copy {
  display: grid;
  gap: 10px;
  text-align: center;
  width: min(100%, 620px);
  position: relative;
  z-index: 1;
}

.processing-copy h2 {
  font-size: clamp(2.3rem, 6vw, 4.4rem);
  line-height: 0.94;
  color: var(--white);
  text-wrap: balance;
}

.processing-copy .lead {
  max-width: 30ch;
  margin: 0 auto;
  font-size: 1.12rem;
  color: rgba(255, 255, 255, 0.78);
}

.processing-progress {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.processing-progress-fill {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(69, 228, 154, 0.16), rgba(69, 228, 154, 0.96), rgba(255, 255, 255, 0.95));
  animation: loadingBar 2s ease-in-out infinite;
}

.processing-meta {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 620px);
}

.processing-meta-pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.processing-note {
  text-align: center;
  max-width: 38ch;
}

@keyframes processing-card-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

@keyframes processing-shine {
  0% {
    left: -55%;
    opacity: 0;
  }

  18% {
    opacity: 0.9;
  }

  52% {
    opacity: 0.7;
  }

  100% {
    left: 118%;
    opacity: 0;
  }
}

.result-layout {
  grid-template-rows: minmax(0, 1.7fr) auto;
  gap: 12px;
}

.result-preview {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 44px 14px 8px;
}

.result-header {
  margin-bottom: 18px;
  text-align: center;
}

.result-header h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.98;
}

.result-image-wrap {
  width: min(100%, 1040px);
  height: min(74vh, 1536px);
  aspect-ratio: 2 / 3;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-image-wrap img {
  object-fit: contain;
}

.result-note {
  margin-top: 14px;
}

.result-side {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  align-content: start;
  margin-top: 8px;
}

.qr-panel,
.thankyou-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qr-panel {
  justify-content: flex-start;
  padding-top: 14px;
  padding-bottom: 12px;
}

.qr-copy {
  display: grid;
  gap: 8px;
  text-align: center;
}

.qr-copy h3 {
  font-size: 1.3rem;
  line-height: 1.2;
  text-wrap: balance;
}

.qr-code {
  width: min(100%, 260px);
  aspect-ratio: 1;
  margin: 6px auto 2px;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 24px;
  background: white;
  overflow: hidden;
}

.qr-code img {
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  border-radius: 0;
  background: white;
}

.qr-code span {
  background: white;
  border-radius: 2px;
}

.qr-code span.filled {
  background: #08110c;
}

.qr-caption {
  text-align: center;
  color: var(--muted);
}

.result-actions {
  margin-top: 2px;
}

html:has(body.share-body),
body.share-body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #07100b !important;
  background-image:
    radial-gradient(circle at top, rgba(35, 90, 61, 0.35), transparent 34%),
    linear-gradient(180deg, #07100b 0%, #09140e 45%, #060d09 100%) !important;
  background-attachment: fixed;
}

body.share-body {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
  touch-action: pan-y pinch-zoom;
  height: auto;
  position: static;
}

.share-shell {
  width: 100%;
  max-width: 100%;
  margin: 0;
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0;
  padding-top: env(safe-area-inset-top, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
}

.share-card {
  width: 100%;
  max-width: 100%;
  flex: 1;
  min-height: max-content;
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 22px;
  background: transparent;
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
  box-shadow: none;
  margin: 0;
}

.share-hero {
  display: grid;
  gap: 14px;
}

.share-step {
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(69, 228, 154, 0.2);
  background: rgba(31, 181, 109, 0.1);
  color: var(--green-strong);
  font: 700 0.8rem var(--headline-font);
  letter-spacing: 0.08em;
}

.share-header {
  display: grid;
  gap: 10px;
}

.share-header h1,
.share-result h2 {
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 0.96;
}

.share-form,
.share-result {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: #eef6f0;
}

.field span {
  font-size: 0.95rem;
}

.field input {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: 500 1rem var(--body-font);
}

.field input:focus {
  outline: 2px solid rgba(69, 228, 154, 0.38);
  border-color: rgba(69, 228, 154, 0.45);
}

.consent-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #d8e3dc;
  line-height: 1.5;
}

.consent-box input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--green-strong);
}

.form-error {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 110, 110, 0.22);
  background: rgba(255, 110, 110, 0.1);
  color: #ffd6d6;
}

.share-success {
  display: grid;
  gap: 8px;
  text-align: center;
}

.share-image-wrap {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.share-image-wrap img {
  object-fit: cover;
}

.share-footer-note {
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

body[data-share-view="result"] .share-card {
  gap: 18px;
}

body:has(.screen[data-screen="welcome"].active) .topbar {
  display: none;
}

body:has(.screen[data-screen="welcome"].active) .app-shell {
  padding: 0;
  width: 100vw;
}

body:has(.screen[data-screen="template-selection"].active) .topbar {
  display: none;
}

body:has(.screen[data-screen="capture"].active) .app-shell,
body:has(.screen[data-screen="countdown"].active) .app-shell,
body:has(.screen[data-screen="processing"].active) .app-shell,
body:has(.screen[data-screen="result"].active) .app-shell {
  width: min(calc(100vw - 24px), var(--shell-width));
}

body:has(.screen[data-screen="template-selection"].active) .app-shell {
  width: calc(100vw - 24px);
  max-width: none;
}

body:has(.screen[data-screen="welcome"].active) .screen-frame {
  height: 100vh;
}

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

@keyframes loadingBar {
  0% {
    transform: translateX(-100%);
  }

  50% {
    transform: translateX(72%);
  }

  100% {
    transform: translateX(172%);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: 100vw;
    padding: 16px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .camera-stage,
  .template-panel,
  .result-preview,
  .qr-panel,
  .thankyou-panel {
    padding: 18px;
  }

  .capture-actions {
    grid-template-columns: 1fr;
  }

  .primary-button.xl {
    min-width: 100%;
  }

  .primary-button.xl,
  .secondary-button.xl {
    padding: 18px 24px;
  }

  .share-card {
    padding: 18px;
  }
}

@media (max-height: 860px) {

  .welcome-panel,
  .countdown-panel,
  .processing-panel {
    padding: 24px;
  }

  .welcome-content {
    gap: 18px;
  }

  .main-menu-actions {
    max-width: 520px;
  }

  .capture-actions {
    margin-top: 14px;
  }
}

body:has(.screen[data-screen="capture"].active) .screen-frame {
  overflow: hidden;
}

body:has(.screen[data-screen="template-selection"].active) .screen-frame {
  overflow: hidden;
  height: 100%;
}

body:has(.screen[data-screen="capture"].active) .capture-layout {
  grid-template-rows: minmax(0, 1fr) auto;
}

body:has(.screen[data-screen="capture"].active) .camera-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body:has(.screen[data-screen="capture"].active) .camera-viewport {
  height: 100%;
}

body:has(.screen[data-screen="capture"].active) .template-panel,
body:has(.screen[data-screen="template-selection"].active) .template-selection-panel {
  overflow: hidden;
}

/* Template Panel States */
.panel-state-normal, 
.panel-state-countdown, 
.panel-state-review {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel-state-normal {
  justify-content: stretch;
}

.panel-state-countdown {
  justify-content: stretch;
}

/* Inline Countdown */
.inline-countdown-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, var(--capture-button-width));
  min-height: var(--capture-button-min-height);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.inline-countdown-number {
  font-family: var(--headline-font);
  font-size: clamp(3.6rem, 9vw, 5.8rem);
  font-weight: 800;
  line-height: 0.88;
  color: var(--white);
  text-shadow: 0 0 32px rgba(69, 228, 154, 0.34);
  animation: countdown-number-pop 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.inline-countdown-number.is-ticking {
  animation: countdown-number-pop 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes countdown-number-pop {
  0% {
    opacity: 0;
    transform: scale(0.7);
    filter: blur(6px);
  }

  55% {
    opacity: 1;
    transform: scale(1.12);
    filter: blur(0);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

/* Review State */
.panel-state-review {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 12px 12px;
  gap: 28px;
  transform: translateY(-90px);
}

.review-header {
  margin: 0;
}

.review-header h3 {
  font-size: 2.2rem;
  margin-bottom: 12px;
  color: var(--white);
}

.review-header p {
  font-size: 1.15rem;
  color: var(--text);
  max-width: 440px;
  margin: 0 auto;
}

.review-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin: 0;
}

.review-actions .primary-button {
  order: -1; /* OLUŞTUR butonunu üste alıyor */
}

/* Tekrar Çek Butonu Özel Tasarımı */
.review-actions .secondary-button {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.02));
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.05);
  font-weight: 500;
}

.review-actions .secondary-button:hover {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.22), rgba(239, 68, 68, 0.08));
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.15);
  color: #fff;
}
