:root {
  color-scheme: light;
  --game-width: 100svw;
  --game-height: 100svh;
  --game-safe-top: env(safe-area-inset-top);
  --game-safe-right: env(safe-area-inset-right);
  --game-safe-bottom: env(safe-area-inset-bottom);
  --game-safe-left: env(safe-area-inset-left);
  --ink: #17212b;
  --muted: #637384;
  --blue: #1677d2;
  --red: #d44343;
  --phone-wash: #bdd5e8;
  --scene-top: rgba(201, 222, 237, .84);
  --scene-mid: rgba(230, 240, 246, .9);
  --scene-low: rgba(247, 250, 252, .95);
  --message-clearance: 4px;
  --message-font-size: 12.2px;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(89, 121, 146, .22), transparent 32rem),
    #101215;
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button { font: inherit; }
[hidden] { display: none !important; }

.app {
  width: var(--game-width);
  height: var(--game-height);
  display: grid;
  place-items: center;
  padding: var(--game-safe-top) var(--game-safe-right) var(--game-safe-bottom) var(--game-safe-left);
}

.app > h1,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app.is-story-test {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: max(8px, var(--game-safe-top)) max(8px, var(--game-safe-right)) max(8px, var(--game-safe-bottom)) max(8px, var(--game-safe-left));
}
.is-story-test .frame { flex: 0 1 700px; min-height: 0; max-width: 100%; max-height: 100%; }
.test-controls {
  flex: 0 0 auto;
  width: min(340px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c4d7e6;
  font-size: 11px;
}
.test-controls > span { margin-right: auto; }
.test-controls button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #607385;
  border-radius: 10px;
  background: #202d38;
  color: #f3f7fb;
  cursor: pointer;
}
.test-controls button:disabled { opacity: .4; cursor: default; }
.test-controls button:focus-visible { outline: 2px solid #9fcfff; outline-offset: 2px; }
.test-controls > span { flex-shrink: 0; font-size: 10px; }
.test-controls button { padding-inline: 8px; white-space: nowrap; }
.test-details {
  width: min(540px, calc(var(--game-width) - 24px));
  max-height: calc(var(--game-height) - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid #c4d7e6;
  border-radius: 22px;
  background: #edf4f8;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  overflow: hidden;
}
.test-details[open] { display: flex; flex-direction: column; }
.test-details::backdrop { background: rgba(9, 17, 25, .72); backdrop-filter: blur(4px); }
.test-details__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid #cbdce7; }
.test-details__head small { font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
.test-details h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.03em; }
.test-details__head button { flex-shrink: 0; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #d8e6ef; color: var(--ink); cursor: pointer; }
.test-details__body { overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 22px; font-size: 13px; line-height: 1.5; }
.test-details__translation { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.test-details__note { color: #536777; font-size: 11px; margin: 10px 0 16px; }
.test-details a { color: #1263a7; }
.test-details h3 { font-size: 13px; margin: 0 0 6px; }
.test-details__choice, .test-details__entry { margin: 12px 0; padding: 14px; background: white; border: 1px solid #d2e0e9; border-radius: 14px; }
.test-details__entry { background: #e0ecf3; }
.test-details p { margin-block: 6px; }
.test-details__outcome { padding-top: 9px; margin-top: 9px; border-top: 1px solid #e1e9ef; }
.test-details__outcome small { display: block; color: var(--muted); font-size: 10px; }
.test-details button:focus-visible, .test-details a:focus-visible { outline: 2px solid #1677d2; outline-offset: 3px; }

.frame {
  width: 340px;
  height: 700px;
  max-width: var(--game-width);
  max-height: var(--game-height);
  overflow: hidden;
  border-radius: 36px;
  background: var(--phone-wash);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.phone {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background: linear-gradient(180deg, #bdd5e8 0%, #d4e4f0 100%);
  color: var(--ink);
}

.phone[data-shell-stage="intro"] { grid-template-rows: minmax(0, 1fr); }
.phone[data-shell-stage="intro"] .scene--card { margin-top: 10px; }

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 11px;
}

.brand b { display: block; font-size: 16.5px; font-weight: 800; letter-spacing: -.035em; }
.brand span {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--blue);
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .16em;
}

.quit {
  margin-left: auto;
  padding: 9px 14px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 31, 29, .16);
}
.quit:disabled { opacity: .52; cursor: not-allowed; }

.resources { display: flex; gap: 11px; padding: 4px 17px 13px; }
.resource { flex: 1; min-width: 0; }
.resource-label {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 7.7px;
  font-weight: 900;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.resource.low .resource-label { color: var(--red); }
.resource-glyph {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  color: currentColor;
}
.resource:not(.low) .resource-glyph { color: var(--blue); }
.resource-glyph svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.bar { height: 3px; overflow: hidden; border-radius: 99px; background: rgba(33, 74, 112, .14); }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width .3s ease; }
.resource.low .bar i { background: var(--red); }
.resource.is-preview { transform: translateY(-2px); }
.resource.is-preview .bar { box-shadow: 0 0 0 2px rgba(22, 119, 210, .16); }

.messenger-scene {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}
.phone[data-view="onboarding"] .messenger-scene {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.phone[data-view="saved"] .messenger-scene {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.scene--card {
  position: relative;
  isolation: isolate;
  margin: 0 10px 10px;
  border: 0;
  border-radius: 26px;
  background: linear-gradient(180deg, var(--scene-top) 0%, var(--scene-mid) 34%, var(--scene-low) 62%, rgba(255, 255, 255, .97) 82%);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
  box-shadow: 0 18px 42px -18px rgba(35, 77, 114, .36), 0 5px 16px -11px rgba(35, 77, 114, .24);
}
.scene--card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(255,255,255,.52) 24%, rgba(102,158,199,.2) 58%, rgba(35,77,114,.035));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.scene--card::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: 25px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.11), transparent 18%, transparent 72%, rgba(35,77,114,.025));
}
.scene--card > * { position: relative; }

.contact {
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 12px 12px 8px;
  padding: 11px 13px;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(35, 77, 114, .09);
}
.avatar, .mini-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(150deg, #6eb4ef, #176fc0);
  color: #fff;
  font-weight: 850;
}
.avatar { width: 36px; height: 36px; font-size: 13px; }
.contact__text { min-width: 0; flex: 1; }
.contact__text b { display: block; overflow: hidden; font-size: 15.5px; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.contact__text i { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-style: normal; }
.more { color: var(--muted); font-size: 16px; }

.pinned {
  z-index: 1;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 7px;
  padding: 9px 13px;
  border: 0;
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(35, 77, 114, .09);
}
.pin { font-size: 13px; line-height: 1; }
.pinned > span:last-child { min-width: 0; }
.pinned small { display: block; color: var(--blue); font-size: 8.5px; font-weight: 900; letter-spacing: .13em; }
.pinned b { display: block; margin-top: 2px; overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.chat {
  min-height: 0;
  padding: 8px 10px 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
  z-index: 2;
}
.phone[data-view="onboarding"] .chat {
  justify-content: flex-end;
  padding-bottom: 11px;
}
.message-row { display: flex; align-items: flex-end; gap: 9px; }
.mini-avatar { width: 28px; height: 28px; margin-bottom: 2px; font-size: 9.5px; }
.message-stack { min-width: 0; max-width: calc(100% - 37px); display: flex; flex-direction: column; gap: 6px; }
.message {
  position: relative;
  max-width: 100%;
  padding: 13px 14px 11px;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(35, 77, 114, .13);
}
.message:not(:last-child) { border-bottom-left-radius: 9px; }
.message + .message { border-top-left-radius: 9px; }
.message p { margin: 0; font-size: var(--message-font-size); line-height: 1.42; letter-spacing: -.014em; }
.message p + p { margin-top: 9px; }
.forwarded-content { border-left: 1px solid var(--blue); padding-left: 9px; }
.forwarded-label {
  display: block;
  margin-bottom: 6px;
  color: var(--nickname-color, #1264a6);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.messenger-scene[data-active-card="LIVE_AGENT_05"] .message-stack > .message:first-child p + p { margin-top: 0; }
.mention { font-family: system-ui, sans-serif; font-weight: 550; color: var(--ink); }
.message p > span { display: block; }
.message p > span + span { margin-top: 4px; }
.message-clearance { height: var(--message-clearance); flex: 0 0 var(--message-clearance); }
.messenger-scene[data-active-card^="INFLUENCER_"] .chat,
.messenger-scene[data-active-card^="LIVE_AGENT_"] .chat {
  justify-content: safe flex-end;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.messenger-scene[data-active-card^="INFLUENCER_"] .chat::-webkit-scrollbar,
.messenger-scene[data-active-card^="LIVE_AGENT_"] .chat::-webkit-scrollbar { display: none; }
.chat.has-chat-history {
  position: relative;
  justify-content: safe flex-end;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  overflow-anchor: none;
}
.chat.has-chat-history::-webkit-scrollbar { display: none; }
.chat.has-chat-history > * { flex-shrink: 0; }
.chat.has-chat-history .message { flex-shrink: 0; }
.chat.has-chat-history .message-stack { flex: 1; }
.chat.has-chat-history .image-bubble { transition-property: none; }
.chat-player-reply { flex-shrink: 0; margin-block: 4px; }
.media-placeholder {
  width: min(210px, 100%);
  min-height: 62px;
  border: 1px dashed rgba(74, 102, 126, .42);
  background: rgba(235, 241, 245, .94);
  color: #607385;
  box-shadow: 0 7px 18px rgba(35, 77, 114, .1);
}
.message.media-placeholder {
  display: grid;
  place-items: center;
  padding: 10px 12px;
}
.media-placeholder__label {
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -.005em;
  text-align: center;
}
.image-bubble {
  width: min(280px, 100%);
  overflow: hidden;
  padding: 0;
  background: #fff;
}
.message-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--image-ratio, 16 / 9);
  object-fit: cover;
  background: #e7edf2;
}
.image-bubble.has-caption .message-image { aspect-ratio: var(--image-ratio); }
.message-caption { padding: 10px 14px 11px; }
.typing-bubble {
  width: 64px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 15px 16px;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(35, 77, 114, .13);
  animation: messagePop .3s cubic-bezier(.2,.9,.3,1.1) both;
}
.typing-bubble i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9eafbf;
  animation: typingBlink 1.1s infinite;
}
.typing-bubble i:nth-child(2) { animation-delay: .18s; }
.typing-bubble i:nth-child(3) { animation-delay: .36s; }
.stamp { position: absolute; right: 12px; bottom: 7px; color: rgba(255, 255, 255, .74); font-size: 9px; }
.date-chip { align-self: center; padding: 4px 9px; border-radius: 99px; background: rgba(255,255,255,.72); color: var(--muted); font-size: 9.5px; }

.phone[data-view="saved"] .avatar { background: linear-gradient(145deg, #6db4f5, #3d86dc); }
.phone[data-view="saved"] .message-row { justify-content: flex-end; }
.phone[data-view="saved"] .message-avatar { display: none; }
.phone[data-view="saved"] .message-stack { max-width: 100%; align-items: flex-end; }
.phone[data-view="saved"] .message { max-width: calc(100% - 18px); border-radius: 18px 18px 6px 18px; background: linear-gradient(145deg, #4c9de4, #1874c8); color: #fff; }
.phone[data-view="saved"] .message p { padding-right: 22px; }

.team-scene {
  background: linear-gradient(180deg, rgba(201, 222, 237, .86) 0%, rgba(230, 240, 246, .92) 42%, rgba(247, 250, 252, .96) 70%, rgba(255, 255, 255, .98) 100%);
}
.team-contact .avatar {
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.team-chat { gap: 7px; padding-top: 5px; }
.team-chat .message-clearance { height: 5px; flex: 0 0 5px; }
.self-message {
  align-self: flex-end;
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 16px 16px 6px 16px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 7px 18px rgba(22, 119, 210, .18);
}
.self-message p, .team-bubble p { margin: 0; font-size: var(--message-font-size); line-height: 1.34; letter-spacing: -.01em; }
.team-row { display: flex; align-items: flex-end; gap: 7px; }
.member-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  margin-bottom: 2px;
  border-radius: 50%;
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  background: linear-gradient(150deg, #6eb4ef, #176fc0);
}
.team-row[data-source="@bigdeals"] .member-avatar { background: linear-gradient(150deg, #e2a966, #b96d25); }
.team-row[data-source="@hype_queen"] .member-avatar { background: linear-gradient(150deg, #bd8ddb, #7152b2); }
.team-bubble {
  max-width: calc(100% - 34px);
  padding: 9px 11px 8px;
  border-radius: 16px 16px 16px 6px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(35, 77, 114, .12);
}
.team-bubble.media-placeholder {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 9px 11px;
}
.team-bubble.media-placeholder .team-meta { align-self: stretch; }
.team-bubble.image-bubble { padding: 0; }
.team-bubble.image-bubble .team-meta { margin: 0; padding: 7px 10px 5px; }
.team-meta { display: block; margin-bottom: 4px; color: var(--nickname-color, #1677bd); font-size: 9.5px; font-weight: 600; }
.team-row[data-source="@bigdeals"] { --nickname-color: #277482; }
.team-row[data-source="@error404"],
.team-row[data-source="@error_404"] { --nickname-color: #595f98; }
.team-row[data-source="@hype_queen"] { --nickname-color: #706387; }
.team-row[data-source="@head_of_innovations"] { --nickname-color: #46637f; }
.team-row[data-source="@b2buddy_120"],
[data-forwarded-from="@b2buddy_120"] { --nickname-color: #226e99; }
.team-row[data-source="@b2buddy_389"],
[data-forwarded-from="@b2buddy_389"] { --nickname-color: #426594; }
.team-role { color: var(--muted); font-weight: 400; }
.team-bubble p.message-paragraph-start { margin-top: 8px; }
.team-scene .choice { font-size: 12.2px; }

.irl-scene { background: #d2dbe1; }
.irl-scene::before { background: #d2dbe1; }
.irl-scene::after {
  inset: 1px;
  background:
    linear-gradient(180deg, rgba(7, 20, 32, .12), rgba(7, 20, 32, .22) 48%, rgba(7, 20, 32, .38)),
    url("assets/irl-padel-court.webp") center 54% / cover no-repeat;
  filter: blur(1.8px) saturate(.88);
  clip-path: inset(0 round 25px);
}
.irl-contact .avatar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #6eb4ef, #176fc0);
}
.irl-avatar-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.irl-contact .contact__text b { font-size: 15px; }
.irl-location { margin-bottom: 7px; cursor: default; }
.irl-chat {
  display: grid;
  place-items: center;
  justify-content: center;
  padding: 22px 16px 18px;
  overflow: hidden;
}
.irl-dialog {
  width: min(270px, 100%);
  padding: 16px 17px 15px;
  border-radius: 20px;
  background: #fff;
  color: #17212b;
  box-shadow: 0 12px 32px rgba(7, 20, 32, .22);
}
.irl-dialog p { margin: 0; font-size: var(--message-font-size); font-weight: 400; line-height: 1.38; letter-spacing: -.012em; }
.irl-scene .choices { padding-top: 4px; }
.irl-scene .choice { font-size: 12.2px; }

.reply-hint-dock { position: relative; padding: 4px 10px 8px; z-index: 3; }
.reply-hint {
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 5px 3px 14px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,.68), rgba(245,250,253,.45));
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 8px 22px rgba(35,77,114,.10);
  color: #607385;
  font-size: 12.25px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.01em;
}
.reply-hint__text { flex: 1; min-width: 0; }
.reply-hint__arrow {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  color: #2f78b7;
  box-shadow: 0 3px 11px rgba(35,77,114,.12), inset 0 0 0 1px rgba(255,255,255,.92);
}
.reply-hint__arrow svg { width: 12px; height: 12px; }

.choices {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 10px 13px;
}
.phone[data-view="onboarding"] .choices { grid-template-columns: 1fr; padding-top: 5px; }
.choices[data-reserved] { visibility: hidden; }
.choice {
  min-height: 58px;
  padding: 10px 12px;
  border: 0;
  border-radius: 999px;
  color: #08345c;
  background: linear-gradient(135deg, #68aee9, #add2f1 56%, #d2e5f5);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.018em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(31, 39, 37, .09);
  transition: transform .15s ease, filter .15s ease;
}
.choice--right { color: #202b36; background: linear-gradient(135deg, #aab5c2, #cdd4dc 56%, #e1e5e9); }
@media (hover: hover) and (pointer: fine) {
  .choice:hover:not(:disabled), .choice:focus-visible:not(:disabled) { transform: translateY(-2px); filter: saturate(1.08); outline: none; }
}
.choice:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.choice:disabled { cursor: default; opacity: .62; filter: grayscale(.16); }

.system-label { display: block; margin-bottom: 9px; color: #cf443d; font-size: 11px; letter-spacing: .12em; }
.ending-title { display: block; margin-bottom: 10px; font-size: 17px; line-height: 1.08; letter-spacing: -.02em; }

.pin-sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16,26,40,.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.pin-sheet__card { width: 100%; max-height: 100%; overflow-y: auto; padding: 12px; border-radius: 20px; background: #dce9f2; box-shadow: 0 26px 60px rgba(16,26,40,.4); }
.pin-sheet__head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; color: var(--muted); font-size: 11px; }
.pin-sheet__close { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ink); color: #fff; cursor: pointer; }
.pin-sheet .message { max-width: 100%; }
.pin-sheet .message p > span { margin-top: 0; }

.phone[data-outcome="success"] {
  --outcome-rgb: 29, 137, 88;
  --outcome-ink: #12613c;
  --outcome-wash: #d5eddf;
}
.phone[data-outcome="failure"] {
  --outcome-rgb: 184, 53, 66;
  --outcome-ink: #922c37;
  --outcome-wash: #f1d8d8;
}
.phone[data-outcome="catastrophic"] {
  --outcome-rgb: 150, 30, 47;
  --outcome-ink: #802330;
  --outcome-wash: #dec4c7;
  --outcome-resting-opacity: .6;
}
.phone[data-outcome] {
  background: linear-gradient(180deg, var(--outcome-wash), #f4f7f6);
}
.phone[data-outcome] .scene--card {
  background: linear-gradient(180deg, rgba(var(--outcome-rgb), .12), rgba(255,255,255,.82) 65%, #fff);
}
.phone[data-outcome] .scene--card::before {
  background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(var(--outcome-rgb), .4));
}
.phone[data-outcome] .scene--card:not(.irl-scene)::after {
  z-index: 5;
  background: transparent;
  box-shadow: inset 0 0 28px rgba(var(--outcome-rgb), .36);
  opacity: var(--outcome-resting-opacity, .35);
}
.outcome-banner {
  z-index: 1;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 12px 7px;
  padding: 9px 13px;
  border-radius: 15px;
  background: rgba(255,255,255,.8);
  color: var(--outcome-ink);
  box-shadow: 0 8px 22px rgba(var(--outcome-rgb), .1);
}
.outcome-banner b { font-size: 14px; font-weight: 800; letter-spacing: .12em; }
.phone[data-outcome].is-outcome-entering .scene--card::after {
  animation: outcomePulse .62s cubic-bezier(.16, 1, .3, 1) both;
}
.scene--card > .outcome-glow {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  border: 3px solid rgba(29, 137, 88, .65);
  background: radial-gradient(ellipse at 50% 100%, rgba(48, 191, 123, .28), rgba(48, 191, 123, .06) 55%, transparent 80%);
  box-shadow: inset 0 0 36px rgba(29, 137, 88, .4);
}
.phone[data-outcome="success"].is-outcome-entering .scene--card {
  animation: outcomeSuccess .7s cubic-bezier(.16, 1, .3, 1);
}
.phone[data-outcome="success"].is-outcome-entering .outcome-glow {
  animation: outcomeSuccessGlow .9s ease-out both;
}
.phone[data-outcome="failure"].is-outcome-entering .scene--card,
.phone[data-outcome="catastrophic"].is-outcome-entering .scene--card {
  animation: outcomeJolt .36s ease-out;
}
.phone[data-outcome="catastrophic"].is-outcome-entering .message-image.is-outcome-image-ready {
  animation: outcomeSignal .42s steps(1, end);
}
.irl-scene > .outcome-glow {
  background: none;
  box-shadow: none;
}
.phone[data-outcome].is-outcome-entering .irl-scene::after { animation: none; }
.phone[data-outcome].is-outcome-entering .irl-scene::before {
  animation: outcomePulse .62s cubic-bezier(.16, 1, .3, 1) both;
}
.phone[data-outcome] .irl-dialog {
  box-shadow: 0 0 0 1px rgba(var(--outcome-rgb), .35), 0 8px 28px rgba(var(--outcome-rgb), .22);
}
@keyframes outcomePulse {
  0% { opacity: var(--outcome-resting-opacity, .35); }
  28% { opacity: 1; }
  100% { opacity: var(--outcome-resting-opacity, .35); }
}
@keyframes outcomeSuccess {
  0% { transform: scale(.985); }
  38% { transform: scale(1.012); }
  100% { transform: scale(1); }
}
@keyframes outcomeSuccessGlow {
  0% { opacity: 0; transform: scale(.97); }
  30% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.025); }
}
@keyframes outcomeJolt {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-2px); }
  45% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
}
@keyframes outcomeSignal {
  0%, 100% { transform: none; filter: none; }
  16% { transform: translateX(3px) skewX(.6deg); filter: grayscale(.55); }
  35% { transform: translateX(-2px); filter: grayscale(.25); }
  58% { transform: translateX(1px); filter: none; }
  78% { transform: none; filter: none; }
}

@keyframes messagePop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes typingBlink { 0%, 60%, 100% { opacity: .32; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-1px); } }
.message.is-pop, .self-message.is-pop, .team-row.is-pop { animation: messagePop .3s cubic-bezier(.2,.9,.3,1.1) both; }

/* Breakpoints follow the portrait stage, including a rotated phone viewport. */
@media (max-width: 340px) and (orientation: portrait),
       (max-width: 340px) and (pointer: fine),
       (max-height: 340px) and (pointer: coarse) and (orientation: landscape) {
  .frame { border-radius: 0; }
  .scene--card { margin-inline: 6px; }
  .resources { gap: 7px; padding-inline: 12px; }
  .resource-label { font-size: 7px; }
}

@media (max-height: 700px) and (orientation: portrait),
       (max-height: 700px) and (pointer: fine),
       (max-width: 700px) and (pointer: coarse) and (orientation: landscape) {
  .frame { border-radius: 0; }
  .top { padding-top: 10px; padding-bottom: 7px; }
  .resources { padding-bottom: 8px; }
  .contact { margin-top: 8px; padding-block: 8px; }
  .phone[data-view="saved"] .message { max-width: 100%; padding-block: 9px 8px; }
  .choice { min-height: 52px; }
}

/* Counter-rotate the whole stage; layout, scrolling and touch targets stay portrait. */
@media (pointer: coarse) and (orientation: landscape) {
  :root {
    --game-width: 100svh;
    --game-height: 100svw;
    --game-safe-top: env(safe-area-inset-right);
    --game-safe-right: env(safe-area-inset-bottom);
    --game-safe-bottom: env(safe-area-inset-left);
    --game-safe-left: env(safe-area-inset-top);
  }
  :root[data-portrait-direction="reverse"] {
    --game-safe-top: env(safe-area-inset-left);
    --game-safe-right: env(safe-area-inset-top);
    --game-safe-bottom: env(safe-area-inset-right);
    --game-safe-left: env(safe-area-inset-bottom);
  }
  .app, .test-details {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(var(--portrait-rotation, 90deg));
  }
  .test-details { margin: 0; }
}
