* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  color-scheme: light only;
}

body {
  font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, #f3e2bd 0%, #f7ecd9 45%, #eaddc4 100%);
  color: #4a3a26;
  position: relative;
  overflow-x: hidden;
}

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 3rem;
  position: relative;
  z-index: 1;
}

/* ---- Uçuşan ikonlar (date/ ile aynı desen) ---- */
.floating-icons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.fi {
  position: absolute;
  bottom: -10%;
  font-size: 1.7rem;
  opacity: 0.4;
  animation: float-up 10s ease-in infinite;
}
@keyframes float-up {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-110vh) rotate(20deg); opacity: 0; }
}

/* ---- Ekran geçişleri ---- */
.screen { display: none; width: 100%; }
.screen.active { display: flex; flex-direction: column; align-items: center; }

/* ---- Genel kart (giriş / paylaş / bitiş ekranları) ---- */
.card {
  width: 100%;
  max-width: 440px;
  background: #fffdf8;
  border-radius: 26px;
  padding: 2.25rem 1.75rem;
  box-shadow: 0 20px 45px rgba(74, 58, 38, 0.18);
  text-align: center;
}
.cover-emoji { font-size: 2.8rem; margin-bottom: 0.5rem; }
.card h1 { font-size: 1.5rem; margin-bottom: 0.6rem; color: #6b4a26; }
.cover-sub { font-size: 0.95rem; color: #7a6a52; line-height: 1.5; margin-bottom: 1.5rem; }

.text-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 2px solid #e8d9b8;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  outline: none;
  background: #fffef9;
}
.text-input:focus { border-color: #d6a95c; }

.intro-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #9a8a6c;
}
.intro-status.error { color: #c23b3b; }

.btn-primary, .btn-secondary {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.8rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, #d6a95c 0%, #e8c384 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(214, 169, 92, 0.45);
}
.btn-secondary {
  background: #f2e9d4;
  color: #6b4a26;
  margin-top: 0.75rem;
}
.btn-primary:disabled, .btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Paylaş ekranı ---- */
.link-box {
  background: #f7f0dd;
  border: 1.5px dashed #d6a95c;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  word-break: break-all;
  color: #5a4a30;
  margin-bottom: 1rem;
}
.copied-note { color: #4a8f5c; font-weight: 700; font-size: 0.9rem; margin-top: 0.6rem; }

/* ---- Kitap ---- */
.book {
  width: 100%;
  max-width: 520px;
  background: #6b4a26;
  border-radius: 20px;
  padding: 0.9rem;
  box-shadow: 0 22px 50px rgba(74, 58, 38, 0.3);
}
.book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.5rem 0.7rem;
}
.book-title { color: #f3e2bd; font-weight: 700; font-size: 0.95rem; }
.book-progress {
  flex: 1;
  max-width: 140px;
  margin-left: 1rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.link-icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #f3e2bd;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1rem;
  margin-left: 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
}
.book-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f3e2bd, #ffd98a);
  transition: width 0.5s ease;
}
.page {
  background: #fffdf5;
  background-image: repeating-linear-gradient(#fffdf5 0 38px, #f0e6cc 39px);
  border-radius: 12px;
  min-height: 260px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 1.1rem 1.2rem;
}
.sentence {
  font-family: "Caveat", cursive;
  font-size: 1.5rem;
  line-height: 1.5;
  margin-bottom: 0.35rem;
  display: block;
  opacity: 0;
  animation: ink-in 0.6s ease forwards;
}
.sentence.opening { color: #7a6a52; font-style: italic; }
.sentence.author-0 { color: #c23b6b; }
.sentence.author-1 { color: #3c50c2; }
@keyframes ink-in {
  from { opacity: 0; clip-path: inset(0 100% 0 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}

/* ---- Sıra durumu — TEK, sabit element; ekran değişmez, sadece bu ve
   formun disabled durumu güncellenir. ---- */
.turn-status {
  margin-top: 1.1rem;
  background: #fffdf8;
  border-radius: 999px;
  padding: 0.6rem 1.3rem;
  font-weight: 700;
  color: #6b4a26;
  box-shadow: 0 8px 18px rgba(74, 58, 38, 0.15);
  transition: background 0.25s ease, color 0.25s ease;
}
.turn-status.waiting {
  background: #fdeee0;
  color: #a6632b;
}
.turn-status-icon { display: inline-block; }
.turn-status:not(.waiting) .turn-status-icon {
  animation: pencil-shake 1s ease-in-out infinite;
}
@keyframes pencil-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}

/* ---- Cümle formu — her zaman görünür, sıra sende değilken disabled ---- */
.sentence-form {
  width: 100%;
  max-width: 520px;
  margin-top: 1.1rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}
.sentence-form textarea {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  border: 2px solid #e8d9b8;
  resize: none;
  outline: none;
  background: #fffef9;
  transition: opacity 0.25s ease;
}
.sentence-form textarea:focus { border-color: #d6a95c; }
.sentence-form textarea:disabled,
.sentence-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sentence-form textarea:disabled { background: #f2ede1; }

/* ---- Bitirme teklifi + link paylaşımı ---- */
.text-link-btn {
  border: none;
  background: none;
  color: #9a8a6c;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 1.1rem;
  padding: 0.3rem;
}
.end-pending-note {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #a6632b;
  font-weight: 600;
  text-align: center;
}

/* ---- Kitap ekranının üstünde katmanlar (link paylaşımı, bitirme teklifi) —
   ayrı bir ekrana geçiş değil, kitap sayfası hep arkada durur ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 58, 38, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 40;
}
.overlay-card {
  width: 100%;
  max-width: 420px;
  background: #fffdf8;
  border-radius: 24px;
  padding: 2rem 1.6rem;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}
.overlay-emoji { font-size: 2.6rem; margin-bottom: 0.5rem; }
.overlay-text {
  font-size: 0.95rem;
  color: #7a6a52;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.overlay-card .btn-secondary { display: block; width: 100%; margin-top: 0.6rem; }

/* ---- Toast (kısa ömürlü bildirim, örn. bitirme teklifi reddedildi) ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: #4a3018;
  color: #f3e2bd;
  padding: 0.85rem 1.3rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  z-index: 45;
  max-width: 90vw;
  text-align: center;
}

/* ---- Bitiş ---- */
.the-end-cover {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(160deg, #6b4a26 0%, #4a3018 100%);
  border-radius: 26px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 22px 50px rgba(74, 58, 38, 0.35);
}
.the-end-emoji { font-size: 2.6rem; }
.the-end-cover h1 {
  font-family: "Caveat", cursive;
  font-size: 3.2rem;
  color: #f3e2bd;
  margin: 0.2rem 0;
}
.the-end-sub { color: #d8c39a; font-size: 0.9rem; }
.final-story {
  width: 100%;
  max-width: 480px;
  background: #fffdf5;
  border-radius: 18px;
  padding: 1.3rem 1.4rem;
  margin-top: 1.1rem;
  box-shadow: 0 12px 28px rgba(74, 58, 38, 0.15);
  max-height: 40vh;
  overflow-y: auto;
}

.hidden { display: none !important; }

/* ---- Konfeti parçacığı (date/ ile aynı mantık) ---- */
.burst-particle {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  animation: burst-fly 1s ease-out forwards;
}
@keyframes burst-fly {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

@media (max-width: 480px) {
  .sentence { font-size: 1.3rem; }
  .the-end-cover h1 { font-size: 2.6rem; }
}
