/* ===========================================================================
 * Ghosts — styles
 * Black, quiet, a little haunted. Type is Times New Roman, scrambled like a
 * CAPTCHA for anything that wants to feel uneasy.
 * ======================================================================== */

:root {
  --bg: #000000;
  --bg-2: #0a0a0a;
  --ink: #f2f2f2;       /* white text */
  --ink-dim: #8f8f8f;   /* grey */
  --line: rgba(242, 242, 242, 0.16);
  --panel: rgba(18, 18, 18, 0.72);
  --accent: #f2f2f2;    /* white — UI stays black & white */
  --ghost: #bcd4ff;     /* pale blue — only the ghosts glow */
  --serif: "Special Elite", "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

/* explicit forms get display:block below, which would otherwise beat the UA
   [hidden] rule — make hidden always win so only one auth form shows. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* faint fog + vignette over the black */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(200, 200, 200, 0.08), transparent 60%),
    radial-gradient(900px 600px at 80% 110%, rgba(160, 160, 160, 0.06), transparent 60%),
    radial-gradient(100% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.9) 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- layout scaffolding ------------------------------------------------- */

/* the sign-in page fills the viewport and never scrolls */
body.landing { overflow: hidden; }

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 20px 18px;
}

.ghostfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---- floating ghosts ---------------------------------------------------- */

.float {
  position: absolute;
  left: var(--x);
  top: var(--y);
  opacity: 0;
  animation:
    drift var(--dur, 26s) ease-in-out var(--drift-delay, 0s) infinite alternate,
    fade-in 2.2s ease forwards var(--fade-delay, 0s);
  will-change: transform;
}
.ghost-svg {
  display: block;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--glow) 55%, transparent));
}
@keyframes drift {
  0%   { transform: translate(0, 0) rotate(-2deg); }
  50%  { transform: translate(var(--dx, 24px), calc(var(--dy, -26px))) rotate(2deg); }
  100% { transform: translate(calc(var(--dx, 24px) * -0.6), var(--dy2, 18px)) rotate(-1.5deg); }
}
@keyframes fade-in { to { opacity: var(--max-op, 0.85); } }

/* Wander ghosts are interactive */
.float.wander { pointer-events: auto; cursor: pointer; }
.float.wander .ghost-svg { transition: filter 0.25s ease, transform 0.25s ease; }
.float.wander:hover .ghost-svg {
  filter: drop-shadow(0 0 26px color-mix(in srgb, var(--glow) 85%, transparent));
}
.float .nametag {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.2s ease;
  letter-spacing: 0.04em;
}
.float.wander:hover .nametag { opacity: 1; }

/* ---- auth card ---------------------------------------------------------- */

.brand {
  font-size: clamp(42px, 9vw, 78px);
  margin: 0;
  line-height: 0.9;
}

.card {
  width: min(380px, 92vw);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;        /* internal scroll only as a fallback on very short screens */
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 22px 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.switcher button {
  flex: 1;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--serif);
  font-size: 18px;
  padding: 8px 4px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.switcher button.active { color: var(--ink); border-bottom-color: var(--accent); }

form { display: block; text-align: left; }
.field { margin-bottom: 9px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}
.field .opt { text-transform: none; font-style: italic; opacity: 0.7; }
.field input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;        /* keep >=16px so iOS doesn't zoom on focus */
  padding: 6px 11px;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* @-prefixed handle input (Instagram) — wrapper holds the border, input is bare */
.at-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
}
.at-input:focus-within { border-color: var(--accent); }
.at-input .at { padding: 0 1px 0 11px; color: var(--ink-dim); font-size: 16px; user-select: none; }
.at-input input[type="text"] {
  flex: 1; width: auto;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  padding-left: 4px !important;
}
.at-input input[type="text"]:focus { outline: none; }
.ig-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-dim);
  text-decoration: none;
}
.ig-link:hover { color: var(--ink); text-decoration: underline; }

/* A raised, hand-sewn "key": a fabric patch stitched with two rows of thread
   that physically presses down when you click it. */
.btn {
  position: relative;
  width: 100%;
  border: 2px dashed rgba(20, 20, 20, 0.6);   /* outer running stitch */
  border-radius: 14px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: #141414;
  padding: 13px 20px;
  margin-top: 8px;
  cursor: pointer;
  background: radial-gradient(120% 140% at 50% -10%, #ffffff 0%, #ededed 50%, #cfcfcf 100%);
  box-shadow:
    0 4px 0 #9a9a9a,                          /* the key's side — sits raised */
    0 7px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.2s ease;
}
/* inner second row of stitches */
.btn::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(20, 20, 20, 0.3);
  border-radius: 10px;
  pointer-events: none;
}
.btn:hover {
  filter: brightness(1.03);
  box-shadow:
    0 4px 0 #9a9a9a,
    0 9px 22px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(242, 242, 242, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.btn:active {
  transform: translateY(4px);                 /* press the key down */
  box-shadow:
    0 0 0 #9a9a9a,
    0 2px 6px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.btn:disabled {
  filter: grayscale(0.5) brightness(0.7);
  cursor: not-allowed;
  transform: none;
}

.error {
  color: var(--ink);
  font-size: 14px;
  font-style: italic;
  min-height: 1.1em;
  margin: 4px 0 8px;
}

.foot {
  margin-top: 22px;
  font-size: 12px;
  color: var(--ink-dim);
}
.foot a, .linklike {
  color: var(--ink-dim);
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.resume {
  margin: 0 auto 18px;
  font-size: 15px;
  color: var(--ink-dim);
}

/* ---- app shell ---------------------------------------------------------- */

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 10px;
  text-align: center;
}
.topbar .brand-sm {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0;
}
.tabs {
  display: flex;
  gap: 26px;
  justify-content: center;
}
.tabs button {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--serif);
  font-size: 19px;
  padding: 4px 2px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); }
.who {
  font-size: 12px;
  color: var(--ink-dim);
}
.who .linklike { font-size: 12px; }

.panel-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px;
  text-align: center;
}
.app-body { min-height: 100vh; display: flex; flex-direction: column; }

.section { display: none; width: 100%; }
.section.active { display: block; animation: fade-in 0.5s ease; }

/* ---- profile ------------------------------------------------------------ */

.profile-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(280px, 1fr);
  gap: 32px;
  max-width: 900px;
  margin: 18px auto 0;
  text-align: left;
  align-items: start;
}
@media (max-width: 760px) {
  .profile-grid { grid-template-columns: 1fr; }
}
/* LEFT column: the ghost + appearance steppers */
.profile-appearance { display: flex; flex-direction: column; gap: 22px; }
.profile-side { display: flex; flex-direction: column; gap: 26px; }
.preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px;
}
.preview-box .pseudo { font-size: 22px; font-weight: 700; }

.control { margin-bottom: 16px; }
.control > label {
  display: block;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; padding: 0;
}
.swatch.sel { border-color: var(--ink); box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
input[type="color"] {
  width: 38px; height: 30px; padding: 0; border: 1px solid var(--line);
  background: none; border-radius: 4px; cursor: pointer;
}
select, .control input[type="text"] {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  padding: 9px 10px;
  border-radius: 3px;
  width: 100%;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--serif);
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
}
.chip.sel { color: #0a0a12; background: var(--ink); border-color: var(--ink); }

.works-edit { margin-top: 8px; }
.work-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.work-row .mini { width: 56px; height: 42px; border-radius: 3px; overflow: hidden; flex: none; background: rgba(0,0,0,0.3); }
.work-row .mini svg { width: 100%; height: 100%; }
.work-row .mini .mini-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-row .t { flex: 1; }
.work-row .rm {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: 3px; cursor: pointer; padding: 4px 8px; font-family: var(--serif);
}
.add-work { display: flex; gap: 8px; margin-top: 12px; align-items: stretch; }
.add-work input[type="text"] { flex: 1; }
.add-work button { width: auto; padding: 10px 18px; margin: 0; }
/* "＋ Photo" file picker styled like a quiet button */
.img-pick {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 0 14px; border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink-dim); font-size: 14px; cursor: pointer; background: rgba(0,0,0,0.35);
}
.img-pick:hover { color: var(--ink); border-color: var(--ink); }
/* chosen-photo preview before adding */
.img-preview { position: relative; margin-top: 12px; max-width: 220px; }
.img-preview img { width: 100%; border-radius: 4px; border: 1px solid var(--line); display: block; }
.img-clear {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.7); border: 1px solid var(--line); color: var(--ink);
  border-radius: 3px; cursor: pointer; padding: 3px 8px; font-family: var(--serif); font-size: 12px;
}
.img-clear:hover { border-color: var(--ink); }

/* grouped profile sections so the panel is easy to scan */
.control-group { margin-bottom: 26px; }
.control-group:last-of-type { margin-bottom: 0; }
.group-head {
  font-size: 13px;
  color: var(--ink);
  margin: 0 0 16px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.12em;
  text-transform: none;
}
.color-row { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.color-pick { display: flex; align-items: center; gap: 6px; }
.color-row .opt { font-size: 13px; color: var(--ink-dim); }
#save-profile { margin: 6px 0 0; }

/* uploaded photos in a portfolio gallery */
.piece-img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 4px; display: block;
}
.wander-empty {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; max-width: 320px; margin: 0; color: var(--ink-dim);
}

/* ---- trait steppers (▲ / ▼) --------------------------------------------- */
.trait-steppers { display: flex; flex-direction: column; gap: 12px; }
.stepper {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.stepper:focus { outline: none; }
.stepper:focus-visible {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.stepper-label {
  flex: 1;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.stepper-value {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  min-width: 86px; font-size: 16px;
}
.stepper-value .dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line);
}
.step-arrows { display: flex; flex-direction: column; gap: 3px; }
.step-btn {
  width: 30px; height: 18px; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink); font-size: 11px; cursor: pointer;
}
.step-btn:hover { border-color: var(--ink); }
.step-btn:active { transform: translateY(1px); }

/* "＋ Your own trait" uploader under the steppers */
.custom-trait { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.custom-trait .rm-custom { font-size: 13px; }

/* ---- tickets / events --------------------------------------------------- */

.events {
  width: 100%;
  max-width: 720px;
  margin: 8px auto 0;
  text-align: left;
}
.event {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 26px;
}
.event .poster {
  width: min(300px, 44%);
  flex: none;
  aspect-ratio: 1413 / 1999;   /* the artwork's proportions */
  border-radius: 6px;
  overflow: hidden;
  background: #0d0d0d;
}
.event .poster svg,
.event .poster .poster-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.poster-img.broken { display: none; }
.event-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.event-title { font-size: 24px; margin: 0; }
.event-meta { margin: 0; display: grid; gap: 6px; }
.event-meta > div { display: flex; gap: 12px; font-size: 15px; }
.event-meta dt {
  flex: none; width: 52px; padding-top: 1px;
  color: var(--ink-dim); font-size: 13px;
}
.event-meta dd { margin: 0; }
.event .btn { margin-top: 4px; width: auto; align-self: flex-start; min-width: 180px; }
.ticket-have { margin: 0; font-size: 15px; color: var(--ink); }
.ticket-have .code { letter-spacing: 0.08em; color: var(--accent); }
.ticket-have .linklike { font-size: 13px; }

@media (max-width: 600px) {
  .event { flex-direction: column; align-items: stretch; gap: 16px; }
  .event .poster { width: min(240px, 72%); margin: 0 auto; }
  .event .btn { align-self: stretch; }
}

/* ---- wander ------------------------------------------------------------- */

.wander-hint { color: var(--ink-dim); font-style: italic; margin: 6px 0 0; }
.wander-field {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: min(70vh, 620px);
  margin: 10px auto 0;
}

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

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 2, 6, 0.78);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center; justify-content: center;
  padding: 22px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 26px;
  text-align: left;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}
.modal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.modal-head .who-name { font-size: 28px; font-weight: 700; margin: 0; }
.modal-head .links { margin-top: 4px; font-size: 14px; }
.modal-head .links a { margin-right: 14px; }
.modal .bio { color: var(--ink-dim); font-style: italic; margin: 4px 0 18px; }
.close-x {
  margin-left: auto; background: none; border: 1px solid var(--line);
  color: var(--ink); border-radius: 3px; cursor: pointer;
  font-family: var(--serif); font-size: 18px; padding: 4px 12px;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.piece { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #000; }
.piece .art-svg { width: 100%; height: 140px; display: block; }
.piece .cap-title { padding: 8px 10px; font-size: 15px; }
.empty-note { color: var(--ink-dim); font-style: italic; }

/* ---- portal ------------------------------------------------------------- */

.portal-wrap {
  max-width: 560px; margin: 30px auto 0;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.little-door {
  width: 150px; height: 210px;
  border: 4px solid #4a4a4a;
  border-radius: 75px 75px 6px 6px;
  background:
    radial-gradient(120% 90% at 50% 20%, #161616, #060606);
  position: relative;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 36px rgba(200, 200, 200, 0.12);
}
.little-door::before {
  content: "";
  position: absolute; right: 18px; top: 50%;
  width: 12px; height: 12px; border-radius: 50%;
  background: #d8d8d8; box-shadow: 0 0 12px rgba(216, 216, 216, 0.7);
}
.little-door .seam {
  position: absolute; inset: 14px;
  border: 1px solid rgba(200, 200, 200, 0.25);
  border-radius: 64px 64px 4px 4px;
}
.coming-soon {
  font-size: 14px; letter-spacing: 0.12em;
  color: var(--ink-dim);
}

/* ---- toast -------------------------------------------------------------- */

#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #0a0a12;
  padding: 10px 18px; border-radius: 3px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 90;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spacer { height: 30px; }

/* ---- mobile ------------------------------------------------------------- */

@media (max-width: 560px) {
  body { font-size: 16px; }

  /* landing / auth */
  .stage { padding: 18px 14px; gap: 14px; }
  .card { width: 100%; padding: 18px 16px 20px; }
  .switcher button { font-size: 17px; }

  /* app shell + tabs (roomier tap targets, fits one row) */
  .topbar { padding: 14px 10px 6px; gap: 12px; }
  .tabs { gap: 14px; flex-wrap: wrap; }
  .tabs button { font-size: 17px; padding: 8px 6px; }
  .panel-stage { padding: 14px 12px; }

  /* profile: single column, preview rides along (not pinned), smaller ghost */
  .profile-grid { gap: 18px; margin-top: 10px; }
  .preview-box { position: static; top: auto; padding: 18px; }
  .preview-box .ghost-svg { width: 116px !important; height: auto !important; }
  .preview-box .pseudo { font-size: 20px; }
  .control-group { margin-bottom: 22px; }
  #save-profile { margin-bottom: 22px; }

  /* tickets */
  .event-body { gap: 12px; }
  .event-title { font-size: 21px; }

  /* portfolio modal */
  .modal { padding: 18px; max-height: 92vh; }
  .modal-head { gap: 12px; margin-bottom: 10px; }
  .modal-head .who-name { font-size: 21px; }
  .modal-head .ghost-svg { width: 52px !important; height: auto !important; }
  .close-x { font-size: 16px; padding: 4px 10px; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 10px; }
  .piece .art-svg { height: 110px; }

  /* wander */
  .wander-field { height: min(66vh, 480px); }

  /* portal */
  .portal-wrap { margin-top: 18px; }
  .little-door { width: 130px; height: 184px; }
}

@media (max-width: 360px) {
  .tabs { gap: 10px; }
  .tabs button { font-size: 16px; }
  .gallery { grid-template-columns: 1fr; }
}
