:root {
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --ink: rgba(226, 214, 194, 0.34);
  --ink-strong: rgba(240, 228, 206, 0.85);
  --shadow-text: #d4bfa2;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html,
body {
  margin: 0;
  height: 100%;
  background: #050505;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Uygulama kabuğu: klavye açılınca görünür alana (visualViewport) oturur, bkz. viewport.js */
#app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--app-height, 100dvh);
  box-sizing: border-box;
  padding-top: var(--safe-top);
  overflow: hidden;
}

canvas#c {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* A softly lit recess for words at the edge of the room. */
#dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px calc(26px + var(--safe-right)) calc(14px + var(--safe-bottom))
    calc(26px + var(--safe-left));
  background: linear-gradient(to top, #050505 8%, #050505eb 48%, #05050500);
  transition: opacity 1.2s;
  will-change: transform;
}
body.intro #dock {
  opacity: 0;
  pointer-events: none;
}
#dock {
  padding-bottom: calc(
    (14px + var(--safe-bottom)) * (1 - var(--keyboard-progress, 0)) + 8px *
      var(--keyboard-progress, 0)
  );
}
#composer {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
}
.composer-line {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 16px;
  background: #151817;
  border: 1px solid #a18c7133;
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 #e3cfaa0a,
    inset 0 -2px 8px #0003,
    0 6px 24px #0005;
}
#message {
  position: relative;
  display: block;
  flex: 1;
  width: 0;
  min-width: 0;
  height: 52px;
  box-sizing: border-box;
  padding: 0;
  font: 500 16px/1.3 var(--serif);
  color: #d5c8b0;
  caret-color: #a76553;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  touch-action: manipulation;
  user-select: text;
  -webkit-user-select: text;
}
#message::placeholder {
  color: #c1b59e;
  opacity: 1;
}
#message:focus-visible {
  outline: none;
}
.composer-line:focus-within {
  border-color: #b078617a;
  box-shadow:
    inset 0 1px 0 #e3cfaa0d,
    inset 0 -2px 8px #0003,
    0 6px 24px #0005;
}
.composer-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
#composer button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  padding: 11px;
  color: #b9ad98;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
}
#composer button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#composer #send {
  color: #bd7965;
}
#composer button[hidden] {
  display: none;
}
#composer button:hover:not(:disabled) {
  color: #f0dcc0;
  background: #b9ab8610;
}
#composer button:active:not(:disabled) {
  background: #b9ab861c;
}
#composer button:focus-visible {
  outline: 1px solid #b07861;
  outline-offset: -4px;
}
#composer button:disabled {
  opacity: 0.3;
  cursor: default;
}
#composer button[aria-pressed='true'] {
  color: #edb0a0;
  background: #a7655324;
}
@media (max-width: 360px) {
  #dock {
    padding-left: calc(18px + var(--safe-left));
    padding-right: calc(18px + var(--safe-right));
  }
  .composer-line {
    padding-left: 12px;
  }
}

#veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: rgba(232, 220, 200, 0.82);
  background: rgba(3, 3, 4, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s;
}
#veil.on {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}
#veil h2 {
  font-weight: 400;
  font-style: italic;
  font-size: 34px;
  margin: 0 0 14px;
}
#veil p {
  font-size: 17px;
  margin: 4px 0;
  color: rgba(232, 220, 200, 0.5);
  letter-spacing: 0.03em;
}

noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(226, 214, 194, 0.7);
  font-size: 20px;
}

@media (prefers-reduced-motion: reduce) {
  #veil,
  #dock,
  #composer button,
  .composer-line {
    transition: none;
  }
}

body.filming #dock,
body.filming #veil {
  display: none !important;
}

/* hata ayıklama: oda geçiş düğmeleri */
#debug-rooms {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: calc(8px + var(--safe-left));
  right: calc(8px + var(--safe-right));
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#debug-rooms[hidden] {
  display: none;
}
body.intro #debug-rooms {
  display: none;
}
#debug-rooms button {
  min-height: 32px;
  padding: 0 10px;
  font: 400 13px/1 var(--serif);
  color: var(--ink-strong);
  background: rgba(232, 220, 200, 0.08);
  border: 1px solid rgba(232, 220, 200, 0.18);
  border-radius: 16px;
  touch-action: manipulation;
}
#debug-rooms button[aria-pressed='true'] {
  background: rgba(232, 220, 200, 0.2);
  border-color: rgba(232, 220, 200, 0.5);
}

/* First contact with the actual Shadow, in the actual rooms. */
#onboarding {
  position: absolute;
  inset: 0;
  text-align: center;
  pointer-events: none;
  color: #c4b59c;
}
#onboarding[hidden],
#onboarding [hidden],
body.filming #onboarding {
  display: none;
}
#onboarding button {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  font-family: var(--serif);
  background: none;
  border: 0;
  color: inherit;
}
.encounter-footer {
  position: absolute;
  bottom: calc(22px + var(--safe-bottom));
  left: 26px;
  right: 26px;
}
/* One red thread gathers a thought above the live Shadow. */
.thread-thought {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 220px;
  max-width: calc(100% - 36px);
  box-sizing: border-box;
  padding: 18px 22px 20px;
  transform: translate(-50%, -100%);
  color: #d4bfa2;
  font:
    400 18px/1.22 'Caveat',
    'Bradley Hand',
    cursive;
  text-align: center;
}
.thread-thought p {
  position: relative;
  margin: 0;
  text-wrap: balance;
}
.thread-thought .thread-loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: calc(100% + 13px);
  fill: none;
  stroke: #a35b4c;
  stroke-width: 1.1;
  pointer-events: none;
}
.thread-thought .thread-loop path {
  vector-effect: non-scaling-stroke;
}
.thread-thought .thread-shade {
  fill: #090b0bd9;
  stroke: none;
}
.thread-thought .thread-fiber {
  stroke-width: 0.45;
  stroke: #b17c67;
  opacity: 0.5;
}
#onboarding #onboarding-next {
  min-height: 44px;
  padding: 8px 20px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #d0bea0;
  font-size: 22px;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}
#onboarding #onboarding-next:hover {
  color: #e2cfab;
}
.encounter-footer nav {
  display: flex;
  justify-content: center;
  max-width: 480px;
  margin: 28px auto 0;
}
.encounter-footer nav button {
  min-height: 44px;
  font-size: 14px;
  font-style: italic;
  color: #968a77;
}
#onboarding #onboarding-skip {
  margin-inline: auto;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: #c1af90;
  font-size: 17px;
  font-style: normal;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}
#onboarding #onboarding-skip[hidden] {
  display: none;
}
#onboarding #onboarding-skip:hover {
  color: #e2cfab;
}
.encounter-footer nav {
  margin-top: 4px;
}
#onboarding button:focus-visible {
  outline: 1px solid #b39c76;
  outline-offset: 5px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-height: 650px) {
  .encounter-footer {
    bottom: calc(8px + var(--safe-bottom));
  }
  .encounter-footer nav {
    margin-top: 10px;
  }
  .thread-thought {
    padding: 16px 20px 18px;
    font-size: 18px;
  }
  #onboarding-next {
    font-size: 23px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #onboarding #onboarding-next,
  #onboarding #onboarding-skip,
  #composer {
    transition: none;
  }
}

.thread-thought[hidden],
#shadow-pending[hidden] {
  display: none;
}
#shadow-speech,
#shadow-pending {
  width: max-content;
  min-width: 0;
  max-width: min(320px, calc(100% - 36px));
  padding: 26px 28px 14px;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.32;
  transform-origin: 50% 100%;
  z-index: 2;
  pointer-events: none;
}
#shadow-pending {
  display: grid;
  place-items: center;
  width: 64px;
  height: 40px;
  padding: 10px 0 0;
  z-index: 1;
}
#shadow-pending p {
  font-size: 0;
  line-height: 0;
}
#shadow-speech p,
#shadow-pending p {
  color: var(--shadow-text);
}
#shadow-pending p::before {
  content: '';
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--shadow-text);
  box-shadow:
    -8px 0 var(--shadow-text),
    8px 0 var(--shadow-text);
}
#shadow-speech p {
  overflow-wrap: anywhere;
}
body.filming #shadow-speech,
body.intro #shadow-speech,
body.session-failed #shadow-speech,
body.filming #shadow-pending,
body.intro #shadow-pending,
body.session-failed #shadow-pending {
  display: none;
}

#runtime-reopen,
#runtime-recover {
  color: inherit;
  font: inherit;
  background: transparent;
  border: 1px solid rgba(232, 220, 200, 0.3);
  border-radius: 3px;
  padding: 10px 18px;
  margin-top: 20px;
  cursor: pointer;
}

/* Quiet inscriptions at the edge of the same live room. */
.quiet-purchase {
  min-height: 44px;
  color: #d1bda2;
  font: 18px/1.35 var(--serif);
  background: transparent;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
  touch-action: manipulation;
}
.quiet-purchase:focus-visible {
  outline: 1px solid #c2937c;
  outline-offset: 3px;
}
.quiet-purchase:disabled {
  opacity: 0.5;
  cursor: default;
}
.quiet-purchase[hidden] {
  display: none;
}
#purchase-open {
  display: block;
  margin: 0 auto;
  font-size: 15px;
}
#purchase-open[hidden] {
  display: none;
}
#purchase-dialog,
#memory-dialog,
#settings-dialog {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: calc(24px + var(--safe-top)) calc(28px + var(--safe-right))
    calc(28px + var(--safe-bottom)) calc(28px + var(--safe-left));
  border: 0;
  color: #e0cfb5;
  background: linear-gradient(90deg, #050505ed, #050505ac 60%, #0505056b);
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
#purchase-dialog::backdrop,
#memory-dialog::backdrop,
#settings-dialog::backdrop {
  background: #0505054a;
}
.purchase-recess {
  max-width: 420px;
  margin: 0 auto;
  padding-left: 18px;
  border-left: 1px solid #8b453b;
}
#purchase-heading,
#memory-heading,
#settings-heading {
  font-size: 36px;
  font-weight: 400;
  font-style: italic;
  margin: 26px 0 18px;
}
#purchase-status,
#runtime-status,
#memory-status,
.purchase-terms,
.purchase-memory,
#purchase-products p {
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#purchase-status:empty {
  display: none;
}
#purchase-products section {
  margin: 26px 0;
}
#purchase-products h3 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
#purchase-products p {
  margin: 0 0 8px;
}
.purchase-price {
  padding-left: 0;
  text-align: left;
  color: #edb5a0;
  overflow-wrap: anywhere;
}
#purchase-restore,
#purchase-refresh,
#purchase-retry {
  display: block;
  padding-left: 0;
  text-align: left;
}
#purchase-retry[hidden] {
  display: none;
}
.purchase-memory {
  margin-top: 26px;
  color: #bdaf9a;
}

body.intro #purchase-open {
  visibility: hidden;
}

#memory-open {
  padding-left: 0;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.composer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 522px;
  margin: 0 auto;
}
.composer-row #composer {
  flex: 1;
  min-width: 0;
  margin: 0;
}
#settings-open {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 58px;
  padding: 0;
  color: #b9ad98;
  background: #151817;
  border: 1px solid #a18c7133;
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 #e3cfaa0a,
    inset 0 -2px 8px #0003,
    0 6px 24px #0005;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    border-color 180ms,
    color 180ms;
}
#settings-open svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#settings-open:hover,
#settings-open[aria-expanded='true'] {
  border-color: #b078617a;
  color: #f0dcc0;
}
#settings-open:focus-visible {
  outline: 1px solid #c2937c;
  outline-offset: 4px;
}
#settings-dialog {
  background: linear-gradient(100deg, #090b0bf5, #090b0bcc 75%, #090b0b88);
}
#settings-dialog.memory-covered {
  visibility: hidden;
}
#settings-heading,
#memory-heading {
  margin-top: 0;
}
#settings-dialog .purchase-recess,
#memory-dialog .purchase-recess {
  padding-left: 0;
  border-left: 0;
}
#settings-dialog .purchase-recess::before,
#memory-dialog .purchase-recess::before {
  content: '';
  display: block;
  height: 1px;
  width: 32px;
  margin-bottom: 24px;
  background: #a6574b;
}
#settings-heading,
#memory-heading {
  font-size: 29px;
  line-height: 1.25;
  margin-bottom: 33px;
  outline: none;
}
.settings-language-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.settings-section h3 {
  color: #aca18d;
  font: 400 18px/1.4 var(--serif);
  margin: 0;
}
.settings-memory-section {
  margin-top: 28px;
}
#settings-memory-note {
  color: #c0b6a3;
  font: 14px/1.5 var(--serif);
  margin: 0 0 6px;
}
#settings-dialog .quiet-purchase,
#memory-dialog .quiet-purchase {
  box-sizing: border-box;
  min-height: 52px;
  padding: 14px 18px;
  background: #292d29;
  color: #ede1cd;
  border: 1px solid #76776a;
  border-top-color: #919183;
  border-bottom-color: #42463e;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 #d8d0ba0a,
    0 3px 0 #040504;
  font: 18px/1.4 var(--serif);
  text-align: center;
  transition:
    background 100ms,
    transform 100ms,
    box-shadow 100ms;
}
#settings-dialog .quiet-purchase:active,
#memory-dialog .quiet-purchase:active {
  background: #3c4239;
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 4px #0008,
    0 1px 0 #040504;
}
#settings-dialog .quiet-purchase:focus:not(:focus-visible),
#memory-dialog .quiet-purchase:focus:not(:focus-visible),
#settings-language:focus:not(:focus-visible) {
  outline: none;
}
#settings-dialog .quiet-purchase:focus-visible,
#memory-dialog .quiet-purchase:focus-visible,
#settings-language:focus-visible {
  outline: 2px solid #d8bc98;
  outline-offset: 4px;
}
#memory-open,
#settings-close,
#memory-dialog .quiet-purchase {
  display: block;
  width: 100%;
  margin: 0;
  text-decoration: none;
}
#settings-dialog #settings-close {
  margin-top: 34px;
  background: #181c18;
  border-color: #4d5549;
  color: #d3c8b5;
}
#memory-dialog h3 {
  font: 18px/1.3 var(--serif);
  margin: 20px 0 7px;
}
#memory-dialog .purchase-memory {
  color: #aca18d;
  font: 15px/1.5 var(--serif);
  margin: 0 0 18px;
}
#memory-dialog .quiet-purchase {
  margin: 12px 0;
}
#memory-dialog #memory-confirm {
  background: #35231f;
  border-color: #956c5e;
  color: #edc2ac;
}
body.session-failed #dock {
  z-index: 3;
  opacity: 1;
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  #settings-open {
    transition: none;
  }
}

#launch-transition {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #111110;
  touch-action: none;
}
#launch-transition img {
  width: 192px;
  height: 192px;
  object-fit: contain;
  transform-origin: 50% 45%;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  #settings-language,
  #settings-dialog .quiet-purchase,
  #memory-dialog .quiet-purchase {
    transition: none;
  }
}

#memory-dialog .quiet-purchase[hidden],
#settings-dialog .quiet-purchase[hidden] {
  display: none;
}

#settings-language-picker {
  position: relative;
  width: 170px;
}
#settings-language,
#settings-language-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  color: #e0cfb5;
  background: #101311;
  border: 1px solid #a18c7133;
  border-radius: 3px;
  font: 400 20px/1.3 var(--serif);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
#settings-language svg {
  width: 12px;
  height: 8px;
  fill: none;
  stroke: #bdae96;
  stroke-width: 1.4;
}
#settings-language[aria-expanded='true'] svg {
  transform: rotate(180deg);
}
#settings-language-options {
  position: absolute;
  z-index: 1;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  padding: 4px;
  box-sizing: border-box;
  background: #0b0e0c;
  border: 1px solid #a18c714d;
  border-radius: 4px;
  box-shadow: 0 14px 30px #0009;
}
#settings-language-options[hidden] {
  display: none;
}
#settings-language-options button {
  border: 0;
  background: transparent;
}
#settings-language-options button[aria-selected='true']::after {
  content: '';
  width: 5px;
  height: 5px;
  background: #bd7965;
  border-radius: 50%;
}
#settings-language-options button:hover,
#settings-language-options button:focus-visible {
  color: #fff0d6;
  background: #1d211e;
  outline: 1px solid #b078617a;
  outline-offset: -1px;
}
