/* Mirror Live: gece odası. Üstte durgun su (ayna), altta konuşma, en altta konuşma düğmesi.
   Renk ve ses aynanın okuduğu hâle göre değişir. Tek tema (gece). */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #0d1016; }
@property --glow { syntax: '<color>'; inherits: true; initial-value: #1c2433; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #a9b7d3; }

:root {
  --bg: #0d1016;
  --glow: #1c2433;
  --accent: #a9b7d3;
  --fg: #ebe7df;
  --muted: #a4a29b;
  --line: rgba(235, 231, 223, 0.13);
  --raise: rgba(235, 231, 223, 0.06);
  --help-bg: #2a2315;
  --help-fg: #f0dbab;
  --err: #f0b4a4;
  --font-mark: 'Alegreya SC', 'Alegreya', Georgia, serif;
  --font-voice: 'Alegreya', Georgia, 'Times New Roman', serif;
  --font-ui: 'Alegreya Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
  transition: --bg 3.5s ease, --glow 3.5s ease, --accent 3.5s ease;
}
html { height: 100%; box-sizing: border-box; background: var(--bg); }
*, *::before, *::after { box-sizing: inherit; }
body {
  height: 100%; margin: 0; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

.app {
  position: relative; height: 100%; max-width: 760px; margin: 0 auto;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: env(safe-area-inset-top, 0px);
}
.app::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -12%, var(--glow), transparent 66%),
    radial-gradient(90% 45% at 50% 118%, color-mix(in srgb, var(--glow) 60%, transparent), transparent 72%);
}

/* üst çubuk */
.bar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 4px; }
.mark { font-family: var(--font-mark); font-weight: 500; font-size: 1.5rem; letter-spacing: 0.16em; line-height: 1; }
.tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent); font-size: .84rem; letter-spacing: .05em; white-space: nowrap;
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--raise); cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.icon-btn[aria-pressed="false"] .wave { opacity: .25; }

/* oda */
.room { position: relative; z-index: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 14px; }
.water { display: block; width: 100%; height: clamp(150px, 30vh, 250px); transition: height .9s ease; }
.talking .water { height: clamp(130px, 24vh, 200px); }
.welcome { max-width: 34rem; margin: 0 auto; padding-block: 0 18px; display: grid; gap: 12px; text-align: center; }
.epigraph { margin: 0; font-family: var(--font-voice); font-style: italic; font-size: clamp(1.5rem, 5.6vw, 2rem); line-height: 1.2; text-wrap: balance; }
.attrib { margin: 0; font-size: .76rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.intro { margin: 6px 0 0; font-size: 1.04rem; line-height: 1.55; color: color-mix(in srgb, var(--fg) 88%, transparent); text-wrap: pretty; }
.hint { margin: 0; font-size: .9rem; color: var(--muted); }

/* yazılı konuşma */
.log { list-style: none; margin: 0 auto; padding: 4px 0 0; max-width: 40rem; display: grid; gap: 16px; }
.msg { min-width: 0; display: grid; gap: 4px; }
.who { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.you { justify-self: end; max-width: 86%; text-align: right; }
.you .bubble {
  text-align: left; padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.mirror { max-width: 36rem; }
.voice {
  font-family: var(--font-voice); font-size: 1.15rem; line-height: 1.62; overflow-wrap: anywhere;
  padding-left: 16px; border-left: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.msg.note { justify-self: center; text-align: center; font-size: .92rem; color: var(--muted); max-width: 30rem; }

/* konuşma düğmesi */
.dar { position: relative; z-index: 2; padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; justify-items: center; }
.code-row { width: 100%; max-width: 22rem; display: grid; gap: 6px; }
.code-row label { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: center; }
.code-row input {
  height: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, #000); font-size: 1.05rem; text-align: center; letter-spacing: .06em;
}
.code-row input:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.err { margin: 0; max-width: 26rem; text-align: center; color: var(--err); font-size: .92rem; }
.controls { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.talk {
  min-width: 11rem; height: 54px; padding: 0 28px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--bg); font-weight: 700; font-size: 1.08rem; letter-spacing: .04em;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
}
.talk:disabled { opacity: .55; cursor: default; }
.talk.live { background: transparent; color: var(--fg); border: 1px solid var(--line); font-weight: 500; min-width: 8rem; }
[data-mode="listening"] .talk.live { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }
.cut {
  height: 54px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent); font-weight: 500;
}
.status { margin: 0; min-height: 1.3em; text-align: center; font-size: .92rem; color: var(--accent); }
.timer { margin: 0; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.foot { margin: 0; text-align: center; font-size: .75rem; color: var(--muted); }

/* kriz kartı */
.help {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); top: calc(70px + env(safe-area-inset-top, 0px));
  max-height: calc(100% - 300px); overflow-y: auto;
  width: min(calc(100% - 32px), 30rem); padding: 16px 18px; border-radius: 16px;
  background: var(--help-bg); color: var(--help-fg); display: grid; gap: 6px; font-size: .98rem; line-height: 1.45;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.help strong { font-weight: 700; font-size: 1.04rem; }
.help .nums { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.help .num {
  display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--help-fg) 45%, transparent);
  color: var(--help-fg); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums;
}
.help .ghost-btn { justify-self: end; border-color: color-mix(in srgb, var(--help-fg) 35%, transparent); }

/* ayarlar */
.sheet-backdrop { position: fixed; inset: 0; z-index: 9; background: rgba(0, 0, 0, .5); }
.sheet {
  position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 520px); max-height: 86%; overflow-y: auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0;
  background: color-mix(in srgb, var(--bg) 80%, #1b1b1b);
  display: grid; gap: 16px;
}
@media (min-width: 720px) {
  .sheet { top: 64px; bottom: auto; left: auto; right: max(16px, calc(50% - 364px)); transform: none; width: 380px; border-radius: 18px; border-bottom: 1px solid var(--line); }
}
.sheet h2 { margin: 0; font-family: var(--font-mark); font-weight: 500; font-size: 1.15rem; letter-spacing: .12em; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.row label { cursor: pointer; }
.sub { display: block; font-size: .82rem; color: var(--muted); }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
.seg button { border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; cursor: pointer; font-size: .92rem; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 46px; height: 27px; margin: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--raise); cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--muted); transition: transform .2s ease, background .2s ease; }
.switch:checked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 32%, transparent); }
.switch:checked::after { transform: translateX(19px); background: var(--accent); }
input[type="range"] { width: 100%; margin: 0; accent-color: var(--accent); }
.wide-btn { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--raise); cursor: pointer; text-align: center; }
.ghost-btn { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: .92rem; }
.about { display: grid; gap: 8px; font-size: .92rem; line-height: 1.5; color: color-mix(in srgb, var(--fg) 85%, transparent); }
.about p { margin: 0; }

/* tanıtım */
.onboard {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto;
  display: grid; grid-template-rows: auto 1fr auto; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(120% 70% at 50% -10%, var(--glow), transparent 66%), var(--bg);
}
.ob-top, .ob-body, .ob-foot { width: 100%; max-width: 34rem; margin: 0 auto; }
.ob-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ob-body { align-self: center; display: grid; gap: 18px; }
.ob-title { margin: 0; font-family: var(--font-voice); font-style: italic; font-weight: 400; font-size: clamp(1.75rem, 6.6vw, 2.35rem); line-height: 1.15; text-wrap: balance; }
.ob-text p { margin: 0 0 .8em; font-size: 1.08rem; line-height: 1.6; color: color-mix(in srgb, var(--fg) 90%, transparent); }
.ob-text p:last-child { margin-bottom: 0; }
.ob-text .ob-q { font-family: var(--font-voice); font-size: clamp(1.4rem, 5.2vw, 1.75rem); line-height: 1.35; color: var(--fg); text-wrap: balance; }
.ob-foot { display: grid; gap: 14px; justify-items: center; }
.ob-dots { display: flex; gap: 8px; }
.ob-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.ob-dots span.on { background: var(--accent); }
.ob-next { width: 100%; max-width: 22rem; }
.ob-small { margin: 0; max-width: 28rem; font-size: .8rem; line-height: 1.45; color: var(--muted); text-align: center; }
.ob-body.fade { animation: obIn .45s ease; }
@keyframes obIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .water { transition: none; }
  .ob-body.fade { animation: none; }
  [data-mode="listening"] .talk.live { animation: none; }
}
