@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;500;600&family=DM+Serif+Display:ital@0;1&family=Cormorant+Garamond:ital,wght@0,300;0,400;1,400&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: #0A0612;
  color: #E8E0F0;
  font-family: 'Shippori Mincho', serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(ellipse at center, #1A0F2E 0%, #0A0612 70%);
}

/* ============ Screen base ============ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ============ 1) Drift ============ */
#driftCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  cursor: crosshair;
}
.drift-ui {
  position: absolute;
  top: 8vh;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}
.brand {
  font-family: 'DM Serif Display', 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(76px, 17vw, 150px);
  line-height: 0.95;
  letter-spacing: -0.015em;
  color: #F4ECFF;
  -webkit-text-fill-color: #F4ECFF;
  text-shadow:
    0 0 40px rgba(200, 184, 232, 0.35),
    0 0 90px rgba(120, 90, 200, 0.25);
}
.brand-sep {
  display: inline-block;
  font-style: italic;
  font-weight: 400;
  color: #FFD27A;
  -webkit-text-fill-color: #FFD27A;
  opacity: 0.95;
  margin: 0 -0.04em 0 -0.02em;
  transform: translateY(-0.06em);
  font-size: 0.92em;
  text-shadow:
    0 0 14px rgba(255, 210, 122, 0.95),
    0 0 38px rgba(255, 154, 107, 0.65);
}
.brand-jp {
  font-family: 'Shippori Mincho', serif;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.8em;
  text-indent: 0.8em;
  opacity: 0.55;
  margin-top: 1.4em;
  color: #C8B8E8;
  font-weight: 400;
}
.brand-jp::before, .brand-jp::after {
  content: '';
  display: inline-block;
  width: 1.6em;
  height: 1px;
  background: rgba(200, 184, 232, 0.4);
  vertical-align: middle;
  margin: 0 0.6em;
  transform: translateY(-0.05em);
}

/* ============ Intro screen ============ */
#screen-intro {
  background: #050309;
  overflow-y: auto;
  align-items: flex-start;
  padding: 14vh 0 12vh;
}
.intro-void {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(60, 30, 100, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(40, 20, 80, 0.3) 0%, transparent 60%),
    radial-gradient(circle at center, #1A0F2E 0%, #050309 70%);
}
.intro-stage {
  position: relative;
  text-align: center;
  z-index: 2;
  padding: 6vh 9vw;
  max-width: 520px;
  width: 100%;
  margin: auto;
}
.intro-mark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  letter-spacing: 0.7em;
  text-indent: 0.7em;
  opacity: 0.4;
  margin-bottom: 6em;
  color: #C8B8E8;
}
.brand { margin-top: 0; }
.brand-jp { margin-top: 2em; }
.intro-copy {
  font-size: 13px;
  line-height: 2.6;
  letter-spacing: 0.18em;
  opacity: 0.65;
  margin: 7em 0 6em;
}
.intro-actions { margin-top: 1.5em; }
.intro-actions {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1em;
}
.intro-actions .ignite-btn {
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  padding: 16px 38px;
  white-space: nowrap;
}

/* ============ Drift compass ============ */
.drift-compass {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(200, 184, 232, 0.18);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.5;
  z-index: 4;
}
.dc-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFD27A;
  box-shadow: 0 0 10px rgba(255, 210, 122, 0.7);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.1s linear;
}
.copy {
  margin-top: 1.5em;
  font-size: 14px;
  letter-spacing: 0.15em;
  opacity: 0.6;
}
.drift-hint {
  margin-top: 6vh;
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.45;
}
.drift-counter {
  margin-top: 1em;
  font-size: 12px;
  opacity: 0;
  letter-spacing: 0.3em;
  transition: opacity 0.6s ease;
}
.drift-counter.visible { opacity: 0.7; }

.drift-actions {
  position: absolute;
  bottom: 6vh;
  display: flex;
  gap: 12px;
  z-index: 3;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 16px;
}

.ghost-btn {
  background: rgba(20, 14, 36, 0.6);
  border: 1px solid rgba(200, 184, 232, 0.25);
  color: #E8E0F0;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.15em;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.4s ease;
}
.ghost-btn:hover {
  border-color: rgba(255, 210, 122, 0.5);
  background: rgba(40, 26, 64, 0.7);
}
.ghost-faint { opacity: 0.6; }

.ignite-btn {
  background: linear-gradient(135deg, #FFD27A 0%, #FF9A6B 100%);
  border: none;
  color: #1A0F2E;
  padding: 14px 30px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2em;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(255, 210, 122, 0.4);
  transition: all 0.3s ease;
}
.ignite-btn:hover { transform: translateY(-1px); box-shadow: 0 0 50px rgba(255, 210, 122, 0.6); }
.ignite-btn:active { transform: scale(0.98); }

/* ============ Modal ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 18, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: modalIn 0.4s ease;
}
.modal[hidden] { display: none; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }

.modal-inner {
  background: rgba(26, 15, 46, 0.95);
  border: 1px solid rgba(200, 184, 232, 0.2);
  padding: 32px 28px;
  border-radius: 4px;
  width: min(440px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-inner h2 {
  font-weight: 500;
  letter-spacing: 0.2em;
  margin-bottom: 6px;
  font-size: 20px;
}
.modal-sub {
  font-size: 12px;
  opacity: 0.5;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.modal-inner input,
.modal-inner select,
.modal-inner textarea {
  width: 100%;
  background: rgba(10, 6, 18, 0.6);
  border: 1px solid rgba(200, 184, 232, 0.2);
  color: #E8E0F0;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 12px;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.3s;
}
.modal-inner input:focus,
.modal-inner textarea:focus {
  border-color: rgba(255, 210, 122, 0.5);
}

.post-field {
  position: relative;
  margin-bottom: 12px;
}
.post-field input {
  margin-bottom: 0;
  padding-right: 60px;
}
.post-count {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.4;
  pointer-events: none;
  font-family: 'Cormorant Garamond', serif;
}
.post-count.warn { opacity: 0.8; color: #FFD27A; }
.post-profile {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.post-profile input { margin-bottom: 0; }
.post-profile input[type="number"] { flex: 0 0 30%; }
.post-profile input:not([type="number"]) { flex: 1; }
.modal-inner textarea { min-height: 70px; resize: vertical; }
.post-extra {
  margin-bottom: 16px;
}
.post-extra summary {
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.15em;
  opacity: 0.55;
  padding: 8px 0;
  list-style: none;
}
.post-extra summary::before {
  content: '＋ ';
  opacity: 0.6;
}
.post-extra[open] summary::before { content: '− '; }
.post-extra summary:hover { opacity: 0.85; }

.emotion-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.emo {
  flex: 1;
  min-width: 60px;
  background: transparent;
  border: 1px solid rgba(200, 184, 232, 0.25);
  color: #E8E0F0;
  padding: 8px 0;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.15em;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.emo.active {
  background: rgba(255, 210, 122, 0.18);
  border-color: rgba(255, 210, 122, 0.7);
  color: #FFD27A;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

/* ============ 3) Questions ============ */
#screen-questions {
  background: radial-gradient(ellipse at center, #1A0F2E 0%, #0A0612 80%);
}
.q-stage {
  width: min(560px, 92vw);
  text-align: center;
  z-index: 2;
}
.q-progress {
  font-size: 11px;
  letter-spacing: 0.4em;
  opacity: 0.4;
  margin-bottom: 32px;
}
.q-text {
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1.8;
  font-weight: 400;
  margin-bottom: 36px;
  min-height: 3em;
  letter-spacing: 0.05em;
  animation: qIn 1.2s ease;
}
@keyframes qIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
#qAnswer {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(200, 184, 232, 0.3);
  color: #E8E0F0;
  font-family: inherit;
  font-size: 18px;
  text-align: center;
  padding: 12px;
  outline: none;
  resize: none;
  margin-bottom: 28px;
}
#qAnswer:focus { border-bottom-color: rgba(255, 210, 122, 0.7); }
#qNext { margin-bottom: 16px; }
#qReturn { display: block; margin: 0 auto; }

.q-selected-top {
  position: absolute;
  top: 4vh;
  left: 0; right: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  padding: 0 16px;
  max-width: 100vw;
  z-index: 3;
}
.q-selected-top .pill {
  background: rgba(40, 26, 64, 0.85);
  color: #FFE9B8;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 210, 122, 0.35);
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
}

/* ============ Suggest screen ============ */
#screen-suggest {
  background: radial-gradient(ellipse at center, #1A0F2E 0%, #0A0612 80%);
}
.suggest-stage {
  width: min(560px, 92vw);
  text-align: center;
  padding: 4vh 0;
}
.suggest-head {
  font-size: 14px;
  letter-spacing: 0.25em;
  opacity: 0.6;
  margin-bottom: 28px;
}
.suggest-mine {
  background: rgba(255, 210, 122, 0.1);
  border: 1px solid rgba(255, 210, 122, 0.4);
  padding: 18px 22px;
  border-radius: 4px;
  font-size: 16px;
  color: #FFE9B8;
  letter-spacing: 0.05em;
  margin-bottom: 32px;
  line-height: 1.7;
}
.suggest-divider {
  font-size: 11px;
  letter-spacing: 0.4em;
  opacity: 0.4;
  margin-bottom: 20px;
}
.suggest-list {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}
.suggest-card {
  background: rgba(20, 14, 36, 0.7);
  border: 1px solid rgba(200, 184, 232, 0.2);
  padding: 14px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.05em;
  line-height: 1.6;
  text-align: left;
  transition: all 0.3s ease;
}
.suggest-card:hover { border-color: rgba(200, 184, 232, 0.5); }
.suggest-card.selected {
  background: rgba(40, 26, 64, 0.9);
  border-color: rgba(255, 210, 122, 0.7);
  box-shadow: 0 0 20px rgba(255, 210, 122, 0.15);
}
.suggest-card.is-self {
  border-color: rgba(255, 210, 122, 0.45);
  background: rgba(40, 26, 16, 0.5);
}
.self-tag {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #FFD27A;
  margin-left: 10px;
  opacity: 0.7;
  vertical-align: middle;
}
.suggest-self {
  margin-bottom: 20px;
  text-align: center;
}
.suggest-self summary {
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.2em;
  opacity: 0.55;
  list-style: none;
  padding: 8px 0;
  display: inline-block;
}
.suggest-self summary:hover { opacity: 0.85; }
.suggest-self-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.suggest-self-row input {
  flex: 1;
  background: rgba(10, 6, 18, 0.6);
  border: 1px solid rgba(200, 184, 232, 0.25);
  color: #E8E0F0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  border-radius: 2px;
  outline: none;
}
.suggest-self-row input:focus { border-color: rgba(255, 210, 122, 0.6); }
.suggest-self-row button { padding: 8px 18px; }
.suggest-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}
.ignite-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ============ Grasp ============ */
#screen-grasp {
  background: radial-gradient(ellipse at center, #1A0F2E 0%, #0A0612 80%);
}
.grasp-stage { text-align: center; }
.grasp-head {
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0.3em;
  margin-bottom: 0.8em;
}
.grasp-sub {
  font-size: 12px;
  letter-spacing: 0.3em;
  opacity: 0.45;
  margin-bottom: 3em;
}
.grasp-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2em;
}

/* ============ 4) Big bang ============ */
#screen-bigbang {
  background: #0A0612;
  overflow: hidden;
}
#bigbangFlash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #FFF8E7 0%, transparent 60%);
  opacity: 0;
}
#bigbangCore {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #FFF8E7;
  box-shadow: 0 0 20px #FFD27A;
}

/* ============ 5) Universe ============ */
#universeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.u-ui {
  position: absolute;
  top: 6vh;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  width: 100%;
  padding: 0 16px;
}
.u-title {
  font-size: clamp(22px, 4.5vw, 32px);
  letter-spacing: 0.3em;
  font-weight: 500;
  background: linear-gradient(180deg, #FFE9B8 0%, #FFD27A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(255, 210, 122, 0.4);
}
.u-meta {
  margin-top: 1em;
  font-size: 12px;
  opacity: 0.5;
  letter-spacing: 0.15em;
}
.u-actions {
  position: absolute;
  bottom: 5vh;
  display: flex;
  gap: 12px;
  z-index: 3;
}

/* ============ Detail card ============ */
.detail-card {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 18, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 6vh 16px;
  animation: modalIn 0.35s ease;
}
.detail-card[hidden] { display: none; }
.detail-inner {
  position: relative;
  background: linear-gradient(180deg, rgba(36, 22, 60, 0.96) 0%, rgba(20, 12, 38, 0.98) 100%);
  border: 1px solid rgba(200, 184, 232, 0.22);
  padding: 32px 28px 24px;
  border-radius: 6px;
  width: min(440px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 60px rgba(200, 184, 232, 0.12);
}
.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 1px solid rgba(200, 184, 232, 0.25);
  color: #E8E0F0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.detail-emo {
  font-size: 11px;
  letter-spacing: 0.4em;
  opacity: 0.55;
  margin-bottom: 14px;
  color: #FFD27A;
}
.detail-title {
  font-size: 22px;
  line-height: 1.6;
  letter-spacing: 0.05em;
  color: #F4ECFF;
  margin-bottom: 18px;
  font-weight: 500;
}
.detail-body {
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  opacity: 0.78;
  margin-bottom: 22px;
}
.detail-profile {
  display: flex;
  gap: 16px;
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.55;
  margin-bottom: 24px;
  padding-top: 14px;
  border-top: 1px solid rgba(200, 184, 232, 0.12);
}
.detail-profile span { color: #C8B8E8; }
.detail-actions {
  display: flex;
  justify-content: center;
}
.detail-actions .ignite-btn.is-selected {
  background: linear-gradient(135deg, #C8B8E8 0%, #8A7AD6 100%);
}

/* ============ Recall panel ============ */
.u-recall {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 18, 0.92);
  backdrop-filter: blur(14px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalIn 0.5s ease;
}
.u-recall[hidden] { display: none; }
.u-recall-inner {
  width: min(620px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 8px;
}
.u-recall-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 1px solid rgba(200, 184, 232, 0.3);
  color: #E8E0F0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.recall-section {
  margin-bottom: 28px;
}
.recall-h {
  font-size: 11px;
  letter-spacing: 0.4em;
  opacity: 0.5;
  margin-bottom: 14px;
  color: #C8B8E8;
}
.recall-q {
  margin-bottom: 18px;
  border-left: 2px solid rgba(255, 210, 122, 0.4);
  padding-left: 14px;
}
.recall-q-text {
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.7;
  margin-bottom: 6px;
}
.recall-q-ans {
  font-size: 16px;
  color: #FFE9B8;
  line-height: 1.7;
  letter-spacing: 0.05em;
}
.recall-seed {
  background: rgba(40, 26, 64, 0.5);
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.05em;
  line-height: 1.6;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 14vh;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(180deg, rgba(36, 22, 60, 0.96), rgba(20, 12, 38, 0.98));
  border: 1px solid rgba(255, 210, 122, 0.4);
  padding: 18px 26px;
  border-radius: 8px;
  z-index: 200;
  text-align: center;
  max-width: 88vw;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  box-shadow: 0 0 50px rgba(255, 210, 122, 0.2);
}
.toast[hidden] { display: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-mark {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: #FFD27A;
  opacity: 0.7;
  margin-bottom: 8px;
}
.toast-text {
  font-size: 14px;
  letter-spacing: 0.05em;
  line-height: 1.7;
  color: #F4ECFF;
}
.toast-text em {
  font-style: normal;
  color: #FFE9B8;
  border-bottom: 1px solid rgba(255, 210, 122, 0.4);
  padding: 0 2px;
}

/* ============ Gallery ============ */
.gallery-inner { width: min(540px, 94vw); }
.gallery-list {
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 16px;
}
.gallery-card {
  background: rgba(10, 6, 18, 0.6);
  border: 1px solid rgba(200, 184, 232, 0.18);
  padding: 14px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.3s;
}
.gallery-card:hover { border-color: rgba(255, 210, 122, 0.5); }
.gallery-card .gc-title {
  font-size: 16px;
  color: #FFD27A;
  letter-spacing: 0.15em;
  margin-bottom: 4px;
}
.gc-tag {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  letter-spacing: 0.3em;
  margin-left: 12px;
  padding: 2px 8px;
  border: 1px solid rgba(200, 184, 232, 0.4);
  color: #C8B8E8;
  border-radius: 999px;
  vertical-align: middle;
  opacity: 0.7;
}
.gallery-card .gc-meta {
  font-size: 11px;
  opacity: 0.5;
  letter-spacing: 0.1em;
}
.gallery-empty {
  text-align: center;
  opacity: 0.4;
  padding: 40px 0;
  font-size: 13px;
}
