/* ═══ TOOLBAR SYSTEM ═══ */
body.toolbar-active {
  padding-top: 56px;
}

.app-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-toolbar.active {
  display: flex;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.toolbar-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.toolbar-btn:hover {
  border-color: var(--teal);
}

.toolbar-btn:active {
  transform: scale(0.95);
}

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

.toolbar-logo .logo-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.toolbar-logo .logo-text {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--ink);
}

@media(max-width:600px) {
  .toolbar-logo .logo-text {
    display: none;
  }

  .toolbar-btn span {
    display: none;
  }
}

/* Profile Dropdown */
.toolbar-profile {
  position: relative;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-btn:hover {
  background: var(--card);
  border-color: var(--ink4);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chevron {
  color: var(--ink3);
  transition: transform 0.2s ease;
}

.toolbar-profile.open .profile-chevron {
  transform: rotate(180deg);
}

@media(max-width:600px) {
  .profile-name {
    display: none;
  }

  .profile-btn {
    padding: 6px;
    border-radius: 50%;
  }

  .profile-chevron {
    display: none;
  }
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transform-origin: top right;
  transition: all 0.2s ease;
  z-index: 1001;
}

.profile-dropdown.active,
.toolbar-profile.open .profile-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.dropdown-user-details {
  flex: 1;
  min-width: 0;
}

.dropdown-user-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-user-email {
  font-size: 0.8rem;
  color: var(--ink3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-user-plan {
  font-size: 0.75rem;
  color: var(--teal);
  font-weight: 600;
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  width: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg2);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--ink3);
}

/* App Launcher */
.app-launcher-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 998;
}

.app-launcher-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-launcher {
  position: fixed;
  top: 64px;
  left: 16px;
  width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9) translateY(-10px);
  transform-origin: top left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  overflow: hidden;
  max-height: 80vh;
}

.app-launcher.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.app-launcher-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.app-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px;
  max-height: calc(80vh - 52px);
  overflow-y: auto;
}

.app-launcher-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--ink);
}

.app-launcher-item:hover {
  background: var(--bg2);
  border-color: var(--border);
}

.app-launcher-item.current {
  background: var(--bg2);
  border-color: var(--teal);
}

.app-launcher-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  transition: all 0.2s ease;
}

.app-emoji {
  font-size: 1.35rem;
}

.app-launcher-item:hover .app-launcher-icon {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.app-launcher-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
}

@media(max-width:480px) {
  .app-launcher {
    left: 8px;
    right: 8px;
    width: auto;
  }

  .app-launcher-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═══ iOS TOUCH FIXES ═══ */
button,
.mbtn,
.foot-btn,
.dl-btn,
.cbtn,
.wwed-trigger,
.step-checkbox,
.url-toggle,
.mh-browse,
.fb-x,
.url-x,
.exp-tog,
.history-row-main,
.history-row-del,
.history-sidebar-close,
.history-clear-all {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.say-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wwed-trigger {
  -webkit-user-select: none;
  user-select: none;
}

:root {
  --bg: #f8f6f1;
  --bg2: #f2efe8;
  --bg3: #e8e4db;
  --bg4: #ddd8cc;
  --card: #fffefa;
  --card2: #faf8f3;
  --ink: #1a1814;
  --ink2: #3a362e;
  --ink3: #6b6558;
  --ink4: #9a9486;
  --border: #e2ddd4;
  --border2: #d4cec3;
  --dark: #5c544c;
  --dark2: #665e56;
  --dark3: #706860;
  --dark4: #7a726a;
  --dark-border: rgba(255, 248, 240, 0.15);
  --lt: rgba(255, 255, 255, 0.96);
  --lt2: rgba(255, 255, 255, 0.88);
  --lt3: rgba(255, 255, 255, 0.55);
  --red: #c0392b;
  --red-bg: #fdf0ee;
  --red-bdr: #f0c8c2;
  --green: #1e8449;
  --green-bg: #edf8f1;
  --green-bdr: #b8dfc8;
  --gold: #b8860b;
  --gold-bg: #fdf6e3;
  --gold-bdr: #e8d5a0;
  --blue: #1a5fb4;
  --blue-bg: #eef3fc;
  --blue-bdr: #b4ceef;
  --teal: #0e7a6e;
  --teal-bg: #ecf8f6;
  --teal-bdr: #a8d8d0;
  --purple: #6c3483;
  --purple-bg: #f5eef8;
  --purple-bdr: #cfaee0;
  --coral: #c0582a;
  --coral-bg: #fdf2ec;
  --coral-bdr: #e8c0a8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
h4 {
  font-family: 'Playfair Display', Georgia, serif;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .4;
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.018'/%3E%3C/svg%3E");
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* ═══ UPLOAD ═══ */
.upload-screen {
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.upload-hero {
  text-align: center;
  margin-bottom: 28px;
}

.ubadge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink3);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.upload-hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.upload-hero h1 em {
  font-style: italic;
  color: var(--teal);
}

.upload-hero p {
  font-size: 14px;
  color: var(--ink3);
  max-width: 420px;
  margin: 10px auto 0;
  line-height: 1.55;
}

.ucard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(26, 24, 20, 0.06);
}

.ucard::before {
  content: '';
  display: block;
  height: 3px;
  margin: -20px -20px 14px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--purple));
}

/* Feature cards under upload */
.upload-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 540px;
  width: 100%;
  margin-top: 20px;
}

.uf-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  transition: all .2s;
}

@media(hover:hover) {
  .uf-card:hover {
    border-color: var(--border2);
    box-shadow: 0 4px 16px rgba(26, 24, 20, .06);
    transform: translateY(-1px);
  }
}

.uf-card:active {
  border-color: var(--border2);
  box-shadow: 0 4px 16px rgba(26, 24, 20, .06);
}

.uf-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin: 0 auto 8px;
}

.uf-icon-teal {
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid var(--teal-bdr);
}

.uf-icon-purple {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--purple-bdr);
}

.uf-icon-gold {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-bdr);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
}

.uf-title {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
}

.uf-desc {
  font-size: 12px;
  color: var(--ink4);
  line-height: 1.4;
}

.uf-full-only {
  transition: opacity .3s, transform .3s;
}

.uf-full-only.dimmed {
  opacity: .35;
  transform: scale(.95);
}

.upload-formats {
  font-size: 11px;
  color: var(--ink4);
  text-align: center;
  margin-top: 14px;
  letter-spacing: 0.3px;
}

/* Voice Input */
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

/* Mode Toggle */
.mode-select {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 12px 0 6px;
  background: var(--bg);
}

.mode-opt {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .25s;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mode-opt-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink3);
  line-height: 1.2;
  transition: color .2s;
}

.mode-opt-desc {
  font-size: 10.5px;
  color: var(--ink4);
  line-height: 1.3;
  margin-top: 2px;
  transition: color .2s;
}

.mode-opt.active {
  background: var(--card);
  box-shadow: 0 2px 8px rgba(26, 24, 20, .08);
}

.mode-opt.active .mode-opt-label {
  color: var(--ink);
}

.mode-opt:first-child {
  border-right: 1px solid var(--border);
}

@media(hover:hover) {
  .mode-opt:not(.active):hover {
    background: var(--bg2);
  }
}

.mode-opt:not(.active):active {
  background: var(--bg2);
}

.mode-opt.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  border-radius: 2px;
}

.mode-opt:first-child.active::after {
  background: var(--teal);
}

.mode-opt:last-child.active::after {
  background: var(--purple);
}

.mode-check {
  font-size: 14px;
  margin-bottom: 2px;
  display: block;
  opacity: .4;
  transition: opacity .2s;
}

.mode-opt.active .mode-check {
  opacity: 1;
}

@media(hover:hover) {
  .voice-btn:hover {
    color: var(--red);
  }
}

.voice-btn:active {
  color: var(--red);
}

.voice-btn.recording {
  color: var(--red);
  font-weight: 700;
  border-color: var(--red-bdr) !important;
  background: var(--red-bg) !important;
}

.voice-btn.recording .voice-dot {
  animation: pulse-dot 1s infinite;
}

.voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  opacity: .6;
}

.voice-btn.recording .voice-dot {
  opacity: 1;
}

.voice-btn.recording {
  animation: recording-pulse 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.5);
    opacity: .5;
  }
}

@keyframes recording-pulse {

  0%,
  100% {
    color: var(--red);
  }

  50% {
    color: var(--coral);
  }
}

.voice-status {
  font-size: 13px;
  color: var(--ink3);
  text-align: center;
  margin-top: 6px;
  min-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media(max-width:500px) {
  .upload-features {
    grid-template-columns: 1fr;
    max-width: 280px;
  }

  .uf-card {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 12px;
  }

  .uf-icon {
    margin: 0;
    flex-shrink: 0;
  }

  .uf-card>div:last-child {
    display: none;
  }
}

.lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink4);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 4px;
  display: block;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .15s;
}

input:focus {
  outline: none;
  border-color: var(--teal);
}

.mega-zone {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.mega-zone textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  resize: none;
  transition: all .2s;
  line-height: 1.55;
}

.mega-zone textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 122, 110, .08);
}

.mega-zone textarea::placeholder {
  color: var(--ink4);
}

.mega-zone.dragging textarea {
  border-color: var(--blue);
  background: var(--blue-bg);
  box-shadow: 0 0 0 4px rgba(26, 95, 180, .1);
}

.mega-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 2px;
}

.mega-hint span {
  font-size: 13px;
  color: var(--ink3);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mega-hint .mh-sep {
  width: 1px;
  height: 18px;
  background: var(--border2);
}

.mega-hint .mh-browse,
.mega-hint .url-toggle,
.mega-hint .voice-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  transition: all .15s;
}

@media(hover:hover) {

  .mega-hint .mh-browse:hover,
  .mega-hint .url-toggle:hover,
  .mega-hint .voice-btn:hover {
    border-color: var(--border2);
    background: var(--bg2);
    color: var(--ink2);
  }
}

.mega-hint .mh-browse:active,
.mega-hint .url-toggle:active,
.mega-hint .voice-btn:active {
  border-color: var(--border2);
  background: var(--bg2);
}

.mega-hint .mh-browse {
  cursor: pointer;
  color: var(--teal);
  text-decoration: none;
  touch-action: manipulation;
}

.mega-overlay {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(26, 95, 180, .06);
  border: 2px dashed var(--blue);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  backdrop-filter: blur(2px);
}

.mega-zone.dragging .mega-overlay {
  display: flex;
}

.mega-overlay-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fbar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--green-bg);
  border: 1px solid var(--green-bdr);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
}

.fbar.show {
  display: flex;
}

.fbar .fb-icon {
  font-size: 14px;
}

.fbar .fb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fbar .fb-x {
  cursor: pointer;
  opacity: .5;
  font-size: 14px;
  font-weight: 400;
  padding: 0 2px;
}

@media(hover:hover) {
  .fbar .fb-x:hover {
    opacity: 1;
  }
}

.fbar .fb-x:active {
  opacity: 1;
}

.url-row {
  display: none;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.url-row.show {
  display: flex;
}

.url-row input {
  flex: 1;
}

.url-row .url-x {
  cursor: pointer;
  font-size: 14px;
  color: var(--ink4);
  padding: 4px;
}

@media(hover:hover) {
  .url-row .url-x:hover {
    color: var(--ink);
  }
}

.url-row .url-x:active {
  color: var(--ink);
}

.url-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink3);
  cursor: pointer;
  transition: all .15s;
  pointer-events: auto;
  touch-action: manipulation;
}

@media(hover:hover) {
  .url-toggle:hover {
    color: var(--teal);
  }
}

.url-toggle:active {
  color: var(--teal);
}

.srow {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: flex-end;
}

.srow .f {
  flex: 1;
}

.hint {
  font-size: 11px;
  color: var(--ink4);
  margin-top: 2px;
}

.btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ink), var(--ink2));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .15s;
  box-shadow: 0 2px 8px rgba(26, 24, 20, .1);
}

@media(hover:hover) {
  .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 24, 20, .15);
  }
}

.btn:active {
  box-shadow: 0 6px 20px rgba(26, 24, 20, .15);
  opacity: .9;
}

.btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gen-hint {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 10px;
  line-height: 1.45;
  min-height: 1.2em;
}

.btn .sp {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

.err {
  background: var(--red-bg);
  border-left: 3px solid var(--red);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink2);
  margin-top: 8px;
  display: none;
  border-radius: 0 6px 6px 0;
  line-height: 1.45;
}

.viewer-err-wrap {
  margin: 0 0 10px;
  text-align: center;
}

.viewer-err-wrap[hidden] {
  display: none !important;
}

.viewer-err {
  background: var(--red-bg);
  border: 1px solid var(--red-bdr);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink2);
  margin: 0 0 8px;
  line-height: 1.45;
  font-weight: 600;
}

.viewer-err-retry {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 8px;
  border: 1px solid var(--teal-bdr);
  background: var(--teal-bg);
  color: var(--teal);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  max-width: 200px;
}

@media(hover:hover) {
  .viewer-err-retry:hover {
    filter: brightness(0.97);
  }
}

.viewer-err-retry:disabled {
  opacity: .65;
  cursor: wait;
}

/* ═══ PROGRESS ═══ */
.progress-screen {
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.pcard {
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.pcard .pi {
  font-size: 40px;
  margin-bottom: 10px;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .4;
    transform: scale(.95);
  }
}

.pcard h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.pcard .ps {
  font-size: 12px;
  color: var(--ink3);
  margin-bottom: 16px;
}

.pbar {
  height: 5px;
  background: var(--bg2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.pfill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  border-radius: 3px;
  transition: width .4s ease;
  width: 0%;
}

.pstat {
  font-size: 11px;
  color: var(--ink4);
}

.cbtn {
  margin-top: 16px;
  padding: 8px 24px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink3);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}

@media(hover:hover) {
  .cbtn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
  }
}

.cbtn:active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

/* ═══ VIEWER ═══ */
.viewer-screen {
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
}

.vhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  padding-top: max(7px, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
  position: sticky;
  top: 0;
}

.vhl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vhl b {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  color: var(--ink);
}

.vpill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--teal-bg);
  color: var(--teal);
  letter-spacing: .5px;
  border: 1px solid var(--teal-bdr);
}

.vhr {
  display: flex;
  gap: 5px;
  align-items: center;
}

.mtog {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.mbtn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  background: var(--bg);
  color: var(--ink4);
  border: none;
  font-family: inherit;
  letter-spacing: .5px;
  transition: all .15s;
}

.mbtn.active {
  background: var(--ink);
  color: white;
}

@media(hover:hover) {
  .mbtn:hover:not(.active) {
    background: var(--bg2);
    color: var(--ink3);
  }
}

.mbtn:active:not(.active) {
  background: var(--bg2);
  color: var(--ink3);
}

.vfoot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  max-width: 320px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--green);
  color: white;
  transition: all .15s;
  box-shadow: 0 2px 8px rgba(30, 132, 73, .15);
  letter-spacing: .2px;
}

@media(hover:hover) {
  .dl-btn:hover {
    background: #1a7a42;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(30, 132, 73, .25);
  }
}

.dl-btn:active {
  background: #1a7a42;
  opacity: .9;
}

.dl-btn .dl-icon {
  font-size: 15px;
}

.foot-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg);
  color: var(--ink3);
  transition: all .15s;
}

@media(hover:hover) {
  .foot-btn:hover {
    border-color: var(--border2);
    color: var(--ink);
    background: var(--bg2);
  }
}

.foot-btn:active {
  border-color: var(--border2);
  color: var(--ink);
  background: var(--bg2);
}

.exp-tog {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.exp-tog-track {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  position: relative;
  transition: background .2s, border-color .2s;
}

.exp-tog-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 1px;
  left: 1px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.exp-tog.on .exp-tog-track {
  background: var(--teal);
  border-color: var(--teal);
}

.exp-tog.on .exp-tog-thumb {
  transform: translateX(12px);
}

.exp-tog-lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--ink4);
  letter-spacing: .3px;
}

/* ═══ CARD STAGE ═══ */
.card-stage {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 4px 6px 0;
}

.single-card {
  width: 100%;
  max-width: 460px;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.single-inner {
  flex: 1;
}

.sdiv {
  position: relative;
  padding: 0;
}

.sdiv::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 248, 240, .1), transparent);
}

.sdiv-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--dark);
  padding: 0 12px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, .5);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ═══ SIDE A ═══ */
.side-a {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(26, 24, 20, .1);
}

.side-a-in {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 4px;
  min-width: 0;
}

.a-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1.5px solid var(--border);
}

.a-header-text {
  flex: 1;
}

.a-title {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.a-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid var(--teal-bdr);
  margin-top: 3px;
}

.a-asof {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink3);
  letter-spacing: .02em;
  line-height: 1.2;
}

.gauge {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  position: relative;
}

.gauge svg {
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: var(--bg3);
  stroke-width: 4;
}

.gauge-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s ease;
}

.gauge-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.a-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 5px;
}

.a-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 3px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.a-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.a-stat.c-red::before {
  background: var(--red);
}

.a-stat.c-green::before {
  background: var(--green);
}

.a-stat.c-gold::before {
  background: var(--gold);
}

.a-stat.c-blue::before {
  background: var(--blue);
}

.a-stat.c-teal::before {
  background: var(--teal);
}

.a-stat.c-purple::before {
  background: var(--purple);
}

.a-stat.c-coral::before {
  background: var(--coral);
}

.sv {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.a-stat.c-red .sv {
  color: var(--red);
}

.a-stat.c-green .sv {
  color: var(--green);
}

.a-stat.c-gold .sv {
  color: var(--gold);
}

.a-stat.c-blue .sv {
  color: var(--blue);
}

.a-stat.c-teal .sv {
  color: var(--teal);
}

.a-stat.c-purple .sv {
  color: var(--purple);
}

.a-stat.c-coral .sv {
  color: var(--coral);
}

.sl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink4);
  margin-top: 1px;
  line-height: 1.15;
}

.a-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 4px;
}

.blk {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  border-left: 2.5px solid var(--border);
}

.blk.full {
  grid-column: 1/-1;
}

.bh {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 3px;
  line-height: 1;
}

.bh.red {
  color: var(--red);
}

.bh.green {
  color: var(--green);
}

.bh.blue {
  color: var(--blue);
}

.bh.gold {
  color: var(--gold);
}

.bh.teal {
  color: var(--teal);
}

.bh.purple {
  color: var(--purple);
}

.bh.coral {
  color: var(--coral);
}

.blk:has(.bh.red) {
  border-left-color: var(--red);
}

.blk:has(.bh.green) {
  border-left-color: var(--green);
}

.blk:has(.bh.blue) {
  border-left-color: var(--blue);
}

.blk:has(.bh.gold) {
  border-left-color: var(--gold);
}

.blk:has(.bh.teal) {
  border-left-color: var(--teal);
}

.blk:has(.bh.purple) {
  border-left-color: var(--purple);
}

.blk:has(.bh.coral) {
  border-left-color: var(--coral);
}

.bu {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.5;
  padding: 3px 0 3px 12px;
  position: relative;
}

.bu::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--bg4);
  position: absolute;
  left: 0;
  top: 7px;
}

.bu strong {
  color: var(--ink);
  font-weight: 700;
}

.bu.hot::before {
  background: var(--red);
  box-shadow: 0 0 3px rgba(192, 57, 43, .3);
}

.bu.warm::before {
  background: var(--gold);
}

.bu.cool::before {
  background: var(--green);
}

.people-row {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 4px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

.people-row::-webkit-scrollbar {
  display: none;
}

.pcard-mini {
  flex-shrink: 0;
  width: 110px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 6px;
  position: relative;
}

.pcard-mini::before {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pcard-mini.p-key::before {
  background: var(--red);
}

.pcard-mini.p-warm::before {
  background: var(--gold);
}

.pcard-mini.p-info::before {
  background: var(--blue);
}

.pm-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.pm-role {
  font-size: 10px;
  color: var(--ink4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin: 1px 0;
}

.pm-tip {
  font-size: 10px;
  color: var(--ink3);
  line-height: 1.25;
  font-style: italic;
}

.a-qt {
  background: var(--bg);
  border-left: 3px solid var(--gold);
  padding: 6px 10px;
  font-size: 12px;
  font-style: italic;
  color: var(--ink3);
  line-height: 1.45;
  margin: 4px 0;
  font-family: 'Playfair Display', serif;
  border-radius: 0 6px 6px 0;
}

.vd {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin-top: 4px;
}

.vd.good {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-bdr);
}

.vd.warn {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-bdr);
}

.vd.bad {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-bdr);
}

.a-tap {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--ink3);
  font-weight: 700;
  letter-spacing: .5px;
  margin-top: auto;
}

/* ═══ SIDE B ═══ */
.side-b {
  background: var(--dark);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 20px rgba(26, 24, 20, .15);
}

.side-b-in {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 6px;
  min-width: 0;
}

.b-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 248, 240, .08);
}

.b-title {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--lt);
  flex: 1;
  line-height: 1.15;
}

.b-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: var(--lt2);
  border: 1px solid rgba(255, 255, 255, .15);
}

.b-act {
  background: rgba(14, 122, 110, .18);
  border: 1px solid rgba(14, 122, 110, .3);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--lt);
  line-height: 1.5;
  font-weight: 600;
}

.b-act strong {
  color: #5dd4c8;
}

.say-this {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 5px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

.say-this::-webkit-scrollbar {
  display: none;
}

.say-card {
  flex-shrink: 0;
  width: 180px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
  transition: all .15s;
}

@media(hover:hover) {
  .say-card:hover {
    background: rgba(255, 255, 255, .12);
  }
}

.say-card:active {
  background: rgba(255, 255, 255, .15);
}

.say-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--lt2);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.say-text {
  font-size: 12px;
  color: var(--lt);
  line-height: 1.4;
  font-weight: 500;
  font-style: italic;
}

.say-ctx {
  font-size: 11px;
  color: var(--lt2);
  margin-top: 3px;
  font-weight: 600;
}

.b-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 4px;
}

.db {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  padding: 6px 8px;
  border-left: 2.5px solid transparent;
}

.db.full {
  grid-column: 1/-1;
}

.dbh {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 3px;
  line-height: 1;
}

.dbh.red {
  color: var(--red);
}

.dbh.green {
  color: #34d399;
}

.dbh.blue {
  color: #60a5fa;
}

.dbh.gold {
  color: var(--gold);
}

.dbh.teal {
  color: #5dd4c8;
}

.dbh.purple {
  color: #c084fc;
}

.dbh.coral {
  color: #fb923c;
}

.db:has(.dbh.red) {
  border-left-color: var(--red);
}

.db:has(.dbh.green) {
  border-left-color: #34d399;
}

.db:has(.dbh.teal) {
  border-left-color: #5dd4c8;
}

.db:has(.dbh.blue) {
  border-left-color: #60a5fa;
}

.db:has(.dbh.gold) {
  border-left-color: var(--gold);
}

.db:has(.dbh.purple) {
  border-left-color: #c084fc;
}

.db:has(.dbh.coral) {
  border-left-color: #fb923c;
}

.dbu {
  font-size: 12px;
  color: var(--lt2);
  line-height: 1.5;
  padding: 2px 0 2px 10px;
  position: relative;
}

.dbu::before {
  content: '●';
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 9px;
  color: var(--lt2);
}

.dbu strong {
  color: var(--lt);
  font-weight: 700;
}

.dbu.dont::before {
  content: '✕';
  font-size: 11px;
  color: var(--red);
  top: 2px;
}

.obj-pair {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 3px;
}

.obj-they {
  font-size: 11px;
  color: var(--red);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 2px;
}

.obj-they-text {
  font-size: 13px;
  color: var(--lt2);
  line-height: 1.5;
  font-style: italic;
  padding-left: 2px;
}

.obj-you {
  font-size: 11px;
  color: #34d399;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 2px;
  margin-top: 5px;
}

.obj-you-text {
  font-size: 13px;
  color: var(--lt);
  line-height: 1.5;
  font-weight: 500;
  padding-left: 2px;
}

.b-qt {
  background: rgba(255, 248, 240, .08);
  border-left: 3px solid var(--gold);
  padding: 6px 10px;
  font-size: 12px;
  font-style: italic;
  color: var(--lt2);
  line-height: 1.45;
  margin: 4px 0;
  font-family: 'Playfair Display', serif;
  border-radius: 0 6px 6px 0;
}

.b-vd {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin-top: 4px;
}

.b-vd.good {
  background: rgba(30, 132, 73, .15);
  color: #34d399;
}

.b-vd.warn {
  background: rgba(184, 134, 11, .15);
  color: var(--gold);
}

.b-vd.bad {
  background: rgba(192, 57, 43, .15);
  color: var(--red);
}

.b-tap {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--lt2);
  font-weight: 700;
  letter-spacing: .5px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  margin-top: auto;
}

.sdots {
  display: none;
}

.sdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg4);
  transition: all .25s;
}

.sdot.active {
  background: var(--teal);
  box-shadow: 0 0 6px rgba(14, 122, 110, .3);
}

.copied-toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: white;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
  z-index: 100;
}

.copied-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════ */
/* ═══ WWED — INTELLIGENCE LAYER ═══ */
/* ═══════════════════════════════════════════ */
.wwed-section {
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: 0 6px 16px;
  display: none;
}

.wwed-section.show {
  display: block;
}

.wwed-intro {
  text-align: center;
  padding: 10px 12px 6px;
  position: relative;
}

.wwed-intro::before {
  display: none;
}

.wwed-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dark4);
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  border: 1px solid var(--border);
  padding: 3px 12px;
  border-radius: 16px;
  margin-bottom: 4px;
}

.wwed-intro h2 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
  letter-spacing: -0.2px;
}

.wwed-intro h2 em {
  font-style: italic;
  color: var(--teal);
}

.wwed-intro p {
  font-size: 11px;
  color: var(--ink4);
  line-height: 1.4;
  max-width: 320px;
  margin: 0 auto;
}

.wwed-accordion {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wwed-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: all .3s ease;
  box-shadow: 0 2px 8px rgba(26, 24, 20, .04);
}

@media(hover:hover) {
  .wwed-panel:hover {
    border-color: var(--border2);
    box-shadow: 0 4px 16px rgba(26, 24, 20, .07);
  }
}

.wwed-panel:active {
  border-color: var(--border2);
}

.wwed-panel.open {
  box-shadow: 0 6px 24px rgba(26, 24, 20, .08);
}

.wwed-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}

@media(hover:hover) {
  .wwed-trigger:hover {
    background: var(--bg);
  }
}

.wwed-trigger:active {
  background: var(--bg);
}

.wwed-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: transform .3s;
}

.wwed-panel.open .wwed-icon {
  transform: scale(1.1);
}

.wwed-trigger-text {
  flex: 1;
}

.wwed-trigger-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.wwed-trigger-sub {
  font-size: 13px;
  color: var(--ink4);
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: 0.1px;
}

.wwed-arrow {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink4);
  font-size: 11px;
  transition: transform .3s;
  flex-shrink: 0;
}

.wwed-panel.open .wwed-arrow {
  transform: rotate(180deg);
}

.wwed-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s cubic-bezier(.23, 1, .32, 1);
}

.wwed-panel.open .wwed-body {
  max-height: 3000px;
}

.wwed-content {
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
}

.wc-lead {
  font-size: 15px;
  color: var(--ink2);
  line-height: 1.7;
  margin-top: 14px;
}

.wc-lead strong {
  color: var(--ink);
  font-weight: 700;
}

.wc-box {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
}

.wc-box-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.wc-box p {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 8px;
}

.wc-box p:last-child {
  margin-bottom: 0;
}

.wc-box strong {
  font-weight: 700;
}

.wc-box.teal {
  background: var(--teal-bg);
  border: 1px solid var(--teal-bdr);
}

.wc-box.teal .wc-box-label {
  color: var(--teal);
}

.wc-box.teal p {
  color: var(--ink2);
}

.wc-box.gold {
  background: var(--gold-bg);
  border: 1px solid var(--gold-bdr);
}

.wc-box.gold .wc-box-label {
  color: var(--gold);
}

.wc-box.gold p {
  color: var(--ink2);
}

.wc-box.red {
  background: var(--red-bg);
  border: 1px solid var(--red-bdr);
}

.wc-box.red .wc-box-label {
  color: var(--red);
}

.wc-box.red p {
  color: var(--ink2);
}

.wc-box.green {
  background: var(--green-bg);
  border: 1px solid var(--green-bdr);
}

.wc-box.green .wc-box-label {
  color: var(--green);
}

.wc-box.green p {
  color: var(--ink2);
}

.wc-box.blue {
  background: var(--blue-bg);
  border: 1px solid var(--blue-bdr);
}

.wc-box.blue .wc-box-label {
  color: var(--blue);
}

.wc-box.blue p {
  color: var(--ink2);
}

.wc-box.purple {
  background: var(--purple-bg);
  border: 1px solid var(--purple-bdr);
}

.wc-box.purple .wc-box-label {
  color: var(--purple);
}

.wc-box.purple p {
  color: var(--ink2);
}

.wc-box.dark {
  background: var(--dark);
  border: 1px solid var(--dark-border);
}

.wc-box.dark .wc-box-label {
  color: var(--lt2);
}

.wc-box.dark p {
  color: var(--lt);
  font-size: 15px;
}

.wc-box.dark strong {
  color: white;
}

.wc-quote {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-style: italic;
  color: var(--ink3);
  line-height: 1.6;
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  margin: 14px 0 6px;
  border-radius: 0 8px 8px 0;
  background: var(--bg);
}

.ic-red {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-bdr);
}

.ic-green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-bdr);
}

.ic-gold {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-bdr);
}

.ic-blue {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-bdr);
}

.ic-teal {
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid var(--teal-bdr);
}

.ic-purple {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--purple-bdr);
}

.ic-dark {
  background: var(--dark);
  color: var(--lt2);
  border: 1px solid var(--dark-border);
}

/* 10X Panel */
.wwed-10x {
  border: 1.5px solid var(--border2);
  background: linear-gradient(135deg, var(--card), var(--bg));
}

@media(hover:hover) {
  .wwed-10x:hover {
    border-color: var(--gold-bdr);
    box-shadow: 0 4px 20px rgba(184, 134, 11, .1);
  }
}

.wwed-10x.open {
  border-color: var(--gold-bdr);
  box-shadow: 0 8px 32px rgba(184, 134, 11, .12);
}

.ic-10x {
  background: linear-gradient(135deg, var(--ink), var(--dark2));
  color: white;
  border: 1px solid var(--dark-border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* 100X Panel */
.wwed-100x {
  border: 1.5px solid var(--coral-bdr);
  background: linear-gradient(135deg, var(--card), var(--coral-bg));
}

@media(hover:hover) {
  .wwed-100x:hover {
    border-color: var(--coral);
    box-shadow: 0 4px 20px rgba(192, 88, 42, .1);
  }
}

.wwed-100x.open {
  border-color: var(--coral);
  box-shadow: 0 8px 32px rgba(192, 88, 42, .12);
}

.ic-100x {
  background: linear-gradient(135deg, var(--coral), var(--red));
  color: white;
  border: 1px solid var(--coral);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hundredx-prompt {
  background: linear-gradient(135deg, var(--coral), #a04020);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.hundredx-prompt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--coral), var(--gold));
}

.hundredx-prompt-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
  margin-bottom: 6px;
}

.hundredx-prompt-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: white;
  line-height: 1.45;
}

.hundredx-prompt-text strong {
  font-weight: 800;
}

.tenx-prompt {
  background: linear-gradient(135deg, var(--ink), var(--dark2));
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.tenx-prompt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--coral), var(--red));
}

.tenx-prompt-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.tenx-prompt-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--lt);
  line-height: 1.45;
}

.tenx-prompt-text strong {
  color: white;
  font-weight: 800;
}

.tenx-insight {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  background: linear-gradient(135deg, var(--gold-bg), var(--bg));
  border: 1.5px solid var(--gold-bdr);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.tenx-insight::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--coral));
}

.tenx-insight-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tenx-insight-text {
  flex: 1;
}

.tenx-insight-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.tenx-insight-text p {
  font-size: 15px;
  color: var(--ink2);
  line-height: 1.7;
}

.tenx-insight-text strong {
  color: var(--ink);
  font-weight: 700;
}

/* WWED loading */
.wwed-loading {
  text-align: center;
  padding: 20px;
  display: none;
}

.wwed-loading.show {
  display: block;
}

.wwed-loading .wl-spin {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--bg3);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-bottom: 8px;
}

.wwed-loading p {
  font-size: 11px;
  color: var(--ink4);
  font-weight: 600;
}

@media(max-width:400px) {

  .a-grid,
  .b-grid {
    grid-template-columns: 1fr !important;
  }

  .blk,
  .db {
    grid-column: 1/-1;
  }
}

@media(max-width:380px) {
  .sv {
    font-size: 14px;
  }

  .wwed-trigger-title {
    font-size: 12px;
  }
}

/* ═══ PRINT STYLES ═══ */
@media print {

  /* Hide everything except the viewer */
  #screen-upload,
  #screen-progress,
  .vhead,
  .vfoot,
  .sdots,
  .wwed-loading,
  .viewer-err-wrap,
  .a-tap,
  .b-tap,
  .mega-zone,
  .btn,
  .err,
  .cbtn,
  .history-sidebar,
  .history-overlay {
    display: none !important;
  }

  body {
    background: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body::after {
    display: none !important;
  }

  .screen {
    display: block !important;
    overflow: visible !important;
  }

  .viewer-screen {
    overflow: visible !important;
    height: auto !important;
  }

  .card-stage {
    height: auto !important;
    padding: 0 !important;
  }

  .single-card {
    max-width: 100% !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  .single-inner {
    overflow: visible !important;
  }

  /* Card sides */
  .side-a {
    border-radius: 8px !important;
    margin-bottom: 8px;
    break-inside: avoid;
  }

  .side-b {
    border-radius: 8px !important;
    break-inside: avoid;
  }

  .side-a,
  .side-b,
  .side-a-in,
  .side-b-in {
    overflow: visible !important;
  }

  .sdiv {
    padding: 4px 0 !important;
  }

  /* Force dark backgrounds to print */
  .side-b {
    background: #2a2520 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .side-b * {
    color: white !important;
  }

  .side-b .dbh {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Stats */
  .a-stats {
    break-inside: avoid;
  }

  .a-stat {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* People */
  .people-row {
    break-inside: avoid;
  }

  .pcard-mini {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* WWED section */
  .wwed-section {
    display: block !important;
    max-width: 100% !important;
    padding: 8px 0 !important;
  }

  .wwed-panel {
    break-inside: avoid;
    border-radius: 8px !important;
    margin-bottom: 6px;
  }

  /* Open all panels for print */
  .wwed-body {
    max-height: none !important;
    overflow: visible !important;
  }

  .wwed-arrow {
    display: none !important;
  }

  .wwed-content {
    border-top: 1px solid #ddd !important;
  }

  /* Colors print properly */
  .wc-box {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
  }

  .wc-box.dark {
    background: #2a2520 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wc-box.dark * {
    color: white !important;
  }

  .tenx-prompt,
  .hundredx-prompt {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
  }

  .tenx-prompt *,
  .hundredx-prompt * {
    color: white !important;
  }

  .tenx-insight {
    break-inside: avoid;
  }

  /* Quotes */
  .wc-quote,
  .a-qt,
  .b-qt {
    break-inside: avoid;
  }

  /* Say-this cards */
  .say-card {
    break-inside: avoid;
  }

  .say-ctx {
    display: none !important;
  }

  /* Objection pairs */
  .obj-pair {
    break-inside: avoid;
  }

  /* Page margins */
  @page {
    margin: 0.5in 0.4in;
    size: auto;
  }
}

/* ═══ RECENT BRIEFS SIDEBAR (localStorage) ═══ */
.history-toolbar-btn {
  padding: 0.5rem 1rem;
  font-weight: 600;
}

/* Below .app-toolbar (56px) so the header stays visible and usable */
.history-overlay {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
  z-index: 1001;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.history-overlay.active {
  opacity: 1;
  visibility: visible;
}

.history-sidebar {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  width: min(320px, 100vw);
  max-width: 100%;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(26, 24, 20, .12);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-sidebar.open {
  transform: translateX(0);
}

.history-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.history-sidebar-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink3);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

@media(hover:hover) {
  .history-sidebar-close:hover {
    border-color: var(--border2);
    color: var(--ink);
    background: var(--bg2);
  }
}

.history-sidebar-close:active {
  transform: scale(0.96);
}

.history-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 16px;
  overflow: hidden;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-empty {
  font-size: 12px;
  color: var(--ink4);
  line-height: 1.5;
  margin: 8px 4px 12px;
  text-align: center;
  display: none;
}

.history-empty.show {
  display: block;
}

.history-clear-all {
  margin-top: auto;
  align-self: center;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink4);
  cursor: pointer;
  transition: all .15s;
}

@media(hover:hover) {
  .history-clear-all:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
  }
}

.history-clear-all:active {
  border-color: var(--red);
  color: var(--red);
}

.history-row {
  width: 100%;
}

.history-row-card {
  position: relative;
  border-radius: 10px;
}

.history-row-main {
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  display: block;
}

@media(hover:hover) {
  .history-row-main:hover {
    border-color: var(--teal);
    background: var(--teal-bg);
  }
}

.history-row-main:active {
  border-color: var(--teal);
}

.history-row-main.active {
  border-color: var(--teal);
  background: var(--teal-bg);
  box-shadow: 0 0 0 1px var(--teal-bdr);
}

.history-row-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 2px;
}

.history-row-meta {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink4);
  margin-top: 4px;
  letter-spacing: .02em;
}

.history-row-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--purple-bdr);
}

.history-row-badge.brief-only {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: var(--teal-bdr);
}

.history-row-del {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink4);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

@media(hover:hover) {
  .history-row-del:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
  }
}

.history-row-del:active {
  transform: scale(0.95);
}


/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */
.footer {
  padding: 24px 16px 40px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.ai-disclaimer {
  background: linear-gradient(145deg, rgba(255, 184, 0, 0.08) 0%, rgba(255, 184, 0, 0.03) 100%);
  border: 1px solid rgba(255, 184, 0, 0.15);
  border-radius: 16px;
  padding: 18px;
  margin: 0 auto 24px;
  max-width: 800px;
}

.ai-disclaimer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #FFB800;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ai-disclaimer-text {
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.footer-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.footer-link:hover {
  color: var(--cyan);
}

.footer-copyright {
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.5px;
}