:root {
  --bg: #f4efe5;
  --card: #ffffff;
  --ink: #102d35;
  --muted: #66757a;
  --gold: #c8a35d;
  --line: #e4ddd0;
  --shadow: 0 18px 50px rgba(16, 45, 53, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100svh;
}

/* =========================================================
   HATIRA ANA SAYFA
========================================================= */

.memory-page {
  width: min(560px, calc(100% - 32px));
  margin: auto;
  min-height: 100svh;
  padding: 30px 0 36px;
  text-align: center;
}

.memory-logo {
  width: 125px;
  height: auto;
  margin: 4px auto 20px;
  display: block;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--gold);
  margin-bottom: 9px;
}

.memory-page h1,
.preview-header h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(32px, 8vw, 46px);
  margin: 0 0 10px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 30px;
  font-size: 15px;
}

.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}

.theme-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(16, 45, 53, .14);
}

.theme-preview {
  height: 150px;
  border-radius: 15px;
  overflow: hidden;
  background: #102d35;
  position: relative;
}

.theme-card img {
  width: 100%;
  display: block;
}

.test-frame-mini {
  position: absolute;
  inset: 10px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 12px;
  color: #fff;
}

.test-frame-mini span {
  font-family: "Playfair Display", serif;
  font-size: 19px;
}

.test-frame-mini small {
  font-size: 9px;
  letter-spacing: .2em;
  color: #e8cf91;
}

.theme-card h2 {
  font-size: 19px;
  margin: 0 0 8px;
}

.theme-card p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.test-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin: 22px 10px 0;
}

.back-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

/* =========================================================
   KAMERA
========================================================= */

.camera-page {
  width: 100%;
  max-width: 520px;
  margin: auto;
  min-height: 100svh;
  padding: 12px 14px 110px;
  display: flex;
  flex-direction: column;
}

/* Üst başlık kullanılmıyor ama mevcut PHP yapısını bozmayalım */
.camera-header {
  height: 46px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 10px;
}

.camera-header strong {
  font-size: 15px;
}

.camera-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 24px;
  background: #000;
  box-shadow: var(--shadow);
  line-height: 0;
}

.camera-wrapper::after {
  content: "";
  display: block;
  padding-top: 177.78%;
}

.camera-wrapper > * {
  position: absolute;
}

/* Kamera */
.camera-wrapper #camera {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* Frame */
.frame-overlay {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 2;
}

/* Kamera yükleniyor */
.camera-message {
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(16, 45, 53, .8);
  font-size: 14px;
  z-index: 3;
  text-align: center;
  padding: 20px;
}

/* Kamera hata */
.camera-error {
  margin: 14px 4px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  color: #9b2c2c;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* =========================================================
   KAMERA BUTONLARI
========================================================= */

.camera-controls {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(430px, calc(100% - 36px));
  display: grid;
  grid-template-columns: 56px 72px 56px;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.camera-controls button {
  pointer-events: auto;
}

/* Sol / sağ butonlar */
.circle-button {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  -webkit-tap-highlight-color: transparent;
}

/* Fotoğraf çekme butonu */
.capture-button {
  width: 72px;
  height: 72px;
  border: 5px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  -webkit-tap-highlight-color: transparent;
}

.capture-button span {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  display: block;
  box-shadow: inset 0 0 0 1px rgba(16, 45, 53, .08);
}

.circle-button:active,
.capture-button:active {
  transform: scale(.96);
}

.circle-button:disabled,
.capture-button:disabled {
  opacity: .5;
}

/* =========================================================
   GERİ SAYIM
========================================================= */

.countdown {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font-size: clamp(80px, 24vw, 150px);
  font-weight: 700;
  text-shadow: 0 5px 20px #000;
}

.countdown[hidden],
.flash[hidden] {
  display: none;
}

/* =========================================================
   FOTOĞRAF FLAŞI
========================================================= */

.flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #fff;
  opacity: 0;
}

.flash-on {
  animation: flash .18s ease-out;
}

@keyframes flash {
  0% {
    opacity: .95;
  }

  100% {
    opacity: 0;
  }
}

/* =========================================================
   ÖNİZLEME
========================================================= */

.preview-page {
  width: min(560px, calc(100% - 32px));
  margin: auto;
  min-height: 100svh;
  padding: 30px 0 40px;
}

.preview-header {
  text-align: center;
  margin-bottom: 22px;
}

.preview-header h1 {
  font-size: 34px;
  margin: 10px 0 6px;
}

.preview-header p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.preview-card {
  background: #fff;
  border-radius: 22px;
  padding: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: #000;
}

.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font: 700 15px "DM Sans", sans-serif;
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.secondary-button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.disabled {
  opacity: .45;
  pointer-events: none;
}

/* =========================================================
   MOBİL
========================================================= */

@media (max-width: 420px) {

  .memory-page {
    width: min(560px, calc(100% - 24px));
    padding-top: 24px;
  }

  .memory-logo {
    width: 90px;
    margin-bottom: 16px;
  }

  .memory-page h1 {
    font-size: 30px;
  }

  .subtitle {
    margin-bottom: 24px;
  }

  .theme-card {
    grid-template-columns: 96px 1fr;
    gap: 14px;
    padding: 12px;
  }

  .theme-preview {
    height: 135px;
  }

  .theme-card h2 {
    font-size: 17px;
  }

  .theme-card p {
    font-size: 12px;
  }

  .camera-page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .camera-controls {
    width: calc(100% - 28px);
    grid-template-columns: 54px 68px 54px;
  }

  .circle-button {
    width: 54px;
    height: 54px;
    font-size: 22px;
  }

  .capture-button {
    width: 68px;
    height: 68px;
  }

  .capture-button span {
    width: 52px;
    height: 52px;
  }
}

/* =========================================================
   iPHONE ALT GÜVENLİ ALAN
========================================================= */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .camera-controls {
    bottom: max(24px, env(safe-area-inset-bottom));
  }
}
.memory-page .memory-back {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;

    margin-bottom: 18px;

    color: #102d35 !important;
    font-size: 13px;
    font-weight: 600;

    text-decoration: none !important;

    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.memory-page .memory-back:hover {
    color: #102d35 !important;
    opacity: 1;
}
.memory-back .back-arrow {
    font-size: 17px;
    line-height: 1;
}