:root {
  --ink: #0f0b1a;
  --ink-2: #1a1430;
  --ink-3: #221a3a;
  --purple: #7c4dbd;
  --purple-bright: #9a63d9;
  --purple-deep: #4a2d73;
  --gold: #b3925f;
  --parchment: #ece2c6;
  --wine-bright: #d1495b;
  --text-soft: #cdc4e0;
  --text-mute: #948da8;

  --font-display: "Cormorant Garamond", serif;
  --font-body: "Noto Serif", serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text-soft);
  font-family: var(--font-body);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.75rem;
}

a { color: var(--purple-bright); }

/* ---------- background layers: ebru wash + twinkling stars ---------- */
.ebru-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ebru-swirl {
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  filter: url(#ebruTurbulence) blur(40px);
  opacity: 0.08;
  animation: driftEbru 60s ease-in-out infinite alternate;
}
@keyframes driftEbru {
  0%   { transform: translate(0,0) scale(1) rotate(0deg); }
  100% { transform: translate(-3%, 2%) scale(1.08) rotate(4deg); }
}
.ebru-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 10%, rgba(124,77,189,0.14), transparent 55%),
              radial-gradient(ellipse at 85% 75%, rgba(74,45,115,0.16), transparent 55%);
}

.star-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: var(--parchment);
  animation-name: twinkle, driftStar;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out, linear;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}
@keyframes driftStar {
  from { transform: translateY(0); }
  to   { transform: translateY(-40px); }
}

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 2;
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(124,77,189,0.28);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--parchment);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.wordmark.small { font-size: 1.2rem; margin: 0 0 0.5rem; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 0.5rem;
}
.eyebrow.dark { color: var(--purple-bright); }
.site-nav { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-mute);
  text-decoration: none;
  font-size: 0.92rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--parchment); border-color: var(--purple-bright); }
#authNavSlot a { color: var(--purple-bright); }
#authNavSlot { display: flex; align-items: center; }

main { position: relative; z-index: 1; }

/* ---------- hero (home) ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 3rem;
  align-items: center;
  padding: 5rem 1.75rem 4rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.12;
  color: var(--parchment);
  margin: 0 0 1.25rem;
}
.hero h1 em { color: var(--purple-bright); font-style: italic; }
.lede { font-size: 1.08rem; color: var(--text-soft); max-width: 46ch; margin: 0 0 2rem; }
.cta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--purple);
  padding: 0.85rem 1.6rem;
  border-radius: 2px;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s;
  border: none;
  cursor: pointer;
}
.cta:hover, .cta:focus-visible { background: var(--purple-bright); transform: translateY(-1px); }
.hero-seal { display: flex; justify-content: center; opacity: 0.9; }
.hero-seal svg { animation: rotateSeal 40s linear infinite; }
@keyframes rotateSeal { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---------- generic page hero (inner pages) ---------- */
.page-hero {
  padding: 4rem 1.75rem 2.5rem;
  max-width: 800px;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  color: var(--parchment);
  margin: 0 0 1rem;
}
.page-hero .lede { margin-bottom: 0; }

/* ---------- manuscript page (form) — now dark ---------- */
.tabir { padding: 2rem 1.75rem 3rem; }
.manuscript-page {
  position: relative;
  background: var(--ink-2);
  color: var(--text-soft);
  border: 1px solid rgba(124,77,189,0.3);
  border-radius: 3px;
  padding: 3rem 3rem 2.5rem;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.manuscript-page h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: var(--parchment);
}
.hint { color: var(--text-mute); font-size: 0.95rem; max-width: 60ch; }
.corner { position: absolute; width: 46px; height: 46px; opacity: 0.7; }
.corner-tl { top: 8px; left: 8px; }
.corner-tr { top: 8px; right: 8px; transform: scaleX(-1); }
.corner-bl { bottom: 8px; left: 8px; transform: scaleY(-1); }
.corner-br { bottom: 8px; right: 8px; transform: scale(-1,-1); }

#dreamForm { margin-top: 1.75rem; }
textarea, input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1.02rem;
  color: var(--text-soft);
  background: var(--ink-3);
  border: 1px solid rgba(124,77,189,0.35);
  border-left: 3px solid var(--purple);
  border-radius: 2px;
  padding: 1.1rem 1.25rem;
  resize: vertical;
  line-height: 1.65;
}
textarea::placeholder, input::placeholder { color: var(--text-mute); }
textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--purple-bright);
  outline-offset: 2px;
}
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.9rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.charcount { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-mute); }
#submitBtn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
#submitBtn:hover:not(:disabled) { background: var(--purple-bright); transform: translateY(-1px); }
#submitBtn:disabled { opacity: 0.55; cursor: progress; }

.result-box {
  margin-top: 2rem;
  padding: 2rem 2rem 2rem 3rem;
  background: var(--ink-3);
  border: 1px solid rgba(124,77,189,0.4);
  border-radius: 2px;
  position: relative;
  font-size: 1.02rem;
  animation: unfurl 0.5s ease both;
}
@keyframes unfurl {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.seal-mark {
  position: absolute;
  left: 1rem;
  top: 2rem;
  color: var(--purple-bright);
  font-size: 1.3rem;
}
.dream-art {
  width: 100%;
  max-width: 260px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.45);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-2);
}
.dream-art svg, .dream-art img { display: block; width: 100%; height: auto; }
.dream-art-loading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mute);
  padding: 1.5rem;
  text-align: center;
}
.art-caption {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-mute);
  font-family: var(--font-mono);
  margin: 0 0 1.5rem;
}
#resultText p { margin: 0 0 1em; }
#resultText p:last-child { margin-bottom: 0; }

.error-box {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(209,73,91,0.12);
  border-left: 3px solid var(--wine-bright);
  color: var(--wine-bright);
  font-size: 0.92rem;
  border-radius: 2px;
}

.disclaimer {
  font-size: 0.82rem;
  color: var(--text-mute);
  max-width: 70ch;
  margin: 1.5rem auto 0;
  text-align: center;
}

/* ---------- ad slot ---------- */
.ad-slot {
  margin: 2rem auto 0;
  max-width: 728px;
  min-height: 90px;
  border: 1px dashed rgba(124,77,189,0.4);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(255,255,255,0.02);
}
.ad-slot-label {
  position: absolute;
  top: 6px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* ---------- symbols ---------- */
.semboller { padding: 1rem 1.75rem 6rem; }
.semboller h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2rem;
  color: var(--parchment);
  margin: 0 0 1.75rem;
}
.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.symbol-card {
  text-align: left;
  background: var(--ink-2);
  border: 1px solid rgba(124,77,189,0.25);
  border-radius: 2px;
  padding: 1.15rem 1.25rem;
  cursor: pointer;
  color: var(--text-soft);
  font-family: var(--font-body);
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.symbol-card:hover, .symbol-card:focus-visible {
  border-color: var(--purple-bright);
  transform: translateY(-2px);
}
.symbol-name { font-family: var(--font-display); font-style: italic; font-size: 1.2rem; color: var(--purple-bright); }
.symbol-hint { font-size: 0.85rem; color: var(--text-mute); }

/* ---------- dictionary page ---------- */
.dict-page { padding: 1rem 1.75rem 4rem; }
.dict-category { margin-bottom: 3rem; }
.dict-category h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.6rem;
  color: var(--purple-bright);
  border-bottom: 1px solid rgba(124,77,189,0.3);
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
}
.dict-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.dict-item {
  background: var(--ink-2);
  border: 1px solid rgba(124,77,189,0.2);
  border-radius: 2px;
  padding: 1.5rem;
}
.dict-item h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--parchment);
  margin: 0 0 0.6rem;
}
.dict-item p { font-size: 0.94rem; color: var(--text-soft); margin: 0; }

.cta-band {
  text-align: center;
  padding: 3rem 1.75rem 5rem;
}
.cta-band h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.8rem;
  color: var(--parchment);
  max-width: 40ch;
  margin: 0 auto 1.5rem;
}

/* ---------- generic content pages (about, contact, kvkk) ---------- */
.content-page {
  padding: 0 1.75rem 5rem;
  max-width: 760px;
}
.content-page h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--purple-bright);
  margin: 2.2rem 0 0.8rem;
}
.content-page p, .content-page li { color: var(--text-soft); }
.content-page ul { padding-left: 1.2rem; }
.content-page li { margin-bottom: 0.5rem; }

.scholar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; margin: 1.5rem 0 2rem; }
.scholar-card {
  background: var(--ink-2);
  border: 1px solid rgba(124,77,189,0.22);
  border-radius: 2px;
  padding: 1.25rem 1.4rem;
}
.scholar-name { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--gold); display: block; margin-bottom: 0.4rem; }
.scholar-tag { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--purple-bright); display: block; margin-bottom: 0.5rem; }
.scholar-card p { font-size: 0.88rem; margin: 0; }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  max-width: 480px;
}
.contact-form label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple-bright);
  margin-bottom: -0.6rem;
}

/* ---------- auth (kaydol) page ---------- */
.auth-page { padding: 0 1.75rem 5rem; max-width: 440px; }
.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.auth-tab {
  flex: 1;
  background: var(--ink-2);
  border: 1px solid rgba(124,77,189,0.3);
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
}
.auth-tab.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.auth-form { display: none; flex-direction: column; gap: 1rem; }
.auth-form.active { display: flex; }
.auth-note {
  font-size: 0.82rem;
  color: var(--text-mute);
  background: var(--ink-2);
  border-left: 3px solid var(--purple);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  border-radius: 2px;
}
.auth-message { font-size: 0.88rem; margin-top: 1rem; }
.auth-message.error { color: var(--wine-bright); }
.auth-message.success { color: var(--purple-bright); }

/* ---------- history page ---------- */
.history-page { padding: 0 1.75rem 5rem; }
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.ghost-btn {
  background: transparent;
  border: 1px solid rgba(124,77,189,0.45);
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.ghost-btn:hover { border-color: var(--purple-bright); color: var(--purple-bright); }
.history-list { display: flex; flex-direction: column; gap: 1rem; }
.history-card {
  background: var(--ink-2);
  border: 1px solid rgba(124,77,189,0.22);
  border-radius: 2px;
  padding: 1.5rem;
}
.history-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.history-date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-mute); }
.history-dream { font-style: italic; color: var(--parchment); margin: 0 0 0.75rem; }
.history-interp { color: var(--text-soft); font-size: 0.94rem; }
.history-delete {
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-decoration: underline;
  padding: 0;
}
.history-delete:hover { color: var(--wine-bright); }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-mute);
}

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(124,77,189,0.28);
  padding: 3rem 0 2.5rem;
  font-size: 0.85rem;
  color: var(--text-mute);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-heading {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple-bright);
  margin: 0 0 0.3rem;
}
.footer-col a { color: var(--text-mute); text-decoration: none; }
.footer-col a:hover { color: var(--parchment); }
.footer-about { max-width: 32ch; }
.fine { font-family: var(--font-mono); font-size: 0.72rem; margin-top: 0.5rem; border-top: 1px solid rgba(124,77,189,0.18); padding-top: 1.5rem; }

/* ---------- responsive: tablet ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 3rem; gap: 2rem; }
  .hero-seal { order: -1; }
  .hero-seal svg { width: 130px; height: 130px; }
  .manuscript-page { padding: 2rem 1.5rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .dict-list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

/* ---------- responsive: mobile ---------- */
@media (max-width: 560px) {
  .wrap { padding: 0 1.15rem; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .site-nav { gap: 1rem; font-size: 0.85rem; width: 100%; justify-content: space-between; }
  .hero { padding: 2.5rem 1.15rem 2.5rem; }
  .hero h1 { font-size: 1.9rem; }
  .lede { font-size: 0.98rem; }
  .manuscript-page { padding: 1.5rem 1.1rem; }
  .manuscript-page h2 { font-size: 1.5rem; }
  .corner { width: 30px; height: 30px; }
  .result-box { padding: 1.5rem 1.25rem; }
  .seal-mark { left: 0.6rem; top: 1.5rem; }
  .form-row { flex-direction: column; align-items: stretch; }
  #submitBtn { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .symbol-grid { grid-template-columns: 1fr 1fr; }
  .dict-list { grid-template-columns: 1fr; }
  .scholar-grid { grid-template-columns: 1fr; }
  .cta { width: 100%; text-align: center; }
}
