/* ── Project Zero — macOS Glass Design System, Blue/Black (spec §51-56) ── */
:root {
  --pz-bg: #060a14;
  --pz-bg-2: #0b1526;
  --pz-blue: #3b82f6;
  --pz-blue-2: #1d4ed8;
  --pz-surface: rgba(255, 255, 255, 0.05);
  --pz-surface-strong: rgba(255, 255, 255, 0.08);
  --pz-border: rgba(255, 255, 255, 0.10);
  --pz-text: #eef1f8;
  --pz-text-muted: #94a3b8;
  --pz-radius-window: 18px;
  --pz-radius-card: 16px;
  --pz-radius-btn: 10px;
  --pz-red: #ff5f56;
  --pz-yellow: #ffbd2e;
  --pz-green: #27c93f;
  --pz-danger: #f87171;
  --pz-success: #4ade80;
}

* { box-sizing: border-box; }

/* Long unbroken runs of text (bio decorations, pasted links, CJK/Thai
   strings with no natural break points) were overflowing straight past
   the edge of glass cards / windows instead of wrapping. This forces a
   wrap wherever normal word-break wouldn't find one. */
p, .pz-muted, .pz-muted-sm, .pz-glass-card, .pz-window-body, .pz-alert, .pz-form label {
  overflow-wrap: anywhere;
  word-break: break-word;
}
img { max-width: 100%; }

body {
  margin: 0;
  font-family: var(--pz-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Sarabun", sans-serif);
  background:
    radial-gradient(circle at 20% -10%, rgba(59, 130, 246, 0.25), transparent 40%),
    radial-gradient(circle at 100% 10%, rgba(29, 78, 216, 0.18), transparent 45%),
    var(--pz-bg);
  color: var(--pz-text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; margin: 0 0 8px; }
p { line-height: 1.6; }
.pz-muted { color: var(--pz-text-muted); }
.pz-muted-sm { color: var(--pz-text-muted); font-size: 0.85rem; }
.pz-bio { white-space: pre-line; word-break: break-word; }
.pz-center { text-align: center; }
.pz-hidden { display: none !important; }

/* Lucide icons (https://lucide.dev/icons/) — used everywhere in the UI
   except per-language file badges, which stay as colored letter chips
   since Lucide has no per-language marks. em-sized so one rule fits
   every context (buttons, headings, list items) without per-place tuning. */
.lucide { width: 1em; height: 1em; vertical-align: -0.15em; stroke-width: 2; flex: none; }
.pz-icon-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; font-size: 0.7em; font-style: normal;
  border: 1px dashed currentColor; border-radius: 3px; opacity: 0.6;
}
.pz-icon-fallback::before { content: "?"; }

/* ── Navbar ── */
.pz-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 8, 18, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--pz-border);
  transition: background 0.3s ease;
}
.pz-navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.pz-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.02em; }
.pz-brand-logo { height: 22px; width: auto; display: block; }
.pz-traffic { display: inline-flex; gap: 6px; }
.pz-traffic i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pz-traffic i:nth-child(1) { background: var(--pz-red); }
.pz-traffic i:nth-child(2) { background: var(--pz-yellow); }
.pz-traffic i:nth-child(3) { background: var(--pz-green); }
.pz-nav-links { display: flex; gap: 14px; flex: 1; }
.pz-nav-links a { display: inline-flex; align-items: center; color: var(--pz-text-muted); font-size: 0.92rem; transition: color 0.2s; padding: 6px 4px; }
.pz-nav-links a:hover, .pz-nav-links a.active { color: var(--pz-text); }
/* Icon-only by default; the label expands into view on hover/focus, or
   stays visible for whichever link is the current page. */
.pz-nav-label {
  display: inline-block; max-width: 0; margin-left: 0; opacity: 0; overflow: hidden;
  white-space: nowrap; transition: max-width 0.22s ease, opacity 0.18s ease, margin-left 0.22s ease;
}
.pz-nav-links a:hover .pz-nav-label,
.pz-nav-links a:focus-visible .pz-nav-label,
.pz-nav-links a.active .pz-nav-label {
  max-width: 160px; margin-left: 6px; opacity: 1;
}
.pz-nav-right { display: flex; align-items: center; gap: 10px; }
.pz-hamburger { display: none; background: none; border: none; color: var(--pz-text); font-size: 1.4rem; padding: 8px; cursor: pointer; }
.pz-mobile-menu { display: none; flex-direction: column; padding: 12px 20px 20px; gap: 10px; border-top: 1px solid var(--pz-border); }
.pz-mobile-menu.open { display: flex; max-height: calc(100vh - 64px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pz-mobile-menu a, .pz-mobile-menu button { display: flex; align-items: center; gap: 8px; color: var(--pz-text); background: none; border: none; text-align: left; font-size: 1rem; padding: 6px 0; cursor: pointer; }

.pz-avatar-menu { position: relative; }
.pz-avatar-trigger { display: flex; align-items: center; gap: 6px; background: var(--pz-surface); border: 1px solid var(--pz-border); color: var(--pz-text); padding: 7px 14px; border-radius: var(--pz-radius-btn); cursor: pointer; }
.pz-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pz-green); display: inline-block; }
.pz-avatar-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px;
  background: rgba(20, 14, 32, 0.9); backdrop-filter: blur(20px); border: 1px solid var(--pz-border);
  border-radius: var(--pz-radius-card); padding: 8px; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.pz-avatar-dropdown.open { display: flex; }
.pz-avatar-dropdown a, .pz-avatar-dropdown button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--pz-text); background: none; border: none; text-align: left; cursor: pointer; font: inherit; width: 100%; }
.pz-avatar-dropdown a:hover, .pz-avatar-dropdown button:hover { background: var(--pz-surface); }

@media (max-width: 860px) {
  .pz-nav-links { display: none; }
  .pz-hide-sm { display: none; }
  .pz-hamburger { display: block; }
  .pz-nav-right { margin-left: auto; }
}

/* ── Buttons ── */
.pz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--pz-radius-btn); border: 1px solid transparent;
  font-size: 0.92rem; font-weight: 600; cursor: pointer; transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.pz-btn:active { transform: scale(0.97); }
.pz-btn-primary { background: linear-gradient(135deg, var(--pz-blue), var(--pz-blue-2)); color: white; box-shadow: 0 6px 20px rgba(59, 130, 246,0.35); }
.pz-btn-primary:hover { box-shadow: 0 8px 26px rgba(59, 130, 246,0.5); }
.pz-btn-ghost { background: var(--pz-surface); border-color: var(--pz-border); color: var(--pz-text); }
.pz-btn-ghost:hover { background: var(--pz-surface-strong); }
.pz-btn-lg { padding: 13px 26px; font-size: 1rem; }
.pz-btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.pz-btn-block { width: 100%; }
button.pz-btn { font-family: inherit; }

/* ── Glass cards / windows ── */
.pz-glass-card {
  background: var(--pz-surface);
  border: 1px solid var(--pz-border);
  border-radius: var(--pz-radius-card);
  padding: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.pz-glass-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(59,130,246,0.25); border-color: rgba(59,130,246,0.35); }

.pz-window {
  background: rgba(11, 21, 38, 0.65);
  border: 1px solid var(--pz-border);
  border-radius: var(--pz-radius-window);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(59,130,246,0.08);
  overflow: hidden;
}
.pz-window-titlebar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--pz-border); background: rgba(255,255,255,0.03); }
.pz-window-title { font-size: 0.85rem; color: var(--pz-text-muted); }
.pz-window-body { padding: 24px; }

/* ── Page layout ── */
.pz-page { max-width: 1200px; margin: 0 auto; padding: 40px 20px 80px; animation: pzFadeIn 0.4s ease; }
.pz-center-page { max-width: 640px; }
@keyframes pzFadeIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

/* ── Hero ── */
.pz-hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; padding: 40px 0 60px; position: relative; overflow: hidden; }
.pz-kicker { color: var(--pz-blue); font-weight: 700; letter-spacing: 0.08em; font-size: 0.85rem; }
.pz-hero-text h1 { font-size: 3rem; line-height: 1.1; margin: 12px 0; }
.pz-lead { font-size: 1.2rem; }
.pz-cta-row { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
@media (max-width: 900px) { .pz-hero { grid-template-columns: 1fr; } }

/* ── Homepage / download-page redesign: blobs, gradient text, motion ── */
.pz-hero-blob {
  position: absolute; border-radius: 50%; filter: blur(60px); z-index: -1; pointer-events: none;
  animation: pzBlobFloat 10s ease-in-out infinite;
}
.pz-hero-blob-1 { width: 340px; height: 340px; top: -80px; left: -60px; background: rgba(59, 130, 246,0.35); }
.pz-hero-blob-2 { width: 280px; height: 280px; bottom: -60px; right: 0; background: rgba(29, 78, 216,0.3); animation-delay: -4s; }
@keyframes pzBlobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -24px) scale(1.08); }
}
.pz-gradient-text {
  background: linear-gradient(135deg, var(--pz-blue), #93c5fd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pz-float { animation: pzFloatY 5s ease-in-out infinite; }
@keyframes pzFloatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.pz-anim-in { opacity: 0; animation: pzFadeUp 0.6s ease forwards; }
.pz-anim-in-2 { animation-delay: 0.12s; }
.pz-anim-in-3 { animation-delay: 0.24s; }
.pz-anim-in-4 { animation-delay: 0.36s; }
@keyframes pzFadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.pz-features.pz-anim-in .pz-glass-card, .pz-pricing-preview.pz-anim-in .pz-glass-card {
  opacity: 0; animation: pzFadeUp 0.5s ease forwards;
}
.pz-features .pz-glass-card:nth-child(1) { animation-delay: 0.05s; }
.pz-features .pz-glass-card:nth-child(2) { animation-delay: 0.12s; }
.pz-features .pz-glass-card:nth-child(3) { animation-delay: 0.19s; }
.pz-features .pz-glass-card:nth-child(4) { animation-delay: 0.26s; }

.pz-inline-link { color: var(--pz-blue); text-decoration: underline; }
.pz-inline-link .lucide { margin-left: 4px; text-decoration: none; }

/* ── Phase 8: avatar circle + profile-frame shop ── */
.pz-avatar-circle {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--pz-blue), var(--pz-blue-2)); color: #fff; font-weight: 700; font-size: 0.9rem;
  flex: none; position: relative; overflow: hidden;
}
.pz-avatar-circle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.pz-avatar-circle-lg { width: 72px; height: 72px; font-size: 1.6rem; }
.pz-frame-blue-glow { box-shadow: 0 0 0 3px rgba(59,130,246,0.9), 0 0 16px 4px rgba(59,130,246,0.6); }
.pz-frame-gold { box-shadow: 0 0 0 3px #f5c451, 0 0 14px 3px rgba(245,196,81,0.6); }
.pz-frame-neon-pink { box-shadow: 0 0 0 3px #f472b6, 0 0 16px 4px rgba(244,114,182,0.6); }
.pz-frame-rainbow {
  box-shadow: 0 0 0 3px transparent;
  background-image: linear-gradient(var(--pz-bg), var(--pz-bg)), conic-gradient(from 0deg, #f472b6, #f5c451, #4ade80, #3b82f6, #a78bfa, #f472b6);
  background-origin: border-box; background-clip: padding-box, border-box; border: 3px solid transparent;
  animation: pzRainbowSpin 3s linear infinite;
}
@keyframes pzRainbowSpin { to { filter: hue-rotate(360deg); } }

/* Image-based frames (Phase 8b) — decorative PNG/JPG/WEBP ring drawn as an
   ::after overlay, sized larger than the circle so the artwork's border
   sits outside the avatar itself. Set via inline style="--pz-frame-img: url(...)" */
.pz-frame-image { overflow: visible; }
.pz-frame-image::after {
  content: ""; position: absolute; inset: -35%; background-image: var(--pz-frame-img);
  background-size: contain; background-position: center; background-repeat: no-repeat;
  pointer-events: none;
}

.pz-frame-switcher { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.pz-frame-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 1px solid transparent;
  border-radius: 12px; padding: 8px; cursor: pointer; color: var(--pz-text-muted);
}
.pz-frame-option:hover { background: var(--pz-surface); }
.pz-frame-option.active { border-color: var(--pz-blue); background: rgba(59,130,246,0.08); }

/* ── Phase 9: friend chat ── */
.pz-chat-messages { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; min-height: 240px; overflow-y: auto; padding: 4px; }
.pz-chat-bubble { max-width: 70%; padding: 8px 12px; border-radius: 14px; font-size: 0.88rem; line-height: 1.4; word-break: break-word; }
.pz-chat-bubble.me { align-self: flex-end; background: linear-gradient(135deg, var(--pz-blue), var(--pz-blue-2)); color: #fff; border-bottom-right-radius: 4px; }
.pz-chat-bubble.them { align-self: flex-start; background: var(--pz-surface-strong); border-bottom-left-radius: 4px; }
.pz-chat-input-row { display: flex; gap: 8px; margin-top: 12px; }
.pz-chat-input-row input {
  flex: 1; background: var(--pz-surface); border: 1px solid var(--pz-border); border-radius: 999px;
  padding: 10px 16px; color: var(--pz-text); font-size: 0.88rem;
}
.pz-chat-input-row input:focus { outline: none; border-color: var(--pz-blue); }
.pz-platform-card { text-align: center; gap: 10px; }
.pz-platform-card h3 { font-size: 1.1rem; }
@media (prefers-reduced-motion: reduce) {
  .pz-hero-blob, .pz-float, .pz-anim-in, .pz-anim-in .pz-glass-card { animation: none !important; opacity: 1 !important; }
}

.pz-progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 10px 0 4px; }
.pz-progress-bar { height: 100%; background: linear-gradient(90deg, var(--pz-blue), var(--pz-blue-2)); border-radius: 999px; transition: width 0.3s ease; }
.pz-checklist { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; color: var(--pz-text-muted); font-size: 0.9rem; }
.pz-checklist li { display: flex; align-items: center; gap: 8px; }
.pz-checklist .lucide { color: var(--pz-success); }

/* ── Feature / pricing preview grids ── */
.pz-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 40px; }
.pz-pricing-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.pz-pricing-mini { text-align: center; }
.pz-pricing-label { display: block; color: var(--pz-text-muted); font-size: 0.85rem; margin-bottom: 6px; }
@media (max-width: 900px) { .pz-features, .pz-pricing-preview { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .pz-features, .pz-pricing-preview { grid-template-columns: 1fr; } }

/* ── Forms ── */
.pz-form { display: flex; flex-direction: column; gap: 14px; }
.pz-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--pz-text-muted); }
.pz-form input, .pz-form select, .pz-form textarea {
  background: rgba(255,255,255,0.04); border: 1px solid var(--pz-border); border-radius: var(--pz-radius-btn);
  padding: 10px 12px; color: var(--pz-text); font-size: 0.95rem; font-family: inherit;
}
.pz-form input:focus, .pz-form select:focus, .pz-form textarea:focus { outline: none; border-color: var(--pz-blue); }
.pz-radio-row { display: flex; gap: 16px; flex-direction: column; }
.pz-radio { flex-direction: row !important; align-items: center; gap: 8px !important; }

.pz-auth-window { max-width: 420px; margin: 40px auto; }
.pz-alert { padding: 12px 16px; border-radius: var(--pz-radius-btn); border: 1px solid var(--pz-border); background: var(--pz-surface); margin-bottom: 14px; }
.pz-alert-error { border-color: rgba(248,113,113,0.4); color: var(--pz-danger); }
.pz-alert-success { border-color: rgba(74,222,128,0.4); color: var(--pz-success); }

/* ── Dashboard ── */
.pz-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.pz-stat { text-align: center; }
.pz-stat-label { display: block; color: var(--pz-text-muted); font-size: 0.85rem; margin-bottom: 6px; }
.pz-stat-value { font-size: 1.8rem; }
.pz-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.pz-big-number { font-size: 2.4rem; margin: 0; font-weight: 800; }
.pz-section { margin-top: 36px; }
.pz-empty-state { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pz-file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pz-file-card { display: flex; flex-direction: column; gap: 6px; }
.pz-file-icon { font-size: 1.6rem; }
.pz-file-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pz-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(59, 130, 246,0.2); color: #93c5fd; font-size: 0.75rem; width: fit-content; }
.pz-url { display: block; padding: 6px 10px; background: rgba(0,0,0,0.25); border-radius: 8px; font-size: 0.8rem; word-break: break-all; }
.pz-activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pz-activity-list li { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.pz-account-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pz-account-info div { display: flex; flex-direction: column; gap: 4px; }
.pz-table { width: 100%; border-collapse: collapse; }
.pz-table th, .pz-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--pz-border); font-size: 0.9rem; }
@media (max-width: 700px) { .pz-stat-grid, .pz-two-col, .pz-account-info { grid-template-columns: 1fr; } }

/* ── Obfuscation / Source windows ── */
.pz-obf-window { max-width: 640px; margin: 20px auto; }
.pz-share-window { max-width: 900px; margin: 20px auto; }
.pz-share-window .pz-window-title { flex: 1; display: flex; align-items: center; gap: 6px; }
.pz-share-body { display: flex; min-height: 420px; max-height: 70vh; }
.pz-share-files {
  width: 220px; flex: none; border-right: 1px solid var(--pz-border); overflow-y: auto; padding: 8px 0;
}
.pz-share-file-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 12px; font-size: 0.82rem; cursor: pointer;
  color: var(--pz-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pz-share-file-item:hover { background: var(--pz-surface); color: var(--pz-text); }
.pz-share-file-item.active { background: rgba(59,130,246,0.14); color: var(--pz-text); box-shadow: inset 2px 0 0 var(--pz-blue); }
.pz-share-viewer { flex: 1; min-width: 0; padding: 12px; overflow: auto; }
.pz-share-viewer .pz-code-block, .pz-share-viewer .pz-collab-textarea { margin: 0; height: 100%; min-height: 100%; }
.pz-code-block {
  max-height: 60vh; overflow: auto; margin-top: 12px; background: rgba(0,0,0,0.25);
  border: 1px solid var(--pz-border); border-radius: var(--pz-radius-btn); padding: 14px;
  font-family: 'SFMono-Regular', Consolas, monospace; font-size: 0.85rem; white-space: pre-wrap; word-break: break-word;
}
.pz-collab-textarea { width: 100%; min-height: 50vh; resize: vertical; color: var(--pz-text); border: 1px solid var(--pz-border); }
.pz-collab-textarea:focus { outline: 2px solid var(--pz-blue); outline-offset: -1px; }
.pz-spin { animation: pzSpin 0.9s linear infinite; }
@keyframes pzSpin { to { transform: rotate(360deg); } }
.pz-dropzone { border: 2px dashed var(--pz-border); border-radius: var(--pz-radius-card); padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: border-color 0.2s; }
.pz-dropzone.dragover { border-color: var(--pz-blue); background: rgba(59, 130, 246,0.08); }
.pz-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.pz-modal-window { max-width: 420px; width: 100%; }

/* ── Purchase ── */
.pz-pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pz-pricing-grid-6 { grid-template-columns: repeat(3, 1fr); }
.pz-pricing-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pz-price { font-size: 1.6rem; font-weight: 800; }
.pz-plan-features { list-style: none; padding: 0; margin: 8px 0; font-size: 0.85rem; color: var(--pz-text-muted); text-align: left; width: 100%; }
.pz-plan-features li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pz-plan-features .lucide { color: var(--pz-success); }
.pz-current-plan { border-color: var(--pz-blue); box-shadow: 0 0 0 1px var(--pz-blue); }
@media (max-width: 900px) { .pz-pricing-grid, .pz-pricing-grid-6 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .pz-pricing-grid, .pz-pricing-grid-6 { grid-template-columns: 1fr; } }

/* ── Write / editor ── */
.pz-write-page { max-width: 1300px; }
.pz-write-window { height: 78vh; display: flex; flex-direction: column; }
.pz-write-body { display: grid; grid-template-columns: 200px 1fr 280px; flex: 1; min-height: 0; }
.pz-write-files, .pz-write-ai { border-right: 1px solid var(--pz-border); display: flex; flex-direction: column; min-height: 0; }
.pz-write-ai { border-right: none; border-left: 1px solid var(--pz-border); }
.pz-write-files-header, .pz-write-ai-header { padding: 12px 14px; border-bottom: 1px solid var(--pz-border); display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--pz-text-muted); }
.pz-write-file-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; flex: 1; }
.pz-write-file-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; }
.pz-write-file-item:hover, .pz-write-file-item.active { background: var(--pz-surface); }
.pz-write-editor { display: flex; flex-direction: column; min-height: 0; }
.pz-write-editor-toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--pz-border); }
.pz-write-editor-toolbar input { flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--pz-border); border-radius: 8px; padding: 6px 10px; color: var(--pz-text); }
.pz-editor-wrap { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.pz-editor-gutter { padding: 12px 10px; background: rgba(0,0,0,0.15); color: var(--pz-text-muted); font-family: "SF Mono", Menlo, monospace; font-size: 0.85rem; line-height: 1.5; white-space: pre; text-align: right; overflow: hidden; user-select: none; }
#codeEditor { flex: 1; border: none; resize: none; background: transparent; color: var(--pz-text); font-family: "SF Mono", Menlo, monospace; font-size: 0.85rem; line-height: 1.5; padding: 12px; outline: none; }
.pz-write-status-bar { display: flex; justify-content: space-between; padding: 8px 14px; border-top: 1px solid var(--pz-border); font-size: 0.78rem; color: var(--pz-text-muted); }
.pz-write-ai-chat { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 0.85rem; }
.pz-write-ai-chat .pz-ai-msg { background: var(--pz-surface); padding: 8px 10px; border-radius: 10px; white-space: pre-wrap; }
.pz-write-ai-chat .pz-user-msg { background: rgba(59, 130, 246,0.18); padding: 8px 10px; border-radius: 10px; align-self: flex-end; }
.pz-write-ai-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.pz-write-ai-input { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--pz-border); }
.pz-write-ai-input input { flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--pz-border); border-radius: 8px; padding: 8px 10px; color: var(--pz-text); }
@media (max-width: 960px) { .pz-write-body { grid-template-columns: 1fr; } .pz-write-files, .pz-write-ai { display: none; } }

/* ── /ai chat companion page ── */
.pz-ai-page { max-width: 760px; }
.pz-ai-window { height: 78vh; display: flex; flex-direction: column; }
.pz-ai-model-select { margin-left: auto; }
.pz-ai-chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pz-ai-chat-messages { flex: 1; font-size: 0.95rem; padding: 18px; }
.pz-ai-chat-messages .pz-ai-msg { max-width: 80%; }
.pz-ai-chat-messages .pz-user-msg { max-width: 80%; }
.pz-ai-chat-input { padding: 14px 18px; }
.pz-ai-chat-input input { padding: 10px 12px; }

/* ── API docs ── */
.pz-code-block { position: relative; background: rgba(0,0,0,0.3); border-radius: 12px; padding: 16px; margin: 10px 0 20px; overflow-x: auto; }
.pz-code-block pre { margin: 0; font-family: "SF Mono", Menlo, monospace; font-size: 0.85rem; }
.pz-code-block .pz-copy-code { position: absolute; top: 8px; right: 8px; }
.pz-api-key-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between; margin-bottom: 10px; }

/* ── Footer ── */
.pz-footer { border-top: 1px solid var(--pz-border); margin-top: 60px; padding: 40px 20px 20px; background: rgba(255,255,255,0.02); }
.pz-footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
.pz-footer-col { display: flex; flex-direction: column; gap: 8px; }
.pz-footer-heading { color: var(--pz-text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.pz-footer-col a { color: var(--pz-text-muted); font-size: 0.9rem; }
.pz-footer-col a:hover { color: var(--pz-text); }
.pz-footer-bottom { text-align: center; margin-top: 30px; color: var(--pz-text-muted); font-size: 0.8rem; }
@media (max-width: 700px) { .pz-footer-inner { grid-template-columns: 1fr 1fr; } }

/* ── Toasts (spec §61) ── */
#toast-root { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.pz-toast {
  background: rgba(11, 21, 38, 0.9); border: 1px solid var(--pz-border); border-radius: 14px;
  padding: 12px 16px; min-width: 240px; box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px); animation: pzToastIn 0.25s ease;
}
.pz-toast strong { display: block; margin-bottom: 2px; }
.pz-toast.pz-toast-error strong { color: var(--pz-danger); }
.pz-toast.pz-toast-success strong { color: var(--pz-success); }
@keyframes pzToastIn { from { opacity: 0; transform: translateX(20px);} to { opacity: 1; transform: translateX(0);} }

/* ── Obfuscation page — Hyper-Chaos terminal theme (scoped to this page only) ── */
.pz-obf2-page {
  background-color: #121212;
  color: #e0e0e0;
  font-family: "Courier New", Consolas, monospace;
  padding: 32px 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 200px);
}
.pz-obf2-container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #1e1e1e;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #333;
}
.pz-obf2-container h2 {
  margin-top: 0;
  color: #00ffcc;
  text-align: center;
}
.pz-obf2-sub { color: #888; margin-top: -8px; }
.pz-obf2-label {
  font-size: 13px;
  color: #aaa;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pz-obf2-optional { color: #666; }
.pz-obf2-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.pz-obf2-row > .pz-obf2-label { flex: 1 1 200px; }
.pz-obf2-textarea {
  width: 100%;
  height: 180px;
  background: #161616;
  color: #00ffcc;
  border: 1px solid #333;
  padding: 10px;
  border-radius: 5px;
  resize: vertical;
  font-size: 13px;
  font-family: "Courier New", Consolas, monospace;
  box-sizing: border-box;
}
.pz-obf2-select,
.pz-obf2-input {
  background: #161616;
  color: #e0e0e0;
  border: 1px solid #333;
  padding: 8px 10px;
  border-radius: 5px;
  font-family: "Courier New", Consolas, monospace;
  font-size: 13px;
  box-sizing: border-box;
  width: 100%;
}
.pz-obf2-meta { font-size: 13px; color: #888; text-align: center; margin: 0; }
.pz-obf2-meta strong { color: #00ffcc; }
.pz-obf2-btn {
  background: #00ffcc;
  color: #121212;
  border: none;
  padding: 12px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.2s;
  font-family: "Courier New", Consolas, monospace;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.pz-obf2-btn:hover { background: #00b388; }
.pz-obf2-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pz-obf2-btn-secondary {
  background: #333;
  color: #fff;
  padding: 8px;
  font-size: 13px;
  flex: 1;
}

/* ── Mobile redesign pass (spec: keep the dark-blue theme, fix layout) ── */
@media (max-width: 640px) {
  /* Page + type scale */
  .pz-page { padding: 20px 14px 48px; }
  .pz-center-page { max-width: 100%; }
  .pz-hero { padding: 20px 0 36px; gap: 24px; }
  .pz-hero-text h1 { font-size: 2rem; line-height: 1.15; }
  .pz-lead { font-size: 1.02rem; }
  .pz-cta-row { flex-direction: column; align-items: stretch; }
  .pz-cta-row .pz-btn { width: 100%; }

  /* Navbar */
  .pz-navbar-inner { padding: 10px 14px; gap: 10px; }
  .pz-brand-logo { height: 18px; }
  .pz-mobile-menu { padding: 10px 14px 16px; }
  .pz-mobile-menu a, .pz-mobile-menu button { padding: 10px 4px; font-size: 1.02rem; }

  /* Windows / cards */
  .pz-window-titlebar { padding: 10px 12px; }
  .pz-window-body { padding: 16px; }
  .pz-glass-card { padding: 16px; }
  .pz-glass-card:hover { transform: none; }

  /* Forms — 16px stops iOS auto-zoom on focus, and rows stack */
  .pz-form input, .pz-form select, .pz-form textarea { font-size: 16px; padding: 11px 12px; }
  .pz-radio-row { gap: 10px; }
  .pz-auth-window { margin: 16px auto; max-width: 100%; }

  /* Dashboard */
  .pz-stat-value { font-size: 1.5rem; }
  .pz-big-number { font-size: 1.9rem; }
  .pz-file-grid { grid-template-columns: 1fr; }
  .pz-api-key-card { flex-direction: column; align-items: stretch; }

  /* Tables — scroll horizontally instead of squeezing/wrapping */
  .pz-table-wrap, .pz-window-body:has(> .pz-table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pz-table { min-width: 480px; }

  /* Share / collaborate — side-by-side panel becomes stacked */
  .pz-share-window { margin: 12px auto; }
  .pz-share-body { flex-direction: column; max-height: none; }
  .pz-share-files { width: 100%; max-height: 140px; border-right: none; border-bottom: 1px solid var(--pz-border); }
  .pz-share-viewer { padding: 10px; }
  .pz-code-block { font-size: 0.8rem; padding: 12px; }
  .pz-collab-textarea { min-height: 40vh; }

  /* Write editor + AI chat page — fixed vh heights fought with mobile
     browser chrome (address bar) shrinking the viewport; let them size
     to content instead of a hard 78vh. */
  .pz-write-window, .pz-ai-window { height: auto; min-height: 72vh; }
  .pz-write-editor-toolbar { flex-wrap: wrap; }
  .pz-ai-chat-messages, .pz-write-ai-chat { padding: 12px; }

  /* Chat */
  .pz-chat-messages { max-height: 45vh; }
  .pz-chat-bubble { max-width: 84%; }

  /* Pricing / obfuscation */
  .pz-pricing-card { padding: 16px; }
  .pz-obf2-container { padding: 16px; }
  .pz-obf2-textarea { height: 140px; }
  .pz-obf2-row { gap: 10px; }

  /* Footer — center, single column */
  .pz-footer { padding: 28px 16px 16px; margin-top: 40px; }
  .pz-footer-inner { grid-template-columns: 1fr; gap: 20px; text-align: center; }
  .pz-footer-col { align-items: center; }

  /* Modals / toasts — use the full width instead of a fixed corner card */
  .pz-modal-overlay { padding: 12px; align-items: flex-end; }
  .pz-modal-window { max-width: 100%; }
  #toast-root { left: 12px; right: 12px; top: 12px; }
  .pz-toast { min-width: 0; width: 100%; }

  /* Avatar dropdown — full-width sheet instead of a narrow corner popover */
  .pz-avatar-dropdown { right: -14px; min-width: 200px; }
}
.pz-obf2-btn-secondary:hover { background: #444; }
/* ── /bot hub + /verify page ── */
.pz-bot-search { position: relative; max-width: 460px; margin: 8px auto 24px; }
.pz-bot-search .lucide { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--pz-text-muted); }
.pz-bot-search input {
  width: 100%; padding: 11px 14px 11px 40px; border-radius: var(--pz-radius-btn);
  background: var(--pz-surface); border: 1px solid var(--pz-border); color: var(--pz-text); font: inherit;
}
.pz-bot-search input:focus { outline: none; border-color: var(--pz-blue); }
.pz-bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pz-bot-card { display: flex; flex-direction: column; gap: 12px; }
.pz-bot-head { display: flex; align-items: center; gap: 14px; }
.pz-bot-title h3 { margin: 0 0 2px; }
.pz-bot-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; flex: none;
  border-radius: 14px; font-size: 1.4rem; color: #93c5fd;
  background: linear-gradient(135deg, rgba(59,130,246,0.30), rgba(29,78,216,0.15)); border: 1px solid rgba(59,130,246,0.35);
}
.pz-bot-icon-lg { width: 64px; height: 64px; font-size: 1.9rem; border-radius: 20px; }
.pz-bot-icon-ok { color: var(--pz-success); background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.4); }
.pz-bot-icon-err { color: var(--pz-danger); background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.4); }
.pz-bot-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--pz-text-muted); }
.pz-bot-status i { width: 8px; height: 8px; border-radius: 50%; background: #64748b; display: inline-block; }
.pz-bot-status-on { color: var(--pz-success); }
.pz-bot-status-on i { background: var(--pz-green); box-shadow: 0 0 8px var(--pz-green); }
.pz-bot-status-err { color: var(--pz-danger); }
.pz-bot-status-err i { background: var(--pz-danger); }
.pz-bot-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.pz-bot-features li { display: flex; align-items: flex-start; gap: 8px; }
.pz-bot-features .lucide { color: var(--pz-blue); margin-top: 3px; }
.pz-bot-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.pz-bot-actions .pz-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.pz-bot-cmds { border-top: 1px solid var(--pz-border); padding-top: 10px; }
.pz-bot-cmds summary { cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--pz-text-muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.pz-bot-cmds summary::-webkit-details-marker { display: none; }
.pz-bot-cmds summary:hover { color: var(--pz-text); }
.pz-bot-cmds ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.pz-bot-cmds li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--pz-surface); font-size: 0.82rem; }
.pz-bot-cmds li code { color: #93c5fd; font-weight: 700; }
.pz-bot-cmds li span { color: var(--pz-text-muted); }
.pz-verify-avatar { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--pz-blue); box-shadow: 0 0 24px rgba(59,130,246,0.4); }
@media (max-width: 420px) { .pz-bot-grid { grid-template-columns: 1fr; } }

/* ── /status page ─────────────────────────────────────────────────────── */
.pz-status-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 24px; }
.pz-status-grid .pz-stat-label { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pz-status-grid .pz-stat-label .lucide { width: 14px; height: 14px; }
.pz-status-grid .pz-stat-value { font-size: 1.35rem; }
@media (max-width: 1000px) { .pz-status-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .pz-status-grid { grid-template-columns: repeat(2, 1fr); } }
.pz-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 860px) { .pz-chart-grid { grid-template-columns: minmax(0, 1fr); } }
.pz-chart-wide { grid-column: 1 / -1; }
.pz-chart-grid h3, .pz-glass-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1rem; }
.pz-chart { position: relative; min-height: 190px; min-width: 0; }
.pz-chart svg { display: block; width: 100%; overflow: visible; }
.pz-chart .g { stroke: rgba(255,255,255,0.07); stroke-width: 1; }
.pz-chart .a { fill: var(--pz-text-muted); font-size: 10px; }
.pz-chart .hv { stroke: rgba(255,255,255,0.35); stroke-width: 1; stroke-dasharray: 3 3; }
.pz-tip { position: absolute; top: 4px; pointer-events: none; background: rgba(6,10,20,0.92); border: 1px solid var(--pz-border); border-radius: 8px; padding: 6px 10px; font-size: 0.78rem; z-index: 2; min-width: 110px; }
.pz-tip i, .pz-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.pz-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 0.78rem; color: var(--pz-text-muted); }
.pz-ubar-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 60px; align-items: center; gap: 10px; margin: 8px 0; }
.pz-ubar-name { font-size: 0.85rem; font-weight: 600; }
.pz-ubar-pct { text-align: right; font-size: 0.82rem; color: var(--pz-text-muted); }
.pz-ubar { display: flex; gap: 1px; height: 26px; min-width: 0; overflow: hidden; }
.pz-ubar i { flex: 1 1 0; border-radius: 2px; background: #334155; min-width: 0; }
@media (max-width: 640px) { .pz-ubar { gap: 0; } }
.pz-ubar i.ok { background: var(--pz-success); } .pz-ubar i.part { background: var(--pz-yellow); } .pz-ubar i.down { background: var(--pz-danger); } .pz-ubar i.none { background: #334155; opacity: .5; }
.pz-pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.75rem; }
.pz-pill.on { background: rgba(74,222,128,0.15); color: var(--pz-success); } .pz-pill.down { background: rgba(248,113,113,0.15); color: var(--pz-danger); } .pz-pill.off { background: rgba(148,163,184,0.15); color: var(--pz-text-muted); }
.pz-top { display: grid; grid-template-columns: 150px minmax(0, 1fr) 60px; align-items: center; gap: 10px; margin: 8px 0; font-size: 0.88rem; }
.pz-top > div { height: 8px; background: rgba(255,255,255,0.06); border-radius: 99px; overflow: hidden; }
.pz-top > div i { display: block; height: 100%; background: linear-gradient(90deg, var(--pz-blue), #60a5fa); border-radius: 99px; }
.pz-top b { text-align: right; }
@media (max-width: 560px) { .pz-ubar-row { grid-template-columns: 64px minmax(0, 1fr) 44px; } .pz-top { grid-template-columns: 100px minmax(0, 1fr) 48px; } }

.pz-table td, .pz-table th { white-space: nowrap; }
.pz-status-grid > * { min-width: 0; }
