:root {
  --radius-card: 24px;
  --radius-pill: 50px;
  --motion: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
}

button {
  font: inherit;
  cursor: pointer;
}

html[data-share-theme="dark"],
body.theme-dark {
  --bg: #030712;
  --primary: #93c5fd;
  --primary-deep: #3b82f6;
  --secondary: #64748b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --glass-bg: rgba(8, 13, 24, 0.92);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-strong: rgba(148, 163, 184, 0.18);
  --row-bg: rgba(148, 163, 184, 0.06);
}

html[data-share-theme="light"],
body.theme-light {
  --bg: #eef3f9;
  --primary: #2f6fed;
  --primary-deep: #1f56c7;
  --secondary: #0f8fa8;
  --text: #142033;
  --muted: #5d6b7d;
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(30, 64, 105, 0.13);
  --glass-strong: rgba(30, 64, 105, 0.2);
  --row-bg: rgba(47, 111, 237, 0.06);
}

html[data-share-theme="wesley"],
body.theme-wesley {
  --bg: #0f172a;
  --primary: #38bdf8;
  --primary-deep: #0ea5e9;
  --secondary: #818cf8;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --row-bg: rgba(56, 189, 248, 0.06);
}

html[data-share-theme="dark"] body::before,
body.theme-dark::before {
  background:
    radial-gradient(ellipse 65% 45% at 18% 25%, rgba(30, 41, 59, 0.34) 0%, transparent 64%),
    radial-gradient(ellipse 46% 56% at 82% 74%, rgba(15, 23, 42, 0.54) 0%, transparent 68%);
}

html[data-share-theme="light"] body::before,
body.theme-light::before {
  background:
    radial-gradient(ellipse 72% 52% at 18% 18%, rgba(47, 111, 237, 0.12) 0%, transparent 62%),
    radial-gradient(ellipse 52% 58% at 84% 78%, rgba(14, 143, 168, 0.1) 0%, transparent 64%);
}

html[data-share-theme="wesley"] body::before,
body.theme-wesley::before {
  background:
    radial-gradient(ellipse 70% 50% at 20% 30%, rgba(56, 189, 248, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 70%, rgba(129, 140, 248, 0.08) 0%, transparent 60%);
}

html[data-share-theme="dark"] body::after,
body.theme-dark::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.62));
}

html[data-share-theme="light"] body::after,
body.theme-light::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(210, 221, 234, 0.52));
}

html[data-share-theme="wesley"] body::after,
body.theme-wesley::after {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.08), rgba(2, 6, 23, 0.28));
}

.share-controls {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.theme-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: 0 16px 45px rgba(2, 6, 23, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.theme-menu-trigger,
.theme-options button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

.theme-menu-trigger {
  color: var(--primary);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.18);
  line-height: 36px;
}

.theme-menu-icon,
.theme-choice-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-menu-icon {
  width: 18px;
  height: 18px;
}

.theme-options {
  display: grid;
  grid-template-columns: 0fr 0fr 0fr;
  gap: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.22s var(--motion), opacity 0.18s var(--motion), grid-template-columns 0.22s var(--motion), gap 0.22s var(--motion);
}

.theme-menu:hover .theme-options,
.theme-menu:focus-within .theme-options {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  max-width: 285px;
  opacity: 1;
}

.theme-options button {
  gap: 7px;
  width: auto;
  min-width: 84px;
  padding: 0 12px;
  color: var(--muted);
  border-color: var(--glass-border);
}

.theme-options button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-options button strong {
  font-size: 0.78rem;
}

.theme-options button:hover,
.theme-options button.active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.28);
}

.print-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  color: var(--primary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: 0 16px 45px rgba(2, 6, 23, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0.76;
  transition: opacity 0.18s var(--motion), border-color 0.18s var(--motion), background 0.18s var(--motion);
}

.print-button:hover,
.print-button:focus-visible {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.28);
  opacity: 1;
}

.print-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.print-scope-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.55);
}

.print-scope-overlay[hidden] {
  display: none !important;
}

.print-scope-panel {
  width: min(100%, 360px);
  padding: 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.print-scope-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.print-scope-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.print-scope-body {
  display: grid;
  gap: 8px;
}

.print-scope-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--glass-strong);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text);
}

.print-scope-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.print-scope-error {
  margin: 10px 0 0;
  color: #dc2626;
  font-size: 0.82rem;
}

.print-mobile-tip {
  display: none;
}

.print-scope-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.print-scope-cancel {
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
}

.print-scope-overlay .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
}

.print-scope-overlay .icon-button:hover,
.print-scope-overlay .icon-button:focus-visible {
  color: var(--text);
  background: var(--glass-strong);
}

.print-scope-confirm {
  padding: 8px 18px;
  background: var(--primary);
  color: #0f172a;
  border: 0;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.9rem;
}

.no-print {
  display: none !important;
}

.share-shell {
  width: min(100% - 40px, 980px);
  margin: 0 auto;
  padding: 76px 0 56px;
}

.invalid-share-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.invalid-share-shell {
  width: min(100%, 560px);
}

.invalid-share-card {
  padding: 34px;
  text-align: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.invalid-share-card h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1.08;
}

.invalid-share-card p:not(.share-eyebrow) {
  margin: 14px 0 24px;
  color: var(--muted);
  font-weight: 700;
}

.invalid-share-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  color: var(--bg);
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-radius: var(--radius-pill);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.26);
}

.share-header {
  margin-bottom: 18px;
  padding: 24px 26px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.26);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.share-eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.share-header h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.05;
}

.share-header p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.share-content {
  display: grid;
  gap: 16px;
}

.share-card,
.state-card {
  position: relative;
  padding: 24px;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 55px rgba(2, 6, 23, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.share-card::before,
.state-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), transparent 42%, rgba(129, 140, 248, 0.06));
}

.share-card > *,
.state-card > * {
  position: relative;
}

.share-card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
}

.verse-card {
  position: relative;
  margin: 12px 0 0;
  padding: 16px 18px;
  color: var(--text);
  background: var(--row-bg);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--primary);
  border-radius: 16px;
  line-height: 1.65;
}

.spelling-table {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 16px;
}

.spelling-table th,
.spelling-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.spelling-table th {
  color: var(--muted);
  background: var(--row-bg);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spelling-table tr:nth-child(even) td {
  background: var(--row-bg);
}

.spelling-table tr:last-child td {
  border-bottom: 0;
}

.spelling-table td:first-child {
  width: auto;
  color: var(--text);
  font-weight: 800;
}

.share-item-list {
  display: grid;
  gap: 10px;
}

.share-work-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--row-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

.share-work-item h3 {
  margin: 0;
  font-size: 0.98rem;
}

.share-work-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.share-work-description {
  line-height: 1.5;
  white-space: pre-wrap;
}

.share-link-preview-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  overflow: hidden;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  text-decoration: none;
}

.share-link-preview-card.pending {
  border-style: dashed;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.06);
}

.share-link-preview-card.pending .share-link-preview-site {
  color: #f59e0b;
}

.share-link-preview-media-pending {
  color: #0f172a;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.share-link-preview-media-pending svg {
  width: 40px;
  height: 40px;
}

.share-link-preview-media {
  display: grid;
  place-items: center;
  min-height: 84px;
  overflow: hidden;
  color: #ffffff;
  background: var(--accent);
  font-size: 1.25rem;
  font-weight: 900;
}

.share-link-preview-media-google {
  background: #fff;
  padding: 14px;
}

.share-link-preview-media-google svg {
  width: 100%;
  height: 100%;
  max-width: 48px;
  max-height: 48px;
}

.share-link-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.share-link-preview-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 12px 14px 12px 0;
}

.share-link-preview-site {
  overflow: hidden;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.share-link-preview-body strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-link-preview-body span:not(.share-link-preview-site) {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.share-gc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  text-decoration: none;
  cursor: pointer;
  background: rgba(15, 157, 88, 0.08);
  border: 1px solid rgba(15, 157, 88, 0.2);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.share-gc-badge:hover {
  background: rgba(15, 157, 88, 0.16);
  border-color: rgba(15, 157, 88, 0.35);
  box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.15);
  transform: scale(1.1);
}
.share-gc-badge:focus-visible {
  outline: 2px solid #0F9D58;
  outline-offset: 2px;
  border-radius: 50%;
}

.share-gc-badge img {
  width: 14px;
  height: 14px;
  display: block;
}

.share-task-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 0.86rem;
}

.share-task-list .completed {
  color: var(--muted);
  text-decoration: line-through;
}

.state-card {
  display: grid;
  min-height: 170px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 640px) {
  .print-mobile-tip {
    display: block;
    margin: 0 0 12px;
    padding: 10px 12px;
    color: var(--text);
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.45;
  }

  .share-controls {
    top: 12px;
    right: 12px;
    align-items: flex-start;
  }

  .print-button {
    width: 42px;
    height: 42px;
  }

  .theme-menu-trigger {
    flex: 0 0 36px;
  }

  .theme-menu:not(.is-open) .theme-options {
    grid-template-columns: 0fr 0fr 0fr;
    gap: 0;
    max-width: 0;
    opacity: 0;
  }

  .theme-menu.is-open .theme-options {
    grid-template-columns: 1fr;
    gap: 6px;
    max-width: 150px;
    opacity: 1;
  }

  .theme-options {
    grid-template-columns: 0fr 0fr 0fr;
  }

  .theme-options button {
    justify-content: flex-start;
    min-width: 132px;
  }

  .share-shell {
    width: min(100% - 28px, 980px);
    padding: 70px 0 32px;
  }

  .share-header,
  .share-card,
  .state-card {
    padding: 20px;
  }

  .spelling-table th,
  .spelling-table td {
    padding: 11px 10px;
  }
}

@page {
  size: letter;
  margin: 0.55in;
}

@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html,
  body {
    width: 100%;
    min-height: auto;
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 10.5pt;
    overflow: visible;
  }

  body::before,
  body::after,
  .share-controls,
  .print-button,
  .print-scope-overlay {
    display: none !important;
  }

  .share-shell,
  .share-shell *,
  .state-card,
  .state-card * {
    color: #000000 !important;
  }

  .share-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .share-header {
    margin: 0 0 18pt;
    padding: 0 0 10pt;
    background: transparent !important;
    border: 0;
    border-bottom: 1.5pt solid #000000;
    border-radius: 0;
  }

  .share-eyebrow {
    margin: 0 0 4pt;
    color: #000000 !important;
    font-size: 8pt;
    letter-spacing: 0.08em;
  }

  .share-header h1 {
    color: #000000 !important;
    font-size: 0;
    line-height: 1.1;
  }

  .share-header h1::after {
    display: block;
    color: #000000 !important;
    content: attr(data-print-title);
    font-size: 20pt;
    font-weight: 800;
    line-height: 1.1;
  }

  .share-header p {
    margin: 6pt 0 0;
    color: #000000 !important;
    font-size: 9.5pt;
  }

  .share-content {
    display: block;
  }

  .share-card,
  .state-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 14pt;
    padding: 0;
    overflow: visible;
    background: transparent !important;
    border: 0;
    border-radius: 0;
  }

  .share-card::before,
  .state-card::before {
    display: none;
  }

  .share-card h2 {
    margin: 0 0 7pt;
    padding: 0 0 4pt;
    color: #000000 !important;
    border-bottom: 0.75pt solid #d1d5db;
    font-size: 12.5pt;
  }

  .verse-card {
    margin: 0 0 8pt;
    padding: 7pt 9pt;
    color: #000000 !important;
    background: #ffffff !important;
    border: 0.75pt solid #d1d5db;
    border-left: 3pt solid #000000;
    border-radius: 0;
    line-height: 1.42;
  }

  .spelling-table {
    border: 0.75pt solid #9ca3af;
    border-radius: 0;
    border-collapse: collapse;
  }

  .spelling-table th,
  .spelling-table td {
    padding: 5pt 7pt;
    border: 0.75pt solid #d1d5db;
  }

  .spelling-table th {
    color: #000000 !important;
    background: #f3f4f6 !important;
    font-size: 8pt;
  }

  .spelling-table tr:nth-child(even) td {
    background: #fafafa !important;
  }

  .share-item-list {
    display: block;
  }

  .share-work-item {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 7pt;
    padding: 7pt 0;
    background: transparent !important;
    border: 0;
    border-bottom: 0.75pt solid #e5e7eb;
    border-radius: 0;
  }

  .share-work-item h3 {
    color: #000000 !important;
    font-size: 10.5pt;
  }

  .share-work-item p,
  .share-work-description {
    color: #000000 !important;
    font-size: 9pt;
    line-height: 1.35;
  }

  .share-link-preview-card {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 4pt;
    color: #000000 !important;
    background: transparent !important;
    border: 0.75pt solid #d1d5db;
    border-radius: 0;
  }

  .share-link-preview-media {
    display: none;
  }

  .share-link-preview-body {
    gap: 1pt;
    padding: 5pt 6pt;
  }

  .share-link-preview-site,
  .share-link-preview-body strong,
  .share-link-preview-body span:not(.share-link-preview-site) {
    color: #000000 !important;
    font-size: 8.5pt;
  }

  .share-task-list {
    gap: 2pt;
    margin-top: 4pt;
    color: #000000 !important;
    font-size: 9pt;
  }

  .share-task-list .completed {
    color: #000000 !important;
  }

  .state-card {
    min-height: 0;
    color: #000000 !important;
    text-align: left;
  }
}
