:root {
  --bg: #0b1020;
  --panel: rgba(18, 27, 47, 0.95);
  --panel-strong: rgba(21, 31, 58, 0.98);
  --panel-border: rgba(130, 150, 190, 0.18);
  --text: #e8ecf3;
  --text-soft: #b7c0d4;
  --text-muted: #8e98af;
  --accent: #3d6df2;
  --accent-glow: rgba(61, 109, 242, 0.28);
  --accent-soft: rgba(90, 125, 230, 0.15);
  --gold: #f3df9b;
  --gold-bg: rgba(120, 94, 20, 0.18);
  --gold-border: rgba(212, 175, 55, 0.28);
  --success: #9ed0a8;
  --focus: #8fb2ff;

  --panel-margin: 20px;
  --panel-padding: 24px;
  --panel-gap: 32px;
  --tap-min: 44px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  padding: 32px 16px;
  background:
    radial-gradient(circle at top, rgba(70, 100, 180, 0.18), transparent 35%),
    linear-gradient(180deg, #0b1020 0%, #11182b 100%);
}

.container {
  max-width: 820px;
  margin: 0 auto;
}

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

.hero h1 {
  margin: 0 0 8px;
  font-size: 2.2rem;
  line-height: 1.08;
}

.subtitle {
  margin: 0 auto;
  max-width: 640px;
  color: #f2f5fb;
  line-height: 1.4;
  font-size: 1.1rem;
  font-weight: 700;
}

.hero .helper-text {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero .helper-text:first-of-type {
  color: var(--text-soft);
}

.hero .helper-text:not(:first-of-type) {
  color: #c9d2e5;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: var(--panel-padding);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.input-card,
.quick-guide-card {
  margin-bottom: 18px;
}

.label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: #f4f7fb;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.input-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
  width: 100%;
}

.input-row input {
  flex: 1 1 260px;
  min-width: 0;
  width: 100%;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  padding: 0 52px 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(145, 165, 205, 0.2);
  background: #0f172a;
  color: #f4f7fb;
  font-size: 1rem;
  line-height: 56px;
  outline: none;
  display: block;
  appearance: none;
  -webkit-appearance: none;
}

.input-marker {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--gold-bg);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.input-row input::placeholder {
  color: #7f8aa3;
}

.input-row input:focus,
.input-row input:focus-visible {
  border-color: rgba(115, 150, 255, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-row button,
.copy-btn,
.unlock-link {
  min-height: var(--tap-min);
}

.input-row button,
.copy-btn {
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

button,
.copy-btn,
.unlock-link,
input,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
.copy-btn:focus-visible,
.unlock-link:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  margin-right: 16px;
  color: #d4dbeb;
  font-size: 0.98rem;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
}

.helper-text {
  margin: 12px 0 0;
  color: #9aa7c2;
  font-size: 0.92rem;
  line-height: 1.45;
}

.input-card .helper-text {
  max-width: 680px;
}

.pro-lock-box {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--gold-border);
  background: var(--gold-bg);
  color: var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.results {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.results h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.results p {
  margin: 0 0 8px;
  color: #dbe3f2;
  line-height: 1.35;
}

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

.packet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.packet-grid.single-column {
  grid-template-columns: 1fr;
}

.packet-block {
  background: rgba(10, 18, 36, 0.35);
  border: 1px solid rgba(130, 150, 190, 0.14);
  border-radius: 12px;
  padding: 12px 14px;
}

.packet-mini-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3c7;
  margin-bottom: 8px;
}

.packet-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f4f7fb;
  margin-bottom: 6px;
  line-height: 1.2;
}

.packet-description {
  font-size: 0.95rem;
  line-height: 1.4;
  color: #d7def0;
}

.share-text {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #d7def0;
}

.copy-btn {
  margin-top: 10px;
}

.copy-status {
  margin-top: 10px;
  color: var(--success);
  font-size: 0.95rem;
}

.hero-result-card {
  border: 1px solid rgba(85, 120, 220, 0.22);
  background: linear-gradient(180deg, rgba(24, 34, 63, 0.98) 0%, rgba(19, 28, 52, 0.98) 100%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.hero-result-card h2 {
  margin: 0 0 12px;
  font-size: 1.32rem;
  line-height: 1.18;
  color: #f4f7fb;
}

#interpretationValue {
  color: #dbe3f2;
  line-height: 1.65;
  font-size: 1rem;
}

#interpretationValue strong {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  color: #f4f7fb;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#interpretationValue strong:first-child {
  margin-top: 0;
}

.quick-guide-card {
  border: 1px solid rgba(85, 120, 220, 0.18);
  background: rgba(20, 29, 52, 0.92);
  padding: 0;
  overflow: hidden;
}

.lite-guide-details {
  width: 100%;
}

.lite-guide-summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.lite-guide-summary::-webkit-details-marker {
  display: none;
}

.lite-guide-summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #91a7df;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.lite-guide-details[open] .lite-guide-summary::after {
  content: "−";
}

.guide-summary-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #91a7df;
}

.guide-summary-title {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.2;
  color: #f4f7fb;
  padding-right: 28px;
}

.lite-guide-content {
  padding: 0 20px 20px;
  border-top: 1px solid rgba(130, 150, 190, 0.12);
}

.guide-header {
  margin-bottom: 12px;
}

.guide-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #91a7df;
  margin-bottom: 8px;
}

.quick-guide-card h2 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  line-height: 1.2;
  color: #f4f7fb;
}

.quick-guide-card .helper-text {
  line-height: 1.4;
}

.guide-section {
  margin-top: 16px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.guide-chip {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(130, 150, 190, 0.14);
  background: rgba(10, 18, 36, 0.35);
  color: #d7def0;
  line-height: 1.35;
  font-size: 0.92rem;
}

.lite-footer-card {
  border: 1px solid rgba(85, 120, 220, 0.22);
  background: var(--panel-strong);
}

.lite-footer-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #91a7df;
  margin-bottom: 10px;
}

.lite-footer-text {
  margin-bottom: 14px !important;
  color: #d7def0;
  line-height: 1.45;
}

.unlock-link {
  min-width: 220px;
  display: inline-flex;
  text-decoration: none;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ===== TD PRO LIBRARY PATCH ===== */

.results .card,
.quick-guide-card,
.input-card {
  margin-bottom: 0;
}

.card + .card {
  margin-top: 0;
}

.guide-header h2,
.card h2 {
  line-height: 1.25;
}

.guide-section + .guide-section {
  margin-top: 18px;
}

.guide-grid .guide-chip strong {
  color: #f4f7fb;
}

.library-note,
.library-helper {
  margin-top: 10px;
  color: #9aa7c2;
  font-size: 0.92rem;
  line-height: 1.45;
}

.library-number-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.library-section-card {
  border: 1px solid rgba(85, 120, 220, 0.22);
  background: var(--panel-strong);
}

.library-section-card .helper-text {
  color: #a8b3ca;
}

.library-number-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.library-number-chip {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  background: rgba(120, 94, 20, 0.12);
  color: var(--gold);
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.section-spacer-tight {
  margin-top: 12px;
}

.section-spacer-md {
  margin-top: 16px;
}

.section-spacer-lg {
  margin-top: 20px;
}

/* ===== NUMERIC PRODUCT / ANDREA POLISH ===== */

.product-accent {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.32rem;
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 2px 6px;
  border-radius: 10px;
  transition: transform 150ms ease, filter 150ms ease, text-shadow 150ms ease;
  text-shadow: 0 0 0 transparent;
  transform-origin: center center;
}

.product-pulse {
  animation: productPulse 600ms ease 1;
}

.product-accent:active {
  transform: scale(1.04);
}

@keyframes productPulse {
  0% {
    transform: scale(1);
    text-shadow: 0 0 0 transparent;
    opacity: 1;
  }
  35% {
    transform: scale(1.08);
    text-shadow: 0 0 14px var(--accent-glow);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 0 transparent;
    opacity: 1;
  }
}

/* ===== TD PRO INPUT MARKER + ANDREA BUTTON STYLE ===== */

.pro-input-wrap {
  position: relative;
}

.pro-input-wrap .input-marker {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.pro-decode-btn {
  border: 1px solid rgba(150, 180, 255, 0.22);
  background:
    radial-gradient(circle at 15% 50%, rgba(255, 120, 200, 0.55), transparent 22%),
    radial-gradient(circle at 85% 45%, rgba(120, 255, 235, 0.55), transparent 24%),
    linear-gradient(90deg, #8759ff 0%, #4d6fff 35%, #53c8ff 68%, #83f2e2 100%);
  color: #ffffff;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.pro-decode-btn:hover,
.pro-decode-btn:focus {
  filter: brightness(1.04);
}

.pro-decode-btn:active {
  transform: translateY(1px);
}

/* ===== ANDREA PRO BUTTON STRONG OVERRIDE ===== */

#decodeBtn.pro-decode-btn,
#decodeNameBtn.pro-decode-btn {
  width: 100%;
  min-height: 74px;
  border-radius: 18px;
  border: 1px solid rgba(180, 210, 255, 0.22);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
  background:
    radial-gradient(circle at 12% 50%, rgba(255, 120, 210, 0.85) 0%, rgba(255, 120, 210, 0.18) 18%, transparent 30%),
    radial-gradient(circle at 88% 50%, rgba(130, 255, 235, 0.85) 0%, rgba(130, 255, 235, 0.18) 20%, transparent 34%),
    linear-gradient(90deg, #8a5cff 0%, #5a6dff 34%, #58cfff 68%, #8ff3e8 100%);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

#decodeBtn.pro-decode-btn:hover,
#decodeBtn.pro-decode-btn:focus,
#decodeNameBtn.pro-decode-btn:hover,
#decodeNameBtn.pro-decode-btn:focus {
  filter: brightness(1.05) saturate(1.08);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#decodeBtn.pro-decode-btn:active,
#decodeNameBtn.pro-decode-btn:active {
  transform: translateY(1px);
}

/* ===== SHARE CARD POLISH ===== */

#shareTextPreview {
  margin-bottom: 10px;
  color: #aeb8ce;
}

#shareTextValue,
#nameShareTextValue {
  margin-top: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 18, 36, 0.32);
  border: 1px solid rgba(130, 150, 190, 0.12);
}

#copyBtn.copy-btn {
  margin-top: 12px;
}

#copyStatus {
  margin-top: 8px;
}

/* ===== PRO CARD RHYTHM POLISH ===== */

.quick-guide-card .input-row {
  margin-top: 2px;
}

.quick-guide-card .unlock-link {
  min-width: 0;
}

.input-card .example-row {
  margin-top: 12px;
}

.input-card .example-row .helper-text {
  margin-top: 0;
}

.results .card > h2 + .helper-text {
  margin-top: 6px;
}

/* ===== NAME MODE HOOK LAYER POLISH ===== */

#hookTitleValue {
  color: var(--gold);
  font-size: 1.28rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

#mostSpecificLabelValue {
  color: var(--gold);
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1.25;
}

#personalLineValue {
  color: #f4f7fb;
  font-size: 1.02rem;
  line-height: 1.55;
  font-weight: 600;
}

#repostHookValue {
  color: #e7ecf8;
  font-weight: 700;
}

#typeBadgeValue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(90, 210, 255, 0.28);
  background: rgba(40, 125, 170, 0.16);
  color: #8fe8ff;
  font-size: 0.88rem;
  font-weight: 700;
}

#combinedSignatureHeroValue {
  color: #8fe8ff;
  font-size: 1.16rem;
  font-weight: 800;
}

#stabilityTypeValue {
  color: #edf2fb;
  font-weight: 700;
}

#signatureFeedbackValue,
#plainReadValue {
  line-height: 1.6;
}

#stabilityDetailValue,
#bestStateValue,
#underPressureValue,
#shareCaptionValue {
  color: #d3dbee;
}

#screenshotChipsValue {
  color: #8fe8ff;
  font-weight: 700;
}

#nameResults .card:nth-of-type(2) p {
  margin-bottom: 12px;
}

#nameResults .card:nth-of-type(2) p strong,
#nameResults .card p strong {
  color: #f4f7fb;
}

/* ===== COPY BUTTON / NAME SHARE POLISH ===== */

#copyNameShareBtn.copy-btn {
  margin-top: 12px;
}

#copyNameShareStatus {
  margin-top: 8px;
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .product-pulse {
    animation: none !important;
  }

  .product-accent,
  .product-accent:active,
  #decodeBtn.pro-decode-btn,
  #decodeBtn.pro-decode-btn:active,
  #decodeNameBtn.pro-decode-btn,
  #decodeNameBtn.pro-decode-btn:active,
  .pro-decode-btn,
  .pro-decode-btn:active,
  .copy-btn,
  .copy-btn:active {
    transition: none !important;
    transform: none !important;
  }
}

/* ===== MOBILE ===== */

@media (max-width: 640px) {
  .app-shell {
    padding: 20px 12px;
  }

  .hero {
    margin-bottom: 18px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .card {
    padding: 14px 16px;
  }

  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .input-wrap {
    width: 100%;
    flex: 0 0 auto;
  }

  .input-row button {
    width: 100%;
    flex: 0 0 auto;
  }

  .input-row input,
  .copy-btn,
  .unlock-link {
    width: 100%;
  }

  .packet-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .library-number-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-number-chip {
    padding: 10px 12px;
    font-size: 0.92rem;
  }

  .hero-result-card h2,
  .quick-guide-card h2 {
    font-size: 1.08rem;
  }

  #interpretationValue {
    font-size: 0.95rem;
  }

  .input-marker {
    right: 12px;
    top: 28px;
    transform: none;
  }

  .pro-input-wrap .input-marker {
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
  }

  .guide-summary-title {
    font-size: 1rem;
  }

  #decodeBtn.pro-decode-btn,
  #decodeNameBtn.pro-decode-btn {
    min-height: 72px;
    border-radius: 16px;
    font-size: 1.04rem;
  }

  #shareTextValue,
  #nameShareTextValue {
    font-size: 0.92rem;
    line-height: 1.42;
    padding: 11px 12px;
  }

  #shareTextPreview {
    margin-bottom: 8px;
  }

  #hookTitleValue {
    font-size: 1.14rem;
  }

  #personalLineValue {
    font-size: 0.98rem;
  }
}
