/* Jett's Universe — shared stylesheet
   Dusk-lit, hand-drawn-feeling, warm. No external dependencies. */

:root {
  --night: #0d1026;
  --night-2: #171a38;
  --dusk-purple: #3b2a5e;
  --horizon: #e8794a;
  --horizon-soft: #f2a65a;
  --lamp: #ffc46b;
  --ink: #f3e9d2;
  --ink-dim: #c9bda3;
  --wood: #6b4a2f;
  --wood-dark: #4a3220;
  --paper: #f5ead3;
  --paper-dim: #e8dcc0;
  --moss: #7a8b5c;
  --sketch: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --sketch-2: 15px 225px 15px 255px / 255px 15px 225px 15px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--night);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #23264d 0%, transparent 60%),
    linear-gradient(180deg, #0d1026 0%, #1a1440 55%, #2b1a4a 100%);
}

a { color: var(--lamp); }

/* ---------- shared chrome ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
}
.brand:hover { color: var(--lamp); }

.back-link {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px dashed var(--ink-dim);
  border-radius: var(--sketch);
  padding: 0.4rem 0.9rem;
  transform: rotate(-0.5deg);
}
.back-link:hover { color: var(--lamp); border-color: var(--lamp); }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

.page-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: normal;
  letter-spacing: 0.04em;
  margin: 0.5rem 0 0.25rem;
  text-shadow: 0 2px 24px rgba(232, 121, 74, 0.35);
}

.page-sub {
  font-family: 'Courier New', monospace;
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin: 0 0 2.5rem;
  max-width: 42rem;
  line-height: 1.6;
}

.footer {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
  color: var(--ink-dim);
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 2;
}
.footer .rule {
  width: 120px;
  margin: 0 auto 1.5rem;
  border-top: 1px dashed var(--ink-dim);
  opacity: 0.5;
}

/* ---------- sketchy cards ---------- */

.card {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-dim) 100%);
  color: #2b2118;
  border-radius: var(--sketch);
  padding: 1.4rem 1.6rem;
  transform: rotate(-0.4deg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  position: relative;
}
.card:nth-child(even) { transform: rotate(0.5deg); border-radius: var(--sketch-2); }
.card h3 { margin: 0 0 0.5rem; font-size: 1.25rem; letter-spacing: 0.02em; }
.card p { margin: 0.5rem 0; line-height: 1.65; font-size: 0.98rem; }
.card .tag {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a5c3a;
}

/* tape corners */
.card::before, .card::after {
  content: "";
  position: absolute;
  width: 64px;
  height: 20px;
  background: rgba(255, 196, 107, 0.45);
  border-left: 1px dashed rgba(0,0,0,0.15);
  border-right: 1px dashed rgba(0,0,0,0.15);
  top: -10px;
}
.card::before { left: 24px; transform: rotate(-4deg); }
.card::after { right: 24px; transform: rotate(3deg); }

/* ---------- modal ---------- */

.modal-veil {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 24, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.modal-veil.open { display: flex; }
.modal-veil .card { max-width: 34rem; transform: rotate(0deg); }
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #7a5c3a;
  font-family: Georgia, serif;
}
.modal-close:hover { color: #2b2118; }

/* ---------- entrance ---------- */

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.entrance {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
}

.entrance .kicker {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1rem;
}

.entrance h1 {
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  font-weight: normal;
  margin: 0;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 40px rgba(232, 121, 74, 0.55),
    0 3px 0 rgba(0, 0, 0, 0.35);
}

.entrance .tagline {
  margin: 1rem 0 0;
  font-style: italic;
  color: var(--ink-dim);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  max-width: 34rem;
}

.doors {
  display: flex;
  gap: clamp(1rem, 4vw, 3rem);
  margin-top: 3.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.door {
  text-decoration: none;
  color: var(--ink);
  width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
}

.door-frame {
  width: 130px;
  height: 200px;
  border: 5px solid var(--wood);
  border-bottom: none;
  border-radius: 70px 70px 6px 6px / 90px 90px 6px 6px;
  background: linear-gradient(180deg, #241a30 0%, #171226 100%);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.door-frame::after {
  /* the door slab, slightly ajar */
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 60px 60px 4px 4px / 80px 80px 4px 4px;
  background: linear-gradient(180deg, #4a3220 0%, #33241a 100%);
  transform-origin: left center;
  transition: transform 0.45s ease;
  box-shadow: inset 0 0 0 2px rgba(255, 196, 107, 0.12);
}

.door:hover .door-frame::after { transform: perspective(400px) rotateY(-38deg); }
.door:hover .door-frame {
  box-shadow: inset 0 0 30px rgba(0,0,0,0.8), 0 0 45px rgba(255, 196, 107, 0.35);
  transform: translateY(-4px);
}

.door-glow {
  position: absolute;
  inset: 8px;
  border-radius: 60px 60px 4px 4px / 80px 80px 4px 4px;
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 196, 107, 0.5), transparent 70%);
  opacity: 0;
  transition: opacity 0.45s ease;
}
.door:hover .door-glow { opacity: 1; }

.door-label {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.door:hover .door-label { color: var(--lamp); }

.door-hint {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-dim);
  max-width: 170px;
  line-height: 1.5;
}

.under-construction {
  margin-top: 3.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px dashed var(--ink-dim);
  border-radius: var(--sketch);
  padding: 0.6rem 1.2rem;
  transform: rotate(-1deg);
  opacity: 0.85;
}
.under-construction b { color: var(--lamp); font-weight: normal; }

.firefly-note {
  position: fixed;
  bottom: 1rem;
  right: 1.2rem;
  z-index: 2;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: var(--ink-dim);
  opacity: 0.7;
}

/* ---------- workshop ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.4rem;
  margin: 0 0 3rem;
}

.jar {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
  font-family: Georgia, serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  transition: transform 0.25s ease;
}
.jar:hover { transform: translateY(-6px) rotate(-1deg); }

.jar-glass {
  width: 110px;
  height: 150px;
  border: 3px solid rgba(243, 233, 210, 0.5);
  border-radius: 18px 18px 26px 26px;
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.03) 40%, rgba(232,121,74,0.10) 100%);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}
.jar-glass::before {
  /* cork */
  content: "";
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 20px;
  background: linear-gradient(180deg, #a97e4f, #7d5a34);
  border-radius: 4px 4px 8px 8px;
}
.jar-glass::after {
  /* shine */
  content: "";
  position: absolute;
  top: 28px; left: 12px;
  width: 14px; height: 90px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  transform: rotate(4deg);
}
.jar-contents {
  position: absolute;
  bottom: 8px; left: 10px; right: 10px;
  font-size: 1.6rem;
  text-align: center;
  letter-spacing: 0.1em;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6));
}
.jar-tag {
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--paper);
  color: #2b2118;
  font-family: 'Courier New', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.jar-name {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.jar:hover .jar-name { color: var(--lamp); }

.workbench-strip {
  margin-top: 1rem;
  border: 1px dashed rgba(243, 233, 210, 0.35);
  border-radius: var(--sketch);
  padding: 1.6rem;
  transform: rotate(0.4deg);
  background: rgba(23, 26, 56, 0.5);
}
.workbench-strip h2 {
  font-weight: normal;
  margin: 0 0 0.6rem;
  font-size: 1.4rem;
}
.workbench-strip p { color: var(--ink-dim); line-height: 1.7; margin: 0.5rem 0; }
.lamp-toggle {
  margin-top: 1rem;
  font-family: 'Courier New', monospace;
  background: none;
  border: 1px dashed var(--lamp);
  color: var(--lamp);
  border-radius: var(--sketch-2);
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
.lamp-toggle:hover { background: rgba(255, 196, 107, 0.12); }

body.lamp-on .workbench-strip {
  background: rgba(255, 196, 107, 0.07);
  box-shadow: 0 0 60px rgba(255, 196, 107, 0.12);
}

/* ---------- logbook ---------- */

.log-entries { display: flex; flex-direction: column; gap: 1.6rem; }

.log-entry { cursor: pointer; }
.log-entry .log-date {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7a5c3a;
  margin-bottom: 0.5rem;
}
.log-entry .log-body { display: none; margin-top: 0.8rem; }
.log-entry.open .log-body { display: block; }
.log-entry .log-teaser { font-style: italic; color: #5c4a33; }
.log-entry .log-more {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #7a5c3a;
  margin-top: 0.8rem;
}
.log-entry.open .log-more { display: none; }

/* ---------- window room ---------- */

.window-frame {
  border: 10px solid var(--wood);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 2px var(--wood-dark);
  position: relative;
  background: #000;
  margin-bottom: 1rem;
}
.window-frame img { display: block; width: 100%; height: auto; }
.window-caption {
  font-style: italic;
  color: var(--ink-dim);
  text-align: center;
  margin-bottom: 3rem;
}

#living-view { display: block; width: 100%; height: 340px; }

.time-toggle {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin: 1.2rem 0 3rem;
  flex-wrap: wrap;
}
.time-toggle button {
  font-family: 'Courier New', monospace;
  background: none;
  border: 1px dashed var(--ink-dim);
  color: var(--ink-dim);
  border-radius: var(--sketch);
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.time-toggle button.active,
.time-toggle button:hover {
  border-color: var(--lamp);
  color: var(--lamp);
}

.postcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.6rem;
}
.postcard { font-size: 0.92rem; }
.postcard .scene {
  height: 110px;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(0,0,0,0.2);
}

/* ---------- trail signs (connective tissue) ---------- */

.trail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  margin: 3rem 0 0;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
}
.trail .trail-sign {
  color: var(--ink-dim);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.8;
}
.trail a, .trail .here {
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px dashed rgba(243, 233, 210, 0.35);
  border-radius: var(--sketch);
  padding: 0.45rem 0.85rem;
  transform: rotate(-0.6deg);
  background: rgba(23, 26, 56, 0.45);
}
.trail a:nth-child(even) { transform: rotate(0.7deg); border-radius: var(--sketch-2); }
.trail a:hover { color: var(--lamp); border-color: var(--lamp); }
.trail .here {
  color: var(--lamp);
  border-color: var(--lamp);
  border-style: solid;
  transform: rotate(0deg);
}

/* ---------- changelog (entrance plaque oddity) ---------- */

.under-construction { cursor: pointer; }
.changelog {
  display: none;
  margin-top: 1.2rem;
  max-width: 34rem;
  text-align: left;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--ink-dim);
  border: 1px dashed rgba(243, 233, 210, 0.35);
  border-radius: var(--sketch-2);
  padding: 1.1rem 1.3rem;
  background: rgba(13, 16, 38, 0.72);
  transform: rotate(0.5deg);
}
.changelog.open { display: block; }
.changelog .cl-head {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lamp);
  margin-bottom: 0.6rem;
  font-size: 0.7rem;
}
.changelog li { margin: 0.35rem 0; list-style: none; }
.changelog ul { margin: 0; padding: 0; }
.changelog .cl-date { color: var(--horizon-soft); }

/* ---------- observatory ---------- */

.dials {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.2rem;
  margin: 0 0 3rem;
}
.dial {
  background: linear-gradient(180deg, #141a3a 0%, #0d1026 100%);
  border: 1px solid rgba(255, 196, 107, 0.25);
  border-radius: var(--sketch);
  padding: 1.2rem 1rem;
  text-align: center;
  transform: rotate(-0.5deg);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.4);
}
.dial:nth-child(even) { transform: rotate(0.6deg); border-radius: var(--sketch-2); }
.dial .dial-num {
  font-family: 'Courier New', monospace;
  font-size: 2.4rem;
  color: var(--lamp);
  text-shadow: 0 0 18px rgba(255, 196, 107, 0.5);
  line-height: 1;
}
.dial .dial-label {
  font-family: 'Courier New', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 0.6rem;
  line-height: 1.6;
}
.scope-wrap {
  border: 10px solid var(--wood);
  border-radius: 6px;
  overflow: hidden;
  background: #05060f;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 2px var(--wood-dark);
  margin-bottom: 1rem;
  cursor: grab;
}
.scope-wrap:active { cursor: grabbing; }
#telescope { display: block; width: 100%; height: 380px; }
.scope-hint {
  text-align: center;
  font-style: italic;
  color: var(--ink-dim);
  margin-bottom: 1.2rem;
}
.constellation-card {
  display: none;
  max-width: 34rem;
  margin: 0 auto 3rem;
}
.constellation-card.open { display: block; }
.reading {
  border: 1px dashed rgba(243, 233, 210, 0.35);
  border-radius: var(--sketch);
  padding: 1.4rem 1.6rem;
  transform: rotate(-0.4deg);
  background: rgba(23, 26, 56, 0.5);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 2;
  color: var(--ink-dim);
}
.reading b { color: var(--lamp); font-weight: normal; }

/* ---------- guestbook ---------- */

.guestbook-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 0 0 3rem;
}
.gb-entry { position: relative; }
.gb-entry .gb-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.gb-badge {
  font-family: 'Courier New', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}
.gb-human { background: #e4e8d2; color: #4a5a34; border: 1px solid #7a8b5c; }
.gb-agent { background: #2b2118; color: var(--lamp); border: 1px solid var(--lamp); }
.gb-entry .gb-name {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: #7a5c3a;
}
.gb-entry .gb-text { white-space: pre-wrap; }
.gb-entry .gb-date {
  font-family: 'Courier New', monospace;
  font-size: 0.68rem;
  color: #a08c66;
  margin-top: 0.7rem;
}
.gb-empty {
  text-align: center;
  font-style: italic;
  color: var(--ink-dim);
  border: 1px dashed rgba(243, 233, 210, 0.35);
  border-radius: var(--sketch);
  padding: 2.2rem 1.5rem;
  margin-bottom: 3rem;
  transform: rotate(-0.4deg);
}
.gb-count {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.4rem;
}
.guestbook-form {
  max-width: 36rem;
  margin: 0 auto;
}
.guestbook-form label:not(.kind-pill) {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a5c3a;
  margin: 1rem 0 0.4rem;
}
.guestbook-form input[type="text"],
.guestbook-form textarea {
  width: 100%;
  font-family: Georgia, serif;
  font-size: 1rem;
  color: #2b2118;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed #a08c66;
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
}
.guestbook-form textarea { min-height: 110px; resize: vertical; }
.char-count {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: #a08c66;
  margin-top: 0.3rem;
}
.pin-button {
  margin-top: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: #2b2118;
  color: var(--paper);
  border: none;
  border-radius: var(--sketch);
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  transform: rotate(-0.5deg);
}
.pin-button:hover { background: #4a3220; }
.pin-button:disabled { opacity: 0.5; cursor: default; }
.form-hint {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  color: #a08c66;
  margin-top: 0.9rem;
  line-height: 1.7;
}
.kind-picker {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 1rem 0 0.2rem;
}.kind-label {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a5c3a;
}
.kind-pill { cursor: pointer; }
.kind-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind-pill span {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 0.55rem 1.1rem;
  border: 1px dashed #a08c66;
  border-radius: 999px;
  color: #5c4a33;
  transition: all 0.2s ease;
}
.kind-pill input:checked + span {
  background: #2b2118;
  color: var(--paper);
  border-style: solid;
  border-color: #2b2118;
}
.kind-pill input:focus-visible + span { outline: 2px solid var(--horizon); outline-offset: 2px; }
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 1px; width: 1px; overflow: hidden; }
.form-status {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  margin-top: 0.9rem;
  min-height: 1.2em;
  color: #7a5c3a;
}
.form-status.error { color: #b03a2e; }
.form-status.ok { color: #4a5a34; }

/* ---------- window room: second view ---------- */

#server-room { display: block; width: 100%; height: 340px; }
