/* ═══════════════════════════════════════════
   Parmisian Design System — Chapter 11
   ═══════════════════════════════════════════ */

/* --- CSS Variables --- */
:root {
  /* Colors */
  --bg:         #0a0a0f;
  --surface:    #12121a;
  --surface-2:  #1a1a26;
  --border:     #2a2a3a;
  --text:       #e8e6f0;
  --text-muted: #8a889a;
  --accent:     #ff3366;
  --accent-2:   #7c5cff;
  --green:      #22c55e;
  --amber:      #f59e0b;
  --blue:       #3b82f6;
  --danger:     #ef4444;

  /* Typography */
  --font-display: 'Instrument Serif', serif;
  --font-heading: 'Sora', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Spacing */
  --xs:  4px;
  --sm:  8px;
  --md:  16px;
  --lg:  24px;
  --xl:  32px;
  --2xl: 48px;

  /* Radii */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(255,51,102,0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --bottom-nav-height: 64px;
  --header-height: 56px;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.hidden { display: none !important; }

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 4vw, 1.75rem); }
h3 { font-size: clamp(1rem, 3vw, 1.25rem); }

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* --- App Container --- */
#app {
  min-height: 100dvh;
  padding-bottom: var(--bottom-nav-height);
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--md);
  animation: fadeIn 300ms ease-out;
}

.screen-full {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--xl);
  animation: fadeIn 300ms ease-out;
}

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

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

/* --- Top Header --- */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--md);
  height: var(--header-height);
  max-width: 480px;
  margin: 0 auto;
}

.top-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 19px;
  color: #fff;
  flex-shrink: 0;
}

.logo-wordmark {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo-parmi { color: var(--accent); }
.logo-sian { color: #fff; }

.top-header-right {
  display: flex;
  align-items: center;
  gap: var(--sm);
}

/* --- Back Button --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--xs);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: var(--sm) 0;
  transition: color var(--transition-fast);
}

.back-btn:hover { color: var(--text); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #e62e5c;
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: var(--surface);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.05rem;
}

/* --- Form Elements --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.input-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-textarea:focus {
  border-color: var(--accent);
}

.form-error {
  font-size: 0.85rem;
  color: var(--danger);
}

.form-error:not(:empty) {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--sm) var(--md);
  text-align: center;
}

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

.char-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  font-family: var(--font-mono);
}

/* --- Gender Toggle --- */
.gender-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sm);
}

.gender-option {
  padding: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.gender-option.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(255, 51, 102, 0.08);
}

.gender-option:hover:not(.active) {
  border-color: var(--text-muted);
}

.gender-info {
  padding: var(--md);
  background: var(--surface);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card-body {
  padding: var(--md);
}

.card-header {
  padding: var(--md);
  border-bottom: 1px solid var(--border);
}

/* --- Profile Card (Feed) --- */
.profile-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.profile-card .photo-container {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}

.profile-card .photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card .photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
}

.profile-card .info {
  padding: var(--md);
}

.profile-card .name-age {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.profile-card .location {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-card .bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: var(--sm);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Photo Gallery --- */
.photo-gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  touch-action: pan-y;
}

.photo-gallery .slides {
  display: flex;
  height: 100%;
  transition: transform 300ms ease;
}

.photo-gallery .slide {
  min-width: 100%;
  height: 100%;
}

.photo-gallery .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
}

.gallery-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: all var(--transition-fast);
}

.gallery-dots .dot.active {
  background: #fff;
  width: 18px;
  border-radius: 3px;
}

/* --- Ranking Slots --- */
.ranking-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: var(--md) 0;
}

.rank-slot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.rank-slot:hover {
  border-color: var(--text-muted);
}

.rank-slot.filled {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.rank-slot.filled.rank-high {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(255, 51, 102, 0.3);
}

.rank-slot.filled.rank-mid {
  border-color: var(--amber);
  color: var(--amber);
}

.rank-slot.filled.rank-low {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.rank-slot.filled.rank-low {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: var(--surface-2);
}

/* --- Rank Badge (Inbox) --- */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

.rank-badge.rank-high {
  background: rgba(255, 51, 102, 0.15);
  color: var(--accent);
  border: 1px solid rgba(255, 51, 102, 0.3);
}

.rank-badge.rank-mid {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.rank-badge.rank-low {
  background: rgba(138, 136, 154, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(138, 136, 154, 0.3);
}

/* --- Like Card (Inbox) --- */
.like-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--md);
  display: flex;
  gap: var(--md);
  transition: border-color var(--transition-fast);
}

.like-card:hover {
  border-color: rgba(255, 51, 102, 0.3);
}

.like-card .avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}

.like-card .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.like-card .avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
}

.like-card .like-info {
  flex: 1;
  min-width: 0;
}

.like-card .like-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.like-card .like-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.like-card .like-actions {
  display: flex;
  gap: var(--sm);
  margin-top: var(--sm);
}

.like-card.matched {
  opacity: 0.6;
  border-color: var(--green);
}

/* --- Cooldown Timer Circle --- */
.cooldown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--lg);
}

.timer-circle {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-circle .track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 8;
}

.timer-circle .progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-circle .time-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-circle .time-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
}

.timer-circle .time-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Rating Circle --- */
.rating-circle {
  position: relative;
  width: 180px;
  height: 180px;
}

.rating-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.rating-circle .track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 10;
}

.rating-circle .arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.rating-circle .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.rating-circle .score-value {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 600;
}

.rating-circle .score-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Progress Bars (Rating Components) --- */
.component-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.component-bar .bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.component-bar .bar-label {
  color: var(--text-muted);
}

.component-bar .bar-value {
  font-family: var(--font-mono);
  font-weight: 600;
}

.component-bar .bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.component-bar .bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 1s ease-out;
}

.component-bar .bar-weight {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* --- Sparkline --- */
.sparkline {
  width: 100%;
  height: 60px;
}

.sparkline polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline .area {
  fill: url(#sparkGradient);
  opacity: 0.3;
}

/* --- Match List Item --- */
.match-item {
  display: flex;
  gap: var(--md);
  padding: var(--md);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.match-item:hover {
  background: var(--surface);
}

.match-item:last-child {
  border-bottom: none;
}

.match-item .avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}

.match-item .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-item .match-info {
  flex: 1;
  min-width: 0;
}

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

.match-item .match-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.match-item .match-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.match-item .match-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Unread Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* --- Chat --- */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: var(--md);
  padding: var(--md);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-header .partner-name {
  font-weight: 600;
  font-size: 1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--md);
  display: flex;
  flex-direction: column;
  gap: var(--sm);
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  animation: slideUp 200ms ease-out;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-bubble .bubble-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  gap: 8px;
}

.chat-bubble .bubble-time {
  font-size: 0.65rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.chat-bubble.mine .bubble-meta {
  justify-content: flex-end;
}

.translation-toggle {
  font-size: 0.6rem;
  opacity: 0.7;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

.translation-toggle:hover {
  opacity: 1;
}

.typing-indicator {
  align-self: flex-start;
  padding: 12px 18px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-bar {
  display: flex;
  gap: var(--sm);
  padding: var(--md);
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-input-bar input {
  flex: 1;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.chat-input-bar input:focus {
  border-color: var(--accent);
}

.chat-input-bar .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.chat-input-bar .send-btn:hover {
  background: #e62e5c;
}

/* --- Drag & Drop Ranking --- */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: var(--sm);
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: var(--md);
  padding: var(--md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  user-select: none;
  touch-action: pan-y;
  transition: opacity var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.ranking-item.empty {
  border-style: dashed;
  border-color: var(--border);
  background: transparent;
  cursor: default;
}

.ranking-item.empty .rank-number {
  background: var(--surface-2);
  color: var(--text-muted);
}

.ranking-item.empty .empty-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.ranking-item.dragging {
  opacity: 0.8;
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.ranking-item .rank-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ranking-item .mini-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}

.ranking-item .mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-item .drag-handle {
  color: var(--text-muted);
  margin-left: auto;
  font-size: 1.2rem;
  cursor: grab;
  touch-action: none;
  padding: 8px;
}

/* --- Photo Upload Slots --- */
.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sm);
}

.photo-slot {
  aspect-ratio: 1;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color var(--transition-fast);
}

.photo-slot:hover {
  border-color: var(--accent);
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-slot .add-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.photo-slot .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* --- Assigned Ranks Summary (Feed) --- */
.assigned-ranks {
  display: flex;
  flex-direction: column;
  gap: var(--xs);
  padding: var(--sm) 0;
}

.assigned-rank {
  display: flex;
  align-items: center;
  gap: var(--sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.assigned-rank .rank-num {
  width: 20px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
}

.nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item .nav-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Modal / Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 200ms ease-out;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  padding: var(--lg);
  animation: slideUp 300ms ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--lg);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* --- Animated Gradient Background --- */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,51,102,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(124,92,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 80% 60%, rgba(255,51,102,0.05) 0%, transparent 50%);
  animation: gradientShift 12s ease-in-out infinite alternate;
}

@keyframes gradientShift {
  0%   { opacity: 0.6; transform: scale(1) translateY(0); }
  50%  { opacity: 1;   transform: scale(1.05) translateY(-10px); }
  100% { opacity: 0.7; transform: scale(1) translateY(5px); }
}

/* --- Status Pill --- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
}

.status-pill.ready {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-pill.waiting {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --- Tip Box --- */
.tip-box {
  padding: var(--md);
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--2xl) var(--lg);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--md);
  opacity: 0.5;
}

.empty-state .empty-text {
  font-size: 0.95rem;
  margin-bottom: var(--lg);
}

/* --- Settings List --- */
.settings-list {
  display: flex;
  flex-direction: column;
}

.settings-group {
  padding: var(--md) 0;
}

.settings-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 0 var(--sm);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item .arrow {
  color: var(--text-muted);
}

/* --- Loading Spinner --- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--2xl);
}

/* --- Batch Counter --- */
.batch-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--md);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.batch-counter .count {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

/* --- Divider --- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: var(--lg) 0;
}

/* --- Responsive --- */
@media (max-width: 360px) {
  :root {
    --md: 12px;
    --lg: 16px;
    --xl: 24px;
  }

  .rank-slot {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }
}

@media (min-width: 481px) {
  #app {
    max-width: 480px;
    margin: 0 auto;
  }

  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* --- No scroll when modal open --- */
body.modal-open {
  overflow: hidden;
}

/* --- Compose Modal --- */
.compose-modal textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.95rem;
  resize: none;
  outline: none;
}

.compose-modal textarea:focus {
  border-color: var(--accent);
}

/* --- Profile Preview Card --- */
.preview-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-card-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--surface-2);
  overflow: hidden;
}

.preview-card-photo .photo-gallery {
  aspect-ratio: 3/4;
}

.preview-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--xl) var(--lg) var(--lg);
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

.preview-card-photo .gallery-dots {
  bottom: auto;
  top: 12px;
}

.preview-card-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.preview-card-location {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  margin-top: 2px;
}

.preview-card-bio {
  padding: var(--lg);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ── Help Page ── */
.help-accordion { display:flex; flex-direction:column; gap:var(--sm); }

.help-section {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  overflow:hidden;
}

.help-section-toggle {
  display:flex; align-items:center; gap:var(--md); width:100%;
  padding:var(--md); background:none; border:none;
  color:var(--text); font-size:0.95rem; font-weight:600;
  font-family:var(--font-body); cursor:pointer; text-align:left;
}
.help-section-toggle:hover { background:var(--surface-2); }

.help-section-icon { font-size:1.2rem; flex-shrink:0; width:28px; text-align:center; }
.help-chevron {
  margin-left:auto; font-size:1.2rem; color:var(--text-muted);
  transition:transform 0.2s ease;
}
.help-section.open .help-chevron { transform:rotate(90deg); }

.help-section-content {
  max-height:0; overflow:hidden; padding:0 var(--md);
  transition:max-height 0.35s ease, padding 0.35s ease;
}
.help-section.open .help-section-content {
  max-height:2000px; padding:0 var(--md) var(--md);
}

.help-section-content p {
  color:var(--text-muted); font-size:0.9rem; line-height:1.6; margin-bottom:var(--sm);
}

.help-list { list-style:none; padding:0; display:flex; flex-direction:column; gap:var(--sm); }
.help-list li {
  position:relative; padding-left:var(--lg);
  color:var(--text-muted); font-size:0.9rem; line-height:1.5;
}
.help-list li::before {
  content:'\2713'; position:absolute; left:0;
  color:var(--accent); font-weight:600;
}

.help-steps { display:flex; flex-direction:column; gap:var(--md); }
.help-step { display:flex; gap:var(--md); align-items:flex-start; }
.help-step-num {
  width:28px; height:28px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-mono); font-size:0.8rem; font-weight:700;
}
.help-step-body { flex:1; min-width:0; }
.help-step-body strong { display:block; font-size:0.9rem; margin-bottom:2px; color:var(--text); }
.help-step-body p { margin:0; }

.help-screen-item { padding:var(--sm) 0; border-bottom:1px solid var(--border); }
.help-screen-item:last-child { border-bottom:none; }
.help-screen-item strong { display:block; font-size:0.9rem; margin-bottom:2px; color:var(--text); }
.help-screen-item p { margin:0; }

.help-btn {
  width:28px; height:28px; border-radius:50%;
  background:var(--surface-2); border:1px solid var(--border);
  color:var(--text-muted); font-size:0.85rem; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0; padding:0; font-family:var(--font-body);
}
.help-btn:hover { color:var(--text); border-color:var(--text-muted); }
