/* ================================================================
   PHONE DESIGN TOKENS — current phone-shell pages
   ================================================================
   Ported from the Claude Design "PolyConnect Design System" project
   (795b32cd). Legacy feature pages continue to load style.css, which
   imports this file so both page families share the same light/dark
   palette without losing their established component styles.
   Desktop keeps its separate desktop-tokens.css layout layer.
   ================================================================ */

@import url('./shared-brand-palette.css');
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Native form-control / scrollbar rendering (inherits to <body>) */
  color-scheme: dark;

  /* Background / depth */
  --color-bg: var(--pc-palette-bg);
  --color-bg-deep: var(--pc-palette-bg-deep);
  --color-surface-1: var(--pc-palette-surface-1);
  --color-surface-2: var(--pc-palette-surface-2);
  --color-surface-3: var(--pc-palette-surface-3);

  /* Line / divider */
  --color-line: var(--pc-palette-line);
  --color-line-strong: var(--pc-palette-line-strong);

  /* Text / foreground */
  --color-fg: var(--pc-palette-fg);
  --color-fg-2: var(--pc-palette-fg-2);
  --color-fg-3: var(--pc-palette-fg-3);
  --color-white: #ffffff;

  /* Jade / brand */
  --color-jade: var(--pc-palette-jade);
  --color-jade-deep: var(--pc-palette-jade-deep);
  --color-jade-pale: var(--pc-palette-jade-pale);

  /* Copper / warm accent */
  --color-copper: var(--pc-palette-copper);
  --color-copper-deep: var(--pc-palette-copper-deep);

  /* Antique gold / premium accent */
  --color-gold: var(--pc-palette-gold);
  --color-gold-deep: var(--pc-palette-gold-deep);

  /* Danger / red */
  --color-red: var(--pc-palette-danger);
  --color-red-deep: var(--pc-palette-danger-deep);

  /* Glass overlay */
  --color-glass: rgba(12, 26, 26, 0.9);
  --color-glass-light: rgba(255, 255, 255, 0.035);

  /* Polytechnic badges */
  --color-poly-sp: var(--pc-palette-poly-sp);
  --color-poly-np: var(--pc-palette-poly-np);
  --color-poly-tp: var(--pc-palette-poly-tp);
  --color-poly-nyp: var(--pc-palette-poly-nyp);
  --color-poly-rp: var(--pc-palette-poly-rp);

  /* Semantic — page & surface */
  --bg: var(--color-bg);
  --bg-deep: var(--color-bg-deep);
  --panel: var(--color-surface-1);
  --soft: var(--color-surface-2);
  --soft-2: var(--color-surface-3);

  /* Semantic — text */
  --ink: var(--color-fg);
  --ink-2: var(--color-fg-2);
  --muted: var(--color-fg-3);

  /* Semantic — borders */
  --line: var(--color-line);
  --line-strong: var(--color-line-strong);

  /* Semantic — brand */
  --brand: var(--color-jade);
  --brand-dark: var(--color-jade-deep);
  --brand-pale: var(--color-jade-pale);

  /* Semantic — accents */
  --accent: var(--color-copper);
  --accent-dark: var(--color-copper-deep);
  --premium: var(--color-gold);
  --premium-dark: var(--color-gold-deep);

  /* Semantic — feedback */
  --color-success: var(--color-jade);
  --color-warning: var(--color-copper);
  --color-danger: var(--color-red);
  --color-required: var(--color-red);
  --color-success-bg: rgba(52, 202, 160, 0.11);
  --color-success-border: rgba(52, 202, 160, 0.28);
  --color-danger-bg: rgba(221, 97, 106, 0.11);
  --color-danger-border: rgba(221, 97, 106, 0.3);

  /* Typography */
  --font-display: 'Instrument Serif', 'Iowan Old Style', serif;
  --font-sans: 'Manrope', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --text-2xs: 0.68rem;
  --text-xs: 0.72rem;
  --text-sm: 0.78rem;
  --text-base: 1rem;
  --text-md: 1.05rem;
  --text-lg: 1.2rem;
  --text-xl: 1.4rem;
  --text-2xl: 1.75rem;
  --font-regular: 400;
  --font-medium: 500;
  --font-bold: 700;
  --font-black: 800;
  --leading-tight: 0.98;
  --leading-snug: 1.08;
  --leading-normal: 1.62;
  --tracking-wide: 0.14em;
  --tracking-wider: 0.18em;
  --tracking-mono: 0.22em;

  /* Radius */
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 22px;
  --radius-xl: 24px;
  --radius-2xl: 28px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 36px 80px rgba(0, 0, 0, 0.42);
  --shadow-jade: 0 16px 34px rgba(52, 202, 160, 0.24);
  --shadow-gold: 0 16px 34px rgba(207, 159, 82, 0.22);

  /* Motion */
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 360ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: ease-in;
  --ease-inout: ease-in-out;
  --transition-base: var(--duration-base) var(--ease-out);
}

/* ----------------------------------------------------------------
   THEME OVERRIDE — mirrors tokens.css's :root.theme-light pattern.
   The bare :root above is this file's original dark theme. Applying
   .theme-light to <html> (done by app-shell.js's applyTheme()) swaps
   the primitives below; every semantic alias above already resolves
   through var(), so it repaints automatically.
   ---------------------------------------------------------------- */
:root.theme-light {
  color-scheme: light;

  /* Background / depth */
  --color-bg: var(--pc-palette-bg);
  --color-bg-deep: var(--pc-palette-bg-deep);
  --color-surface-1: var(--pc-palette-surface-1);
  --color-surface-2: var(--pc-palette-surface-2);
  --color-surface-3: var(--pc-palette-surface-3);

  /* Line / divider */
  --color-line: var(--pc-palette-line);
  --color-line-strong: var(--pc-palette-line-strong);

  /* Text / foreground */
  --color-fg: var(--pc-palette-fg);
  --color-fg-2: var(--pc-palette-fg-2);
  --color-fg-3: var(--pc-palette-fg-3);
  --color-white: #ffffff;

  /* Jade / brand — deepened for AA contrast on a light surface */
  --color-jade: var(--pc-palette-jade);
  --color-jade-deep: var(--pc-palette-jade-deep);
  --color-jade-pale: var(--pc-palette-jade-pale);

  /* Copper / warm accent — deepened for AA contrast on a light surface */
  --color-copper: var(--pc-palette-copper);
  --color-copper-deep: var(--pc-palette-copper-deep);

  /* Antique gold / premium accent — deepened for AA contrast */
  --color-gold: var(--pc-palette-gold);
  --color-gold-deep: var(--pc-palette-gold-deep);

  /* Danger / red — deepened for AA contrast on a light surface */
  --color-red: var(--pc-palette-danger);
  --color-red-deep: var(--pc-palette-danger-deep);

  /* Glass overlay */
  --color-glass: rgba(255, 255, 255, 0.9);
  --color-glass-light: rgba(13, 31, 28, 0.035);

  /* Feedback surfaces (not primitive-derived, restated to match the
     deepened light-theme brand colours) */
  --color-success-bg: rgba(31, 154, 124, 0.1);
  --color-success-border: rgba(31, 154, 124, 0.28);
  --color-danger-bg: rgba(198, 45, 54, 0.08);
  --color-danger-border: rgba(198, 45, 54, 0.28);
}

/* ── Focus ring — mirrors tokens.css's rule for the main-shell pages ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Reduced motion — OS preference + account-level override ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html.motion-reduce *,
html.motion-reduce *::before,
html.motion-reduce *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ── High contrast — account-level override ── */
html.contrast-high {
  --color-line: var(--color-line-strong);
  --color-line-strong: currentColor;
}

html.contrast-high:not(.theme-light) {
  --color-fg: #ffffff;
  --color-fg-2: #ffffff;
  --color-fg-3: #f4f1ea;
}

html.contrast-high.theme-light {
  --color-fg: #000000;
  --color-fg-2: #000000;
  --color-fg-3: #0d1f1c;
}

html.contrast-high a:focus-visible,
html.contrast-high button:focus-visible,
html.contrast-high input:focus-visible,
html.contrast-high select:focus-visible,
html.contrast-high textarea:focus-visible,
html.contrast-high summary:focus-visible,
html.contrast-high [tabindex]:focus-visible {
  outline-width: 3px;
}

html,
body {
  margin: 0;
  background: var(--bg-deep);
  overscroll-behavior-y: none;
}

* {
  box-sizing: border-box;
}

.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;
}

button,
input {
  font: inherit;
}

/* App.polyLogoMarkup()'s SVG marks (app-shell.js) have no intrinsic size —
   this makes them fill whatever container places them, matching the sizing
   style.css defines for .poly-badge on the non-phone pages. */
.poly-badge-logo {
  width: 100%;
  height: 100%;
  display: block;
}

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

a:hover {
  color: var(--brand-pale);
}

@keyframes pcScaleIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pcLogoIn {
  0% {
    opacity: 0;
    transform: scale(0.4);
    filter: blur(8px);
  }
  55% {
    opacity: 1;
    transform: scale(1.08);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pcBurst {
  0% {
    opacity: 0.9;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(3.4);
  }
}

@keyframes pcWordIn {
  0% {
    opacity: 0;
    letter-spacing: 0.5em;
    transform: translateY(10px);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    letter-spacing: 0.02em;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes pcOrbPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 34px 4px rgba(52, 202, 160, 0.5),
      0 0 90px 12px rgba(52, 202, 160, 0.22);
  }
  50% {
    transform: scale(1.16);
    box-shadow:
      0 0 54px 8px rgba(52, 202, 160, 0.75),
      0 0 130px 22px rgba(52, 202, 160, 0.3);
  }
}

@keyframes pcHintBlink {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.9;
  }
}

@keyframes pcFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pcShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes pcConfetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(480px) rotate(340deg);
    opacity: 0;
  }
}

@keyframes pcFloat {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(12px, -16px);
  }
}

@keyframes pcPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pcGlowPulse {
  0%,
  100% {
    box-shadow: 0 0 34px rgba(52, 202, 160, 0.35);
  }
  50% {
    box-shadow: 0 0 60px rgba(52, 202, 160, 0.6);
  }
}

@keyframes pcHeartBeat {
  0% {
    transform: scale(0);
  }
  55% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pcSheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes pcTypingDot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes pcMatchFlash {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

@keyframes pcMatchRise {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.86);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Phone page shell ──
   Genuinely edge-to-edge on real phone-width viewports (no device
   bezel/notch graphic). On wider viewports (desktop browser tabs,
   the preview panel) it constrains to a phone-width column instead
   of stretching full-bleed — otherwise absolutely-positioned content
   built for a ~400px-wide screen pins to the top-left of the window. */
.phone-app {
  position: relative;
  /* A fixed height (not min-height) is required so the flex:1 + overflow-y:auto
     on .phone-app-scroll below actually caps this shell at one screen and
     scrolls its content internally — with only min-height, this container
     grows to fit tall content instead, and the whole outer page scrolls.
     vh is the fallback, dvh wins on browsers that support it — dvh accounts
     for mobile browser chrome (address bar) collapsing/expanding, avoiding
     the classic "page taller than the visible viewport" bug 100vh causes
     on phones. */
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow-x: clip;
  display: flex;
  flex-direction: column;
}

@media (min-width: 560px) {
  .phone-app {
    max-width: 430px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--line);
  }
}

.phone-app-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pc-btn-primary {
  height: 54px;
  border-radius: var(--radius-full);
  border: none;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  color: #052018;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-jade);
  transition: all 200ms var(--ease-out);
}

.pc-btn-primary:disabled {
  background: var(--line-strong);
  box-shadow: none;
  opacity: 0.5;
  cursor: default;
}

.pc-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.pc-btn-ghost {
  height: 46px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.pc-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 160ms var(--ease-out);
  flex: 0 0 auto;
}

.pc-icon-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.pc-field {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.pc-field input {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 0 16px;
  outline: none;
  font-size: 15px;
}

.pc-toast {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 92px;
  max-width: 360px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  text-align: center;
  color: var(--ink);
  font-size: 13px;
  z-index: 400;
  animation: pcFadeUp 260ms var(--ease-out) both;
}

/* ================================================================
   APP SHELL — app.html only (5-tab phone experience)
   ================================================================ */

.pc-app-bg {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 16% 10%, rgba(52, 202, 160, 0.12), transparent 34%),
    radial-gradient(circle at 86% 16%, rgba(221, 138, 76, 0.08), transparent 30%), var(--bg-deep);
}

/* Scroll region sits above the fixed tab bar */
.pc-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px calc(96px + env(safe-area-inset-bottom, 0px));
}

.pc-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 54px 0 14px;
  background: linear-gradient(180deg, var(--bg-deep) 62%, transparent);
}

.pc-eyebrow {
  margin: 0;
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.pc-title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.02;
  color: var(--ink);
}

.pc-title .grad {
  background: linear-gradient(135deg, var(--brand), var(--premium) 52%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pc-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--ink) 3.5%, transparent);
  padding: 18px;
}

.pc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 160ms var(--ease-out);
}

.pc-chip.active {
  border-color: rgba(52, 202, 160, 0.45);
  background: rgba(52, 202, 160, 0.14);
  color: var(--ink);
}

.pc-poly-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.pc-avatar {
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #052018;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  background-size: cover;
  background-position: center;
}

.pc-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.pc-meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--premium));
  transition: width 480ms var(--ease-out);
}

/* ── Story rail (Home) ── */
.pc-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 6px;
  scrollbar-width: none;
}

.pc-rail::-webkit-scrollbar {
  display: none;
}

.pc-story {
  flex: 0 0 auto;
  width: 78px;
  text-align: center;
  cursor: pointer;
}

.pc-story-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  padding: 3px;
  margin: 0 auto 6px;
  background: linear-gradient(135deg, var(--brand), var(--premium), var(--accent));
}

.pc-story-ring > span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #052018;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  background-size: cover;
  background-position: center;
  border: 2px solid var(--bg);
}

/* ── Discover swipe deck ── */
.pc-deck {
  position: relative;
  margin-top: 8px;
  height: 62vh;
  min-height: 440px;
}

.pc-swipe-card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: var(--color-surface-1, var(--surface, #ffffff));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  will-change: transform;
}

.pc-swipe-card.behind {
  transform: scale(0.94) translateY(16px);
  filter: brightness(0.7);
  pointer-events: none;
}

.pc-swipe-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.pc-swipe-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 30%,
    rgba(3, 6, 7, 0.35) 55%,
    rgba(3, 6, 7, 0.94)
  );
}

.pc-swipe-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
}

.pc-swipe-stamp {
  position: absolute;
  top: 26px;
  padding: 8px 16px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 120ms linear;
}

.pc-swipe-stamp.like {
  right: 20px;
  color: var(--brand);
  border: 3px solid var(--brand);
  transform: rotate(12deg);
}

.pc-swipe-stamp.nope {
  left: 20px;
  color: var(--color-red);
  border: 3px solid var(--color-red);
  transform: rotate(-12deg);
}

.pc-deck-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 18px;
}

.pc-round-btn {
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}

.pc-round-btn:active {
  transform: scale(0.9);
}

.pc-round-btn.pass {
  width: 60px;
  height: 60px;
  color: var(--color-red);
}

.pc-round-btn.like {
  width: 72px;
  height: 72px;
  border: none;
  color: #052018;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  box-shadow: var(--shadow-jade);
}

.pc-round-btn.info {
  width: 52px;
  height: 52px;
  color: var(--premium);
}

/* ── Conversation list + thread ── */
.pc-conv {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 160ms var(--ease-out);
}

.pc-conv:active {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.pc-unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #052018;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* Fills the scrollport (.pc-scroll) height even for a short conversation, so
   .pc-thread's flex:1 below has room to push .pc-composer down to the true
   bottom instead of leaving it stranded right after the last message with
   empty space beneath. When messages overflow this height, the view grows
   past 100% and .pc-scroll scrolls it as usual. */
.pc-thread-view {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.pc-thread {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 10px;
  padding: 8px 0 4px;
}

.pc-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.pc-bubble.them {
  align-self: flex-start;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}

.pc-bubble.me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  color: #052018;
  font-weight: 500;
  border-bottom-right-radius: 6px;
}

.pc-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 13px 16px;
  border-radius: 20px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.pc-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: pcTypingDot 1.1s ease-in-out infinite;
}

.pc-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.pc-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

/* Sticky (not static) so the composer stays pinned to the bottom of the
   .pc-scroll scrollport instead of flowing inline after the last message -
   on a short thread that left it stranded mid-screen with empty space below
   it, and on a long thread it would scroll out of reach entirely. Sticks
   just above .pc-tabbar, which .pc-scroll's bottom padding already reserves
   room for. */
.pc-composer {
  position: sticky;
  bottom: 0;
  z-index: 25;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  background: linear-gradient(0deg, var(--bg-deep) 65%, transparent);
}

.pc-composer input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
  padding: 0 18px;
  outline: none;
  font-size: 14px;
}

.pc-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  color: #052018;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: var(--shadow-jade);
}

/* ── Bottom tab bar ── */
.pc-tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--color-glass);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

.pc-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: color 160ms var(--ease-out);
}

.pc-tab svg {
  width: 22px;
  height: 22px;
}

.pc-tab.active {
  color: var(--brand);
}

.pc-tab-badge {
  position: absolute;
  transform: translate(14px, -4px);
  min-width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

/* ── Match overlay ── */
.pc-match {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 30px;
  background: radial-gradient(circle at 50% 40%, rgba(52, 202, 160, 0.18), rgba(3, 6, 7, 0.97));
  backdrop-filter: blur(6px);
}

.pc-match-flash {
  position: absolute;
  inset: 0;
  background: var(--brand);
  animation: pcMatchFlash 900ms var(--ease-out) both;
  pointer-events: none;
}

.pc-match-avatars {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
  animation: pcMatchRise 700ms var(--ease-out) both;
}

.pc-match-avatars .pc-avatar {
  width: 92px;
  height: 92px;
  font-size: 26px;
  border: 3px solid var(--brand);
  box-shadow: var(--shadow-jade);
}

.pc-match-heart {
  color: var(--brand);
  animation: pcHeartBeat 700ms var(--ease-out) 200ms both;
}

/* ── Bottom sheet (profile detail) ── */
.pc-sheet-scrim {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(3, 6, 7, 0.68);
  backdrop-filter: blur(3px);
  animation: pcMatchFlash 300ms linear both;
  animation-fill-mode: forwards;
  opacity: 1;
}

.pc-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  max-height: 86%;
  overflow-y: auto;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  background: var(--panel);
  border-top: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xl);
  padding: 0 22px calc(28px + env(safe-area-inset-bottom, 0px));
  animation: pcSheetUp 340ms var(--ease-out) both;
}

.pc-sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 12px auto 8px;
}

/* ── Generic modal (confirm dialogs) — App.openModal()/closeModal() ──
   Phone-page styling for the same markup style.css styles on the
   main-shell pages; keep both in sync if the modal markup changes. */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 7, 0.68);
  backdrop-filter: blur(3px);
}

.modal {
  position: relative;
  z-index: 501;
  width: min(380px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xl);
  animation: pcSheetUp 240ms var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  .modal {
    animation: none;
  }
}

.modal-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--ink);
}

.modal-body {
  margin: 0 0 20px;
  color: var(--ink-2);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  min-width: 92px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font: inherit;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: transform var(--transition-base);
}

.modal-btn:hover {
  transform: translateY(-1px);
}

.modal-btn-cancel {
  color: var(--ink);
  background: var(--color-glass-light);
  border-color: var(--line-strong);
}

.modal-btn-confirm.modal-btn-primary {
  color: #052018;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
}

.modal-btn-confirm.modal-btn-danger {
  color: #2a0507;
  background: linear-gradient(135deg, #f2969c, var(--color-red));
}

.pc-fab {
  position: absolute;
  right: 20px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--brand-pale), var(--brand));
  color: #052018;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-jade);
}

/* ── Empty state placeholder (notifications.js emptyState()) ── */
.pc-empty-state {
  display: block;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: var(--soft);
}

/* ── Settings-style rows: toggle switch + select field ── */
.pc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.pc-row:last-child {
  border-bottom: none;
}

.pc-row-copy strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.pc-row-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pc-toggle {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
}

.pc-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.pc-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--line-strong);
  transition: background 160ms var(--ease-out);
  pointer-events: none;
}

.pc-toggle-track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 160ms var(--ease-out);
}

.pc-toggle input:checked + .pc-toggle-track {
  background: var(--brand);
}

.pc-toggle input:checked + .pc-toggle-track::before {
  transform: translateX(18px);
  background: #052018;
}

.pc-select {
  height: 50px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--ink);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  width: 100%;
}

/* ── Shared toast (app-shell.js createToastRoot/showToast) restyled for the
   phone design — old style.css isn't loaded on phone-design pages. ── */
.toast-root {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 28px;
  z-index: 400;
  display: grid;
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}

.toast {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
  text-align: center;
  color: var(--ink);
  font-size: 13px;
  animation: pcFadeUp 260ms var(--ease-out) both;
}

.toast.tone-success {
  border-color: rgba(52, 202, 160, 0.35);
}

.toast.tone-red {
  border-color: rgba(224, 108, 108, 0.35);
}

.toast.tone-peach {
  border-color: rgba(221, 138, 76, 0.35);
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

/* ── Chat wallpaper picker (settings.html) ── */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.wallpaper-swatch {
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 160ms var(--ease-out);
}

.wallpaper-swatch:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 202, 160, 0.48);
}

.wallpaper-swatch.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(52, 202, 160, 0.14);
}

.wallpaper-swatch-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 8px;
  background: rgba(2, 4, 5, 0.62);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* ── Daily game card (Home) — spin-the-wheel + streak meter ── */
.pc-game-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pc-game-title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
}

.pc-streak-meter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pc-streak-meter .app-icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.pc-streak-freeze {
  margin-left: 4px;
  font-weight: 600;
  color: var(--muted);
}

.pc-wheel-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 20px auto 6px;
}

.pc-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  border: 3px solid var(--line-strong);
  background: conic-gradient(
    var(--brand) 0deg 72deg,
    var(--accent) 72deg 144deg,
    var(--premium) 144deg 216deg,
    var(--brand-dark) 216deg 288deg,
    var(--accent-dark) 288deg 360deg
  );
  transition: transform 2600ms cubic-bezier(0.16, 0.85, 0.2, 1);
  will-change: transform;
}

.pc-wheel.spinning {
  animation: pc-wheel-spin 900ms linear infinite;
}

@keyframes pc-wheel-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.pc-wheel-segment-label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  font-size: 12px;
  font-weight: 800;
  color: #052018;
}

.pc-wheel-segment-label > span {
  display: block;
  transform: translate(-50%, -50%);
}

.pc-wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 14px solid var(--ink);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.pc-wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--premium);
}

.pc-wheel-hub .app-icon {
  width: 18px;
  height: 18px;
}

.pc-game-spin-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border-radius: var(--radius-full);
  border: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #052018;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}

.pc-game-spin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pc-game-spin-btn:not(:disabled):active {
  transform: scale(0.97);
}

.pc-game-feedback {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  min-height: 18px;
}

.pc-game-feedback.success {
  color: var(--color-success);
}

/* ── Achievement showcase (Profile) ── */
.pc-achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pc-achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  color: var(--muted);
  text-align: center;
  opacity: 0.5;
  filter: grayscale(1);
}

.pc-achievement-badge.unlocked {
  color: var(--ink);
  opacity: 1;
  filter: none;
  border-color: rgba(52, 202, 160, 0.35);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.pc-achievement-icon .app-icon {
  width: 22px;
  height: 22px;
}

.pc-achievement-badge.unlocked .pc-achievement-icon .app-icon {
  color: var(--premium);
}

.pc-achievement-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
