/* ============================================================
   THE GARDEN OF OTHER MINDS — visual design
   Contemplative, painterly, restrained. Warm dark chrome,
   serif type, letterspaced small caps. Mobile-first.
   ============================================================ */

:root {
  --ink: #191b1f;
  --ink2: #23262c;
  --paper: #e8e2d4;
  --paper-dim: #b9b2a2;
  --gold: #9c8a63;
  --serif: Georgia, 'Times New Roman', 'Songti SC', serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14161a; }
body { font-family: var(--serif); color: var(--paper); }

#gdScene { position: fixed; inset: 0; }
#gdScene canvas { display: block; touch-action: none; }

/* ---------------- loading card ---------------- */
.gd-card {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 28px;
  background: radial-gradient(120% 90% at 50% 30%, #23262d 0%, #14161a 68%);
  transition: opacity 1.1s ease, visibility 1.1s;
}
.gd-card.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.gd-card img {
  width: min(58vw, 330px); aspect-ratio: 1; object-fit: cover;
  border: 6px solid #2b2419; outline: 1px solid #4c4433;
  box-shadow: 0 26px 70px rgba(0,0,0,.6);
  opacity: 0; transition: opacity 1.2s ease .15s;
}
.gd-card.ready img { opacity: 1; }
.gd-card-k {
  margin: 4px 0 0; font-size: 11px; letter-spacing: .42em; color: var(--gold);
  text-transform: uppercase;
}
.gd-card h1 {
  margin: 0; font-weight: 500; font-size: clamp(24px, 5.6vw, 38px);
  letter-spacing: .14em; text-align: center; font-variant: small-caps;
  opacity: 0; transition: opacity 1.2s ease .35s;
}
.gd-card.ready h1 { opacity: 1; }
.gd-card-inv {
  margin: 0; font-style: italic; color: var(--paper-dim);
  font-size: clamp(14px, 3.6vw, 17px); text-align: center; max-width: 420px;
  opacity: 0; transition: opacity 1.2s ease .55s;
}
.gd-card.ready .gd-card-inv { opacity: 1; }
.gd-card .gd-btn { opacity: 0; transition: opacity 1.2s ease .8s; }
.gd-card.ready .gd-btn { opacity: 1; }

.gd-btn {
  appearance: none; border: 1px solid #6b6353; background: transparent;
  color: var(--paper); font-family: var(--serif); font-variant: small-caps;
  letter-spacing: .22em; font-size: 15px; padding: 13px 34px; cursor: pointer;
  transition: background .3s, color .3s;
}
.gd-btn:hover, .gd-btn:active { background: #6b6353; color: #14161a; }

.gd-card-note { font-size: 12px; color: #6d675a; font-style: italic; margin-top: 6px; }

/* ---------------- HUD ---------------- */
.gd-hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(16,17,20,.82), rgba(16,17,20,0));
  pointer-events: none;
}
.gd-hud > * { pointer-events: auto; }
.gd-title { font-size: 11px; letter-spacing: .3em; color: var(--paper-dim); }
.gd-title a { color: var(--paper-dim); text-decoration: none; }
.gd-title a:hover { color: var(--paper); }
.gd-title span { margin: 0 8px; color: #57534a; }
.gd-title b { font-weight: 500; color: var(--paper); }
.gd-hud-right { display: flex; gap: 8px; }
.gd-chip {
  appearance: none; border: 1px solid rgba(155,138,99,.45); background: rgba(20,22,26,.55);
  color: var(--paper-dim); font-family: var(--serif); font-size: 11px;
  letter-spacing: .14em; padding: 7px 12px; cursor: pointer; text-decoration: none;
  border-radius: 2px; backdrop-filter: blur(4px);
}
.gd-chip:hover { color: var(--paper); border-color: var(--gold); }

/* ---------------- hint / prompt ---------------- */
.gd-hint {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 15; padding: 10px 18px; max-width: 88vw; text-align: center;
  background: rgba(20,22,26,.66); border: 1px solid rgba(155,138,99,.3);
  border-radius: 30px; font-size: 12.5px; font-style: italic; color: var(--paper-dim);
  opacity: 0; transition: opacity .8s; pointer-events: none;
}
.gd-hint.show { opacity: 1; }

.gd-prompt {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%) translateY(8px);
  z-index: 16; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 26px; cursor: pointer;
  background: rgba(24,26,31,.82); border: 1px solid rgba(155,138,99,.55);
  border-radius: 3px; color: var(--paper); font-family: var(--serif);
  opacity: 0; transition: opacity .45s, transform .45s; pointer-events: none;
  backdrop-filter: blur(6px);
}
.gd-prompt.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.gd-prompt span { font-variant: small-caps; letter-spacing: .18em; font-size: 15px; }
.gd-prompt em { font-size: 11.5px; color: var(--gold); letter-spacing: .1em; }

/* virtual joystick */
.gd-joy {
  position: fixed; z-index: 14; width: 120px; height: 120px; border-radius: 50%;
  border: 1px solid rgba(232,226,212,.25); background: rgba(20,22,26,.25);
  display: none; pointer-events: none;
}
.gd-joy.show { display: block; }
.gd-joy-nub {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px;
  margin: -23px 0 0 -23px; border-radius: 50%;
  background: rgba(232,226,212,.28); border: 1px solid rgba(232,226,212,.4);
}

/* ---------------- conversation panel ---------------- */
.gd-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: min(58vh, 560px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(26,28,34,.93), rgba(18,20,24,.97));
  border-top: 1px solid rgba(155,138,99,.4);
  transform: translateY(102%); transition: transform .55s cubic-bezier(.2,.8,.2,1);
  backdrop-filter: blur(10px);
}
.gd-panel.open { transform: translateY(0); }
.gd-panel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 18px 10px; border-bottom: 1px solid rgba(155,138,99,.18);
}
.gd-panel-head b { font-variant: small-caps; letter-spacing: .16em; font-weight: 500; font-size: 17px; display: block; }
.gd-panel-head i { display: block; margin-top: 3px; font-size: 11.5px; color: var(--paper-dim); max-width: 62vw; }
.gd-leave {
  appearance: none; background: none; border: 1px solid rgba(155,138,99,.4);
  color: var(--paper-dim); font-family: var(--serif); font-variant: small-caps;
  letter-spacing: .16em; font-size: 12px; padding: 7px 14px; cursor: pointer;
}
.gd-leave:hover { color: var(--paper); border-color: var(--gold); }

.gd-transcript {
  flex: 1; overflow-y: auto; padding: 14px 16px 6px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: #4c4433 transparent;
}
.gd-bubble {
  max-width: 84%; padding: 10px 14px; font-size: 15px; line-height: 1.5;
  border-radius: 2px; animation: gd-rise .5s ease both;
}
@keyframes gd-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.gd-them { align-self: flex-start; background: rgba(232,226,212,.07); border-left: 2px solid var(--gold); }
.gd-you { align-self: flex-end; background: rgba(156,138,99,.16); border-right: 2px solid #6b6353; font-style: italic; }
.gd-speaker {
  display: block; font-variant: small-caps; letter-spacing: .14em;
  font-size: 10.5px; color: var(--gold); margin-bottom: 3px;
}
.gd-think { align-self: flex-start; font-style: italic; color: #7d7768; font-size: 13px; padding: 4px 2px; animation: gd-breathe 1.6s ease-in-out infinite; }
@keyframes gd-breathe { 50% { opacity: .45; } }

.gd-inputrow {
  display: flex; gap: 8px; padding: 10px 14px 6px;
  border-top: 1px solid rgba(155,138,99,.18);
}
.gd-inputrow input {
  flex: 1; appearance: none; border: 1px solid rgba(155,138,99,.35);
  background: rgba(16,17,20,.6); color: var(--paper);
  font-family: var(--serif); font-size: 16px; font-style: italic;
  padding: 12px 14px; border-radius: 2px; outline: none;
}
.gd-inputrow input:focus { border-color: var(--gold); }
.gd-inputrow input::placeholder { color: #6d675a; }
.gd-send, .gd-mic {
  appearance: none; border: 1px solid rgba(155,138,99,.4); background: none;
  color: var(--paper); font-size: 17px; width: 46px; cursor: pointer; border-radius: 2px;
}
.gd-mic { color: var(--paper-dim); }
.gd-mic.on { color: #c96a5a; border-color: #c96a5a; animation: gd-breathe 1.4s infinite; }
.gd-send:hover, .gd-mic:hover { border-color: var(--gold); color: var(--gold); }
.gd-silnote {
  text-align: center; font-size: 10.5px; font-style: italic;
  color: #5d584c; padding: 4px 10px calc(8px + env(safe-area-inset-bottom));
}

/* ---------------- dormant / fallback ---------------- */
.gd-dormant, .gd-fallback { position: fixed; inset: 0; z-index: 35; }
.gd-dormant {
  display: flex; align-items: center; justify-content: center; padding: 30px;
  background: radial-gradient(120% 90% at 50% 30%, #23262d 0%, #14161a 68%);
}
.gd-dormant-card { max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.gd-dormant-k { font-size: 12px; letter-spacing: .4em; color: var(--gold); margin: 0; }
.gd-dormant-card p { margin: 0; font-size: 16px; font-style: italic; color: var(--paper-dim); line-height: 1.6; }
.gd-dormant-sub { font-size: 13px !important; color: #6d675a !important; }
.gd-dormant-card .gd-btn { margin-top: 14px; align-self: center; text-decoration: none; }

.gd-fallback { background: #14161a; }
.gd-fb-art {
  position: absolute; inset: 0; background-size: cover; background-position: center 30%;
  filter: brightness(.55) saturate(.85);
}
.gd-fb-list {
  position: absolute; left: 0; right: 0; bottom: 24px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0 16px;
}
.gd-fb-char {
  appearance: none; border: 1px solid rgba(232,226,212,.35); background: rgba(20,22,26,.72);
  color: var(--paper); font-family: var(--serif); font-variant: small-caps;
  letter-spacing: .14em; font-size: 13px; padding: 10px 16px; cursor: pointer;
}

/* larger screens */
@media (min-width: 900px) {
  .gd-panel { left: auto; width: 520px; border-left: 1px solid rgba(155,138,99,.4); }
  .gd-prompt { bottom: 40px; }
  .gd-hint { bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .gd-bubble { animation: none; }
  .gd-card, .gd-card img, .gd-card h1 { transition-duration: .01s; }
}

/* the signposts' riddles */
.gd-riddle { position: fixed; left: 50%; bottom: 76px; transform: translate(-50%, 16px); width: min(440px, 92vw); z-index: 32;
  opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s ease;
  background: rgba(18, 20, 26, .86); backdrop-filter: blur(10px);
  border: 1px solid rgba(232, 226, 212, .16); border-radius: 14px; padding: 10px 16px 14px; color: #e8e2d4; }
.gd-riddle.open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.gd-riddle-q { font-style: italic; font-size: 14.5px; line-height: 1.6; text-align: center; margin: 10px 0 12px; white-space: pre-line; }
.gd-riddle-opts { display: flex; flex-direction: column; gap: 8px; }
.gd-riddle-opts button { font-family: inherit; font-size: 13px; letter-spacing: .04em; padding: 9px 12px;
  border-radius: 100px; border: 1px solid rgba(232, 226, 212, .28); background: transparent; color: inherit; cursor: pointer;
  transition: background .25s, border-color .25s, opacity .25s; }
.gd-riddle-opts button:hover { background: rgba(232, 226, 212, .12); }
.gd-riddle-opts button.right { border-color: #9fb86b; background: rgba(159, 184, 107, .15); }
.gd-riddle-opts button.wrong { border-color: #b86b6b; opacity: .45; }
.gd-riddle-msg { min-height: 18px; font-size: 12px; font-style: italic; color: #b8b0a0; text-align: center; margin-top: 8px; }

/* ---------------- the library reader ---------------- */
.gd-reader { position: fixed; inset: 0; z-index: 34; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 15, .58); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.gd-reader.open { opacity: 1; pointer-events: auto; }
.gd-reader-card { width: min(760px, 94vw); max-height: 84vh; display: flex; flex-direction: column;
  background: rgba(18, 20, 26, .92); border: 1px solid rgba(232, 226, 212, .18); border-radius: 16px;
  padding: 14px 26px 20px; color: #e8e2d4; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  transform: translateY(14px); transition: transform .4s ease; }
.gd-reader.open .gd-reader-card { transform: translateY(0); }
.gd-reader-card h2 { font: small-caps 600 25px/1.25 Georgia, serif; letter-spacing: .05em; margin: 6px 0 2px; text-align: center; }
.gd-reader-meta { font: italic 400 12.5px Georgia, serif; letter-spacing: .12em; color: #b8b0a0; text-align: center; margin: 0 0 12px; }
.gd-reader-body { overflow-y: auto; padding: 2px 8px 8px; border-top: 1px solid rgba(232, 226, 212, .12);
  scrollbar-width: thin; scrollbar-color: rgba(232, 226, 212, .3) transparent; }
.gd-reader-body p { font: 400 15.5px/1.68 Georgia, serif; margin: 12px 0 0; text-align: left; }
.gd-reader-body p:first-child { margin-top: 14px; }
.gd-reader-tools { display: flex; justify-content: center; gap: 8px; margin: 0 0 12px; }
.gd-reader-tools button { background: none; border: 1px solid rgba(232, 226, 212, .2); border-radius: 999px;
  color: #b8b0a0; font: small-caps 600 12px Georgia, serif; letter-spacing: .14em;
  padding: 5px 14px; cursor: pointer; transition: color .25s, border-color .25s; }
.gd-reader-tools button:hover, .gd-reader-tools button:focus-visible { color: #e8e2d4; border-color: rgba(232, 226, 212, .45); }
.gd-reader:fullscreen { background: #12141a; backdrop-filter: none; }
.gd-reader:fullscreen .gd-reader-card { width: min(860px, 96vw); max-height: 94vh; }
.gd-lift { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center;
  flex-direction: column; background: rgba(5, 5, 8, 0); transition: background .95s ease;
  pointer-events: none; }   /* the veil never swallows a tap on the car's own buttons */
.gd-lift.show { display: flex; }
.gd-lift.dark { background: rgba(5, 5, 8, .985); }
.gd-lift-floor { font: 300 92px Helvetica, Arial, sans-serif; color: #ffd98a; letter-spacing: .04em; }
.gd-lift-cap { margin-top: 18px; font: small-caps 600 14px Georgia, serif; letter-spacing: .22em; color: #b8b0a0; }
.gd-lift-opts { margin-top: 26px; display: flex; gap: 14px; }
.gd-lift-opts[hidden] { display: none; }
.gd-lift-opts button { pointer-events: auto; background: rgba(20, 22, 28, .82); border: 1px solid rgba(255, 217, 138, .4);
  border-radius: 999px; color: #ffe9c4; font: small-caps 600 15px Georgia, serif; letter-spacing: .14em;
  padding: 10px 22px; cursor: pointer; transition: background .25s ease, border-color .25s ease; }
.gd-lift-opts button:hover, .gd-lift-opts button:focus-visible { background: rgba(255, 217, 138, .16); border-color: rgba(255, 217, 138, .75); }
.gd-toast { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 12px); z-index: 60;
  background: rgba(18, 20, 26, .94); border: 1px solid rgba(232, 226, 212, .22); border-radius: 999px;
  color: #e8e2d4; font: italic 400 13.5px Georgia, serif; letter-spacing: .06em;
  padding: 9px 20px; opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s ease; }
.gd-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- the library index ---------------- */
.gd-index { position: fixed; inset: 0; z-index: 33; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 15, .58); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.gd-index.open { opacity: 1; pointer-events: auto; }
.gd-index-card { width: min(680px, 94vw); max-height: 82vh; display: flex; flex-direction: column;
  background: rgba(18, 20, 26, .92); border: 1px solid rgba(232, 226, 212, .18); border-radius: 16px;
  padding: 12px 18px 16px; color: #e8e2d4; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  transform: translateY(14px); transition: transform .4s ease; }
.gd-index.open .gd-index-card { transform: translateY(0); }
.gd-index-body { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(232, 226, 212, .3) transparent; }
.gd-index-group { margin-top: 10px; }
.gd-index-subj { font: small-caps 600 14px Georgia, serif; letter-spacing: .16em; color: #b8b0a0;
  margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.gd-index-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.gd-index-count { font: italic 400 12px Georgia, serif; letter-spacing: .1em; color: #97907f; margin-left: 10px; }
.gd-index-sn { font: italic 400 11.5px Georgia, serif; color: #97907f; letter-spacing: .08em; }
.gd-index-n { flex: 0 0 2.1em; font: italic 400 11.5px Georgia, serif; color: #97907f; text-align: right; }
.gd-index-t { flex: 1; }
.gd-index-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(232, 226, 212, .07);
  padding: 7px 4px; color: #e8e2d4; font: 400 14.5px Georgia, serif; cursor: pointer; }
.gd-index-row:hover, .gd-index-row:focus-visible { background: rgba(232, 226, 212, .07); border-radius: 6px; }
.gd-index-m { font: italic 400 11.5px Georgia, serif; color: #97907f; white-space: nowrap; }

/* ---------------- the work, fullscreen ---------------- */
.gd-work { position: fixed; inset: 0; z-index: 46; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 14, 0); pointer-events: none; transition: background .45s ease; }
.gd-work.show { background: rgba(10, 11, 14, .93); pointer-events: auto; }
.gd-work-inner { display: flex; gap: 64px; align-items: center; justify-content: center; width: min(1280px, 96vw); max-height: 92vh;
  opacity: 0; transform: translateY(16px) scale(.985); transition: opacity .45s ease, transform .45s ease; }
.gd-work.show .gd-work-inner { opacity: 1; transform: none; }
.gd-work-imgwrap { flex: 0 1 auto; display: flex; align-items: center; justify-content: center; min-width: 0; }
.gd-work-imgwrap img { max-width: 44vw; max-height: 80vh; object-fit: contain;
  box-shadow: 0 0 0 10px #453a2e, 0 30px 90px rgba(0, 0, 0, .65); background: #111; }
.gd-work-text { flex: 0 1 430px; max-width: 430px; color: #e8e2d4; }
.gd-work-text h3 { font: italic 600 26px Georgia, serif; margin: 0 0 6px; letter-spacing: .01em; }
.gd-work-meta { font: 400 13px Georgia, serif; color: #97907f; letter-spacing: .06em; margin-bottom: 16px; }
.gd-work-text p { font: 400 15px/1.65 Georgia, serif; color: #cfc8b8; margin: 0 0 22px;
  max-height: 34vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(232,226,212,.3) transparent; }
/* ask the docent */
.gd-work-qa { margin: 0 0 22px; border-top: 1px solid rgba(232, 226, 212, .14); padding-top: 16px; }
.gd-work-ask { display: flex; gap: 10px; }
.gd-work-ask input { flex: 1; background: rgba(232, 226, 212, .06); border: 1px solid rgba(232, 226, 212, .18);
  border-radius: 999px; padding: 9px 16px; color: #e8e2d4; font: italic 400 13.5px Georgia, serif; outline: none; }
.gd-work-ask input:focus { border-color: rgba(232, 226, 212, .4); background: rgba(232, 226, 212, .1); }
.gd-work-ask input::placeholder { color: rgba(232, 226, 212, .38); }
.gd-work-ask button { background: none; border: 1px solid rgba(232, 226, 212, .3); border-radius: 999px;
  color: #e8e2d4; font: italic 400 13.5px Georgia, serif; letter-spacing: .06em; padding: 9px 18px; cursor: pointer; }
.gd-work-ask button:hover { background: rgba(232, 226, 212, .1); }
.gd-work-answer { display: none; font: italic 400 14px/1.6 Georgia, serif; color: #b9b2a2; margin: 0 0 12px; }
.gd-work-answer.show { display: block; }
.gd-work-answer.thinking { opacity: .55; }
.gd-work-close { background: none; border: 1px solid rgba(232, 226, 212, .3); border-radius: 999px;
  color: #e8e2d4; font: italic 400 13.5px Georgia, serif; letter-spacing: .08em; padding: 9px 20px; cursor: pointer; }
.gd-work-close:hover, .gd-work-close:focus-visible { background: rgba(232, 226, 212, .1); }
@media (max-width: 760px) {
  .gd-work-inner { flex-direction: column; gap: 18px; overflow-y: auto; padding: 20px 0; }
  .gd-work-imgwrap img { max-width: 88vw; max-height: 44vh; }
  .gd-work-text { max-width: 88vw; }
  .gd-work-text p { max-height: none; overflow: visible; }
}

/* acquisition — a quiet tab, the price behind it */
.gd-work-price { margin: 0 0 22px; border-top: 1px solid rgba(232, 226, 212, .14); padding-top: 14px; }
.gd-work-acq { background: none; border: none; padding: 0; cursor: pointer;
  color: #97907f; font: italic 400 13px Georgia, serif; letter-spacing: .1em; }
.gd-work-acq:hover { color: #cfc8b8; }
.gd-work-acq::before { content: '· '; }
.gd-work-acq-panel { margin-top: 12px; }
.gd-work-acq-panel[hidden] { display: none; }
.gd-work-acq-price { font: 400 24px Georgia, serif; color: #e8e2d4; letter-spacing: .02em; }
.gd-work-acq-taxes { font: italic 400 12.5px Georgia, serif; color: #97907f; margin: 4px 0 12px; }
.gd-work-acq-poppy { font: 400 13.5px/1.6 Georgia, serif; color: #b9b2a2; }
.gd-work-acq-poppy a { color: #e8e2d4; border-bottom: 1px solid rgba(232, 226, 212, .4); text-decoration: none; }
.gd-work-acq-poppy a:hover { border-bottom-color: #e8e2d4; }
