.referral-entry { display: grid; gap: 12px; margin-top: 12px; }
.referral-entry .secondary-button { width: 100%; min-height: 48px; height: auto; white-space: normal; }
.referral-entry p, .referral-condition { margin: 0; text-align: center; font-size: 14px; line-height: 1.6; color: var(--muted); }
:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", sans-serif;
  background: #111113;
  color: #1c1c1e;
  font-synthesis: none;
  --ink: #1c1c1e;
  --muted: #6f6f76;
  --line: #e8e6e2;
  --paper: #f7f6f3;
  --panel: #ffffff;
  --accent: #d34d3f;
  --accent-dark: #a93930;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #111113;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgba(211, 77, 63, 0.34);
  outline-offset: 2px;
}

#app {
  min-height: 100svh;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.28);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: 44px 1fr 52px;
  align-items: center;
  min-height: 70px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  border-bottom: 1px solid rgba(28, 28, 30, 0.07);
  background: rgba(247, 246, 243, 0.94);
  backdrop-filter: blur(18px);
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0 0 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 38px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.topbar-spacer {
  width: 44px;
}

.wordmark {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 3px;
}

.wordmark strong {
  overflow: hidden;
  color: #18181a;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wordmark span {
  margin-top: 2px;
  color: #77777d;
  font-size: 11px;
  letter-spacing: -0.02em;
}

.status-pill {
  justify-self: end;
  padding: 5px 8px 4px;
  border: 1px solid #d8d5cf;
  border-radius: 999px;
  color: #706f72;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.top-actions button {
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #d8d5cf;
  border-radius: 999px;
  background: transparent;
  color: #656369;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.screen {
  min-height: calc(100svh - 70px);
  padding: 30px 22px calc(env(safe-area-inset-bottom) + 30px);
}

.screen-gender {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-copy h1,
.section-heading h1,
.briefing-preview h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(31px, 9vw, 42px);
  font-weight: 820;
  letter-spacing: -0.06em;
  line-height: 1.09;
}

.intro-copy > p:last-child,
.section-heading > p:last-child {
  max-width: 350px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: -0.025em;
  line-height: 1.62;
}

.question-block {
  margin-top: 52px;
}

.question-block h2,
.topic-group h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.question-block > p {
  margin: 7px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.gender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-card {
  position: relative;
  min-height: 138px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.choice-card:active {
  transform: scale(0.98);
}

.choice-card:hover {
  border-color: #c6c2bb;
  box-shadow: 0 10px 28px rgba(28, 28, 30, 0.07);
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card strong {
  margin-top: 25px;
  font-size: 15px;
  letter-spacing: -0.035em;
}

.choice-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.choice-index {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: #232326;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.privacy-note {
  margin: 30px 0 0;
  color: #89888c;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.section-heading {
  margin-bottom: 34px;
}

.section-heading.compact h1 {
  font-size: 34px;
}

.topic-group + .topic-group {
  margin-top: 34px;
}

.topic-group h2 {
  padding: 0 3px 12px;
  color: #77767a;
  font-size: 13px;
}

.topic-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.topic-row {
  display: flex;
  width: 100%;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #efede9;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.topic-row:last-child {
  border-bottom: 0;
}

.topic-row:active {
  background: #f4f1ec;
}

.topic-row span,
.topic-row strong,
.topic-row small {
  display: block;
}

.topic-row strong {
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.topic-row small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: -0.025em;
  line-height: 1.4;
}

.topic-row b {
  padding-left: 12px;
  color: #aaa7a2;
  font-size: 25px;
  font-weight: 350;
}

.mbti-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-bottom: 120px;
}

.mbti-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  color: #55545a;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.mbti-button.selected {
  border-color: #26262a;
  background: #26262a;
  color: #fff;
  box-shadow: 0 8px 20px rgba(20, 20, 22, 0.17);
}

.sticky-action {
  position: fixed;
  z-index: 8;
  right: max(0px, calc((100vw - 460px) / 2));
  bottom: 0;
  left: max(0px, calc((100vw - 460px) / 2));
  padding: 16px 22px calc(env(safe-area-inset-bottom) + 14px);
  border-top: 1px solid rgba(28, 28, 30, 0.06);
  background: linear-gradient(to bottom, rgba(247, 246, 243, 0.76), #f7f6f3 28%);
  backdrop-filter: blur(14px);
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  font-weight: 760;
  cursor: pointer;
}

.primary-button {
  background: #242427;
  color: #fff;
}

.primary-button:disabled {
  background: #d8d5d0;
  color: #939195;
  cursor: default;
}

.secondary-button {
  margin-top: 24px;
  border: 1px solid #dedbd6;
  background: #fff;
  color: var(--ink);
}

.sticky-action small {
  display: block;
  margin-top: 8px;
  color: #8b898c;
  font-size: 10px;
  text-align: center;
}

.loading-state,
.empty-state {
  display: flex;
  min-height: 68svh;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.loading-state strong,
.empty-state strong {
  margin-top: 22px;
  font-size: 18px;
  letter-spacing: -0.04em;
}

.loading-state p,
.empty-state p {
  max-width: 290px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.pulse-mark {
  position: relative;
  width: 54px;
  height: 54px;
  border: 2px solid #d7d3cd;
  border-radius: 50%;
}

.pulse-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  transform: translate(-50%, -50%);
  animation: pulse 1.25s ease-in-out infinite;
}

.error-state > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: #efe4df;
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 800;
}

.briefing-preview {
  padding-top: 28px;
}

.briefing-preview > p:not(.eyebrow, .next-slice-note) {
  margin: 22px 0 30px;
  color: #57565b;
  font-size: 16px;
  line-height: 1.65;
}

.briefing-preview dl {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.briefing-preview dl div {
  display: grid;
  grid-template-columns: 66px 1fr;
  padding: 15px 17px;
  border-bottom: 1px solid #efede9;
}

.briefing-preview dl div:last-child {
  border-bottom: 0;
}

.briefing-preview dt {
  color: #8a888c;
  font-size: 12px;
}

.briefing-preview dd {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.next-slice-note {
  margin-top: 26px;
  color: #8a888c;
  font-size: 12px;
  text-align: center;
}

.screen-briefing,
.messenger-screen {
  padding: 0;
}

.app-shell-messenger {
  position: relative;
  height: 100svh;
  height: 100dvh;
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  --chat-canvas: #eae8e2;
  --chat-surface: #f8f8f5;
  --chat-ink: #292b2b;
  --chat-muted: #646d66;
  --chat-bubble: #fff;
  --chat-own: #f3dc75;
  --chat-own-ink: #363526;
  --chat-border: #747b7730;
  --chat-receipt: #765808;
  color: var(--chat-ink);
  background: var(--chat-canvas);
  color-scheme: light;
}

.app-shell-messenger[data-chat-theme="night"] {
  --chat-canvas: #202624;
  --chat-surface: #252e2a;
  --chat-ink: #e8eee8;
  --chat-muted: #a4ada5;
  --chat-bubble: #354039;
  --chat-own: #d6ba82;
  --chat-own-ink: #292b25;
  --chat-border: #b4c4b42b;
  --chat-receipt: #dcc48e;
  color-scheme: dark;
}

#app:has(> .app-shell-messenger) {
  position: fixed;
  inset: 0;
  top: var(--chat-viewport-top, 0px);
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
}

.app-shell-messenger .messenger-screen {
  height: 100%;
  min-height: 0;
}

.briefing-backdrop {
  min-height: calc(100svh - 70px);
  padding: 22px;
  background:
    radial-gradient(circle at 84% 8%, rgba(211, 77, 63, 0.11), transparent 27%),
    #242426;
}

.briefing-card {
  padding: 28px 22px 22px;
  border-radius: 24px;
  background: #f9f8f5;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

.briefing-card h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 820;
  letter-spacing: -0.055em;
}

.briefing-lead {
  margin: 16px 0 22px;
  color: #56555a;
  font-size: 15px;
  line-height: 1.62;
}

.briefing-facts {
  overflow: hidden;
  margin: 0;
  border: 1px solid #e6e2dc;
  border-radius: 16px;
  background: #fff;
}

.briefing-facts > div {
  display: grid;
  grid-template-columns: 73px 1fr;
  gap: 9px;
  padding: 13px 14px;
  border-bottom: 1px solid #efede9;
}

.briefing-facts > div:last-child {
  border-bottom: 0;
}

.briefing-facts dt {
  color: #949197;
  font-size: 11px;
  font-weight: 700;
}

.briefing-facts dd {
  margin: 0;
  font-size: 13px;
  font-weight: 610;
  letter-spacing: -0.025em;
  line-height: 1.45;
}

.known-facts {
  margin: 18px 0;
  padding: 16px;
  border-radius: 16px;
  background: #f0ede7;
}

.known-facts h2,
.profile-clues h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.known-facts ul {
  margin: 0;
  padding-left: 18px;
  color: #5d5b60;
  font-size: 12px;
  line-height: 1.55;
}

.briefing-warning {
  margin: 0 0 18px;
  color: #a33e34;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
}

.messenger-shell {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--chat-canvas);
}

.chat-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 60px;
  padding: calc(env(safe-area-inset-top) + 5px) 6px 5px;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-surface);
  backdrop-filter: blur(18px);
}

.chat-back,
.chat-theme {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--chat-ink);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.chat-header svg, .composer svg {
  width: 22px;
  height: 22px;
}

.profile-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--chat-ink);
  text-align: left;
  cursor: pointer;
}

.profile-summary img {
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: cover;
}

.profile-summary span,
.profile-summary strong,
.profile-summary small {
  display: block;
  min-width: 0;
}

.profile-summary strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary small {
  margin-top: 3px;
  color: var(--chat-muted);
  font-size: 12px;
}

.situation-strip {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 0;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-surface);
  color: var(--chat-muted);
  text-align: left;
  cursor: pointer;
}

.situation-strip svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.situation-summary {
  flex: 1;
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.situation-link { flex-shrink: 0; font-size: 12px; }

.messages {
  min-width: 0;
  overflow-y: auto;
  padding: 16px 12px 22px;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.messages::-webkit-scrollbar {
  display: none;
}

.date-divider {
  margin: 0 0 22px;
  text-align: center;
}

.date-divider span {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: #70777010;
  color: var(--chat-muted);
  font-size: 12px;
}

.partner-group { display: flex; align-items: flex-start; gap: 4px; margin-bottom: 16px; }
.message-avatar { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: start center; padding: 2px 0; border: 0; background: none; cursor: pointer; }
.message-avatar img { width: 30px; height: 30px; border-radius: 10px; object-fit: cover; }
.partner-content { flex: 1; min-width: 0; }
.message-sender { display: block; margin: 0 0 5px; font-size: 12px; color: var(--chat-muted); }
.message-time { flex-shrink: 0; padding-bottom: 2px; font-size: 12px; line-height: 1.3; color: var(--chat-muted); white-space: nowrap; }
.message-meta { display: flex; flex: 0 0 auto; flex-direction: column; align-items: center; gap: 2px; }

.message-row {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  margin: 4px 0 0;
  gap: 5px;
}

.message-row.partner {
  justify-content: flex-start;
}

.message-row.player {
  margin: 0 0 16px auto;
  justify-content: flex-end;
}

.bubble {
  min-width: 0;
  max-width: 100%;
  padding: 8px 11px;
  border-radius: 13px;
  font-size: 16px;
  letter-spacing: -0.025em;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.partner .bubble {
  border-bottom-left-radius: 5px;
  background: var(--chat-bubble);
  color: var(--chat-ink);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.player .bubble {
  max-width: 80%;
  border-bottom-right-radius: 5px;
  background: var(--chat-own);
  color: var(--chat-own-ink);
}

.delivery-marker {
  padding-bottom: 2px;
  color: var(--chat-receipt);
  font-size: 12px;
  font-weight: 500;
}

.typing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 9px 0 0 48px;
  font-size: 12px;
  color: var(--chat-muted);
}

.typing-bubble {
  display: flex;
  min-width: 46px;
  min-height: 39px;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  border-radius: 13px 13px 13px 5px;
  background: var(--chat-bubble);
}

.typing-bubble i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--chat-muted);
  animation: typing-dot 1.15s ease-in-out infinite;
}

.typing-bubble i:nth-child(2) { animation-delay: 120ms; }
.typing-bubble i:nth-child(3) { animation-delay: 240ms; }

.typing-bubble span {
  margin-left: 4px;
  color: #77747a;
  font-size: 10px;
}

.chat-error {
  max-width: 310px;
  margin: 14px auto;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.ending-notice {
  margin: 25px auto 8px;
  padding: 16px;
  border-radius: 16px;
  background: var(--chat-surface);
  text-align: center;
}

.ending-notice strong {
  display: block;
  font-size: 13px;
}

.ending-notice button {
  min-height: 38px;
  margin-top: 10px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: var(--chat-own);
  color: var(--chat-own-ink);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: end;
  gap: 8px;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  border-top: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 112px;
  resize: none;
  padding: 10px 13px;
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  outline: 0;
  background: var(--chat-bubble);
  color: var(--chat-ink);
  font-size: 16px;
  line-height: 22px;
}

.composer textarea::placeholder { color: var(--chat-muted); }

.composer textarea:focus {
  border-color: var(--chat-muted);
}

.composer button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--chat-own);
  color: var(--chat-own-ink);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.composer button:disabled {
  opacity: .4;
  cursor: default;
}

.chat-briefing { position: absolute; z-index: 30; inset: 0; min-height: 0; overflow-y: auto; padding: 16px; background: var(--chat-canvas); }
.chat-briefing .briefing-card { margin: auto; background: var(--chat-surface); color: var(--chat-ink); }
.chat-briefing .briefing-lead, .chat-briefing .briefing-facts dd, .chat-briefing .known-facts li { color: var(--chat-ink); }
.chat-briefing .briefing-warning, .chat-briefing .eyebrow, .chat-briefing .briefing-facts dt { color: var(--chat-muted); }
.chat-briefing .primary-button { background: var(--chat-own); color: var(--chat-own-ink); }
.app-shell-messenger .sheet-backdrop { position: absolute; }
.app-shell-messenger .profile-sheet { background: var(--chat-surface); color: var(--chat-ink); padding-top: calc(env(safe-area-inset-top) + 50px); }
.app-shell-messenger .status-message, .app-shell-messenger .revealed-clue, .app-shell-messenger .profile-clues > button { background: var(--chat-bubble); border-color: var(--chat-border); color: var(--chat-ink); }
.app-shell-messenger .sheet-close, .app-shell-messenger .profile-type, .app-shell-messenger .status-message span, .app-shell-messenger .status-message small, .app-shell-messenger .profile-clues > button span, .app-shell-messenger .revealed-clue span { color: var(--chat-muted); }
.app-shell-messenger .profile-clues > button b { color: var(--chat-receipt); }
.app-shell-messenger .profile-hero { border-color: var(--chat-bubble); }

.sheet-backdrop.leave-backdrop { align-items: center; padding: 20px; }
.leave-confirm { width: 100%; max-width: 380px; padding: 24px; border-radius: 20px; background: var(--chat-surface, #fff); color: var(--chat-ink, #222); }
.leave-confirm h2 { margin: 0 0 16px; font-size: 22px; }
.leave-confirm p { margin: 0 0 24px; line-height: 1.7; overflow-wrap: anywhere; }
.leave-confirm button { width: 100%; margin-top: 10px; }
.sheet-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  justify-content: center;
  background: rgba(12, 12, 14, 0.58);
  backdrop-filter: blur(6px);
}

.profile-sheet {
  position: relative;
  width: min(100%, 460px);
  height: 100%;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 58px) 24px calc(env(safe-area-inset-bottom) + 30px);
  background: #f7f6f3;
  text-align: center;
}

.sheet-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 10px);
  right: 15px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #55535a;
  font-size: 30px;
  font-weight: 300;
  cursor: pointer;
}

.profile-hero {
  width: 118px;
  height: 118px;
  border: 4px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 32px rgba(28, 28, 30, 0.14);
}

.profile-sheet h1 {
  margin: 18px 0 0;
  font-size: 27px;
  font-weight: 820;
  letter-spacing: -0.05em;
}

.profile-type {
  margin: 5px 0 24px;
  color: #76747a;
  font-size: 13px;
  font-weight: 700;
}

.status-message {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  text-align: left;
}

.status-message span,
.status-message strong,
.status-message small {
  display: block;
}

.status-message span,
.status-message small {
  color: #89868c;
  font-size: 10px;
}

.status-message strong {
  margin: 7px 0;
  font-size: 15px;
  letter-spacing: -0.03em;
}

.profile-clues {
  margin-top: 27px;
  text-align: left;
}

.profile-clues h2 {
  padding: 0 3px;
}

.profile-clues > button,
.revealed-clue {
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
}

.profile-clues > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.profile-clues > button span,
.revealed-clue span {
  color: #727076;
  font-size: 11px;
  font-weight: 700;
}

.profile-clues > button b {
  color: var(--accent-dark);
  font-size: 11px;
}

.revealed-clue p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.screen-outcome {
  background: #252528;
}

.outcome-screen {
  padding: 16px 0 30px;
  color: #fff;
}

.ending-kicker {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: #e6b4aa;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.outcome-screen > h1 {
  max-width: 360px;
  margin: 0;
  font-size: 34px;
  font-weight: 830;
  letter-spacing: -0.06em;
  line-height: 1.16;
}

.ending-description {
  margin: 16px 0 20px;
  color: #bab8bd;
  font-size: 14px;
  line-height: 1.6;
}

.ending-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 26px;
}

.ending-meta span,
.ending-meta b,
.ending-meta small {
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 10px;
}

.analysis-card {
  padding: 20px;
  border-radius: 19px;
  background: #f7f6f3;
  color: #242327;
}

.analysis-card h2 {
  margin: 0 0 13px;
  font-size: 15px;
  letter-spacing: -0.035em;
}

.analysis-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.analysis-card li {
  padding: 10px 0;
  border-bottom: 1px solid #e7e3dd;
  color: #4d4b50;
  font-size: 13px;
  line-height: 1.45;
}

.analysis-card > p:not(.analysis-note) {
  color: #6f6d72;
  font-size: 13px;
}

.analysis-note {
  margin: 15px 0 0;
  color: #8b888e;
  font-size: 10px;
  line-height: 1.5;
}

.outcome-actions {
  margin-top: 17px;
}

.outcome-actions .primary-button {
  background: #fff;
  color: #242327;
}

.outcome-actions .secondary-button {
  margin-top: 9px;
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
}

.replay-cost-note {
  margin: 13px auto 0;
  color: #929095;
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

.archive-heading,
.shop-heading {
  margin-bottom: 27px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.archive-card {
  position: relative;
  min-height: 168px;
  overflow: hidden;
  padding: 15px;
  border: 1px solid #ddd9d2;
  border-radius: 18px;
  background: #fff;
  width: 100%;
  text-align: left;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.archive-card::after {
  position: absolute;
  right: -18px;
  bottom: -24px;
  width: 80px;
  height: 80px;
  border: 14px solid rgba(211, 77, 63, 0.1);
  border-radius: 50%;
  content: "";
}

.archive-card.ending-breakup::after,
.archive-card.ending-coldWar::after {
  border-color: rgba(47, 47, 51, 0.1);
}

.archive-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.archive-card-top span {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.archive-card-top small {
  color: #9a979c;
  font-size: 9px;
}

.archive-card h2 {
  margin: 28px 0 7px;
  font-size: 15px;
  letter-spacing: -0.04em;
  line-height: 1.35;
}

.archive-card-title { display: block; margin: 26px 0 8px; font-size: 18px; font-weight: 700; line-height: 1.45; letter-spacing: -.03em; overflow-wrap: anywhere; }
.archive-card-ending { display: block; color: var(--muted); font-size: 14px; }
.archive-card-open { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; color: var(--accent-dark); font-size: 14px; font-weight: 600; }
.archive-card:hover { box-shadow: 0 0 0 1px var(--accent); }
.archive-card:active { opacity: .8; }
.archive-detail-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: #0b1512aa; }
.archive-detail { display: flex; flex-direction: column; width: min(100%, 540px); max-height: 100%; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); color: var(--ink); box-shadow: 0 20px 70px #0004; }
.archive-detail:focus { outline: none; }
.archive-detail-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 8px 12px 8px 24px; border-bottom: 1px solid var(--line); }
.archive-detail-header p { margin: 0; color: var(--muted); font-size: 13px; }
.archive-detail-header .icon-button { color: var(--ink); background: transparent; border: 0; min-width: 44px; }
.archive-detail-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 26px 24px; }
.archive-detail-badges { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--accent-dark); }
.archive-detail-badges strong { font-weight: 600; border-left: 1px solid var(--line); padding-left: 10px; }
.archive-detail h2 { margin: 14px 0 24px; font-size: 26px; line-height: 1.35; letter-spacing: -.04em; overflow-wrap: anywhere; }
.archive-detail-meta { margin: 0; font-size: 13px; color: var(--muted); }
.archive-detail-meta > div { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; margin-top: 8px; }
.archive-detail-meta dd, .archive-scene-facts dd { margin: 0; }
.archive-detail-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.archive-detail h3 { margin: 0 0 16px; font-size: 16px; line-height: 1.5; }
.archive-scene-title { font-size: 18px; font-weight: 650; line-height: 1.5; margin: 0 0 20px; }
.archive-scene-facts { margin: 0; }
.archive-scene-facts > div + div { margin-top: 18px; }
.archive-scene-facts dt { font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.archive-scene-facts dd, .archive-detail-section > p, .archive-detail-notice p { font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.archive-evidence { list-style: none; padding: 0; margin: 0; }
.archive-evidence li { padding: 14px 16px; background: var(--soft); border-radius: 10px; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.archive-evidence li + li { margin-top: 10px; }
.archive-detail-section .archive-analysis-note, .archive-retention-note { font-size: 13px; line-height: 1.65; color: var(--muted); }
.archive-retention-note { margin: 26px 0 0; }
.archive-detail-notice { margin: 26px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); font-size: 16px; line-height: 1.65; }
.archive-detail-notice p { margin: 0 0 12px; }
.archive-detail-notice p:last-child { margin-bottom: 0; }
.archive-detail-footer { flex-shrink: 0; padding: 16px 24px; border-top: 1px solid var(--line); }
.archive-detail-footer .primary-button { width: 100%; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px; height: auto; }
@media (max-width: 560px) {
  .archive-detail-backdrop { align-items: flex-end; padding: max(12px, env(safe-area-inset-top)) 0 0; }
  .archive-detail { width: 100%; max-height: 100%; border-radius: 22px 22px 0 0; }
  .archive-detail-body { padding: 22px 20px; }
  .archive-detail-footer { padding: 14px 20px max(16px, env(safe-area-inset-bottom)); }
}

.archive-card > p {
  margin: 0;
  color: #747177;
  font-size: 11px;
}

.archive-card > b {
  display: inline-block;
  margin-top: 16px;
  color: #9a979c;
  font-size: 9px;
}

.archive-empty {
  padding: 50px 0;
  text-align: center;
}

.archive-empty strong {
  font-size: 16px;
}

.archive-empty p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.balance-panel,
.monetization-rules {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.balance-panel h2,
.monetization-rules summary,
.purchase-history > summary,
.referral-details summary {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.balance-panel > .balance-row,
.referral-panel > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border-top: 1px solid var(--line);
}

.balance-breakdown {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.balance-status { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.balance-status p { margin: 4px 0 10px; }

.referral-panel { margin-bottom: 24px; }
.referral-panel p, .referral-panel small { line-height: 1.65; overflow-wrap: anywhere; }
.referral-panel input { display: block; width: 100%; min-width: 0; box-sizing: border-box; margin-top: 8px; padding: 12px; border: 1px solid currentColor; border-radius: 8px; background: transparent; color: inherit; font: inherit; }
.referral-panel > .referral-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-height: 0; margin-top: 14px; border: 0; }
.referral-actions .secondary-button { width: 100%; min-height: 44px; padding: 8px; }

.balance-panel .balance-row span,
.referral-panel > div span {
  color: var(--muted);
  font-size: 12px;
}

.balance-panel .balance-row b,
.referral-panel > div b {
  font-size: 12px;
}

.product-list {
  margin-top: 22px;
}

.product-list button {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.product-list button:disabled {
  opacity: 0.72;
}

.product-list button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.product-list span,
.product-list strong,
.product-list small {
  display: block;
}

.product-list strong {
  font-size: 15px;
}

.product-list small {
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 10px;
}

.product-list > button > b {
  font-size: 14px;
}

.shop-notice {
  margin: 13px 3px 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.shop-notice.private {
  color: #a5483d;
}

.checkout-panel {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.checkout-panel h2, .purchase-history h2 { margin: 0 0 12px; font-size: 17px; }
.checkout-panel p, .purchase-history p { font-size: .875rem; line-height: 1.7; overflow-wrap: anywhere; }
.checkout-panel label { display: block; margin: 14px 0 8px; font-size: .875rem; }
.checkout-panel input[type="tel"] { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel); color: var(--ink); font-size: 16px; }
.checkout-panel .checkout-consent { display: flex; gap: 8px; align-items: flex-start; line-height: 1.6; }
.checkout-consent input { flex-shrink: 0; margin-top: 4px; }
.checkout-panel > button { width: 100%; margin-top: 10px; }
.monetization-rules, .purchase-history, .referral-details { color: var(--ink); }
.monetization-rules summary, .purchase-history > summary, .referral-details summary { display: flex; align-items: center; min-height: 28px; cursor: pointer; }
.monetization-rules summary::after, .purchase-history > summary::after, .referral-details summary::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 16px; line-height: 1; transition: transform 160ms ease; }
.monetization-rules[open] summary, .purchase-history[open] > summary, .referral-details[open] summary { margin-bottom: 12px; }
.monetization-rules[open] summary::after, .purchase-history[open] > summary::after, .referral-details[open] summary::after { transform: rotate(180deg); }
.referral-details { margin-top: 14px; color: var(--muted); font-size: .875rem; }
.referral-details p { margin: 0 0 12px; }
.referral-details small { display: block; margin-top: 12px; }
.purchase-history-heading, .purchase-history li > div:first-child { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.purchase-history { margin-top: 16px; border-top: 1px solid var(--line); padding: 8px 0 0; }
.purchase-history > summary { min-height: 44px; font-size: 14px; font-weight: 600; }
.purchase-history-heading { color: var(--muted); font-size: 12px; }
.purchase-history ol { margin: 0; padding: 0; list-style: none; }
.purchase-history li { border-top: 1px solid var(--line); padding: 16px 0; }
.purchase-history strong, .purchase-history b { font-size: .875rem; }
.purchase-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.purchase-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.purchase-text-button { width: auto; min-height: 44px; padding: 8px 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.purchase-support { padding: 8px 0 20px; }
.purchase-support a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 13px; text-underline-offset: 3px; }
.purchase-support p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }

.monetization-rules p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 360px) {
  .balance-panel,
  .monetization-rules,
  .checkout-panel { padding: 14px; }

  .balance-panel > .balance-row { align-items: flex-start; gap: 12px; padding: 8px 0; }
  .balance-panel > .balance-row b { text-align: right; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.8); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 700px) {
  .app-shell {
    min-height: calc(100svh - 40px);
    margin: 20px auto;
    border-radius: 28px;
    overflow: clip;
  }

  .app-shell-messenger {
    height: calc(100svh - 40px);
    height: calc(100dvh - 40px);
    height: calc(var(--chat-viewport-height, 100dvh) - 40px);
    min-height: 0;
  }

  .topbar {
    padding-top: 8px;
  }

  .sticky-action {
    right: calc((100vw - 460px) / 2);
    bottom: 20px;
    left: calc((100vw - 460px) / 2);
    border-radius: 0 0 28px 28px;
  }
}
