:root {
  --bg-1: #12051f;
  --bg-2: #090311;
  --panel-border: rgba(255,255,255,0.12);
  --text: #f7f2ff;
  --muted: #b8a9d4;
  --text2: #d7caee;
  --text3: #9f90be;
  --pink: #ff4fd8;
  --cyan: #27f5ff;
  --green-neon: #69ff8b;
  --green-glow: rgba(105,255,139,0.34);
  --surface: rgba(26, 21, 52, 0.92);
  --surface2: rgba(18, 14, 38, 0.96);
  --border2: rgba(255,255,255,0.14);
  --warning: #ffdd66;
  --danger: #ff8b9c;
  --success: #69ff8b;
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --shadow: 0 0 0 2px rgba(255,255,255,0.06), 0 18px 50px rgba(0,0,0,0.45);
}

:root[data-theme="light"] {
  --bg-1: #f7f4ff;
  --bg-2: #e9fbff;
  --panel-border: rgba(20,20,40,0.12);
  --text: #171322;
  --muted: #605478;
  --text2: #352f48;
  --text3: #746a88;
  --surface: rgba(255,255,255,0.92);
  --surface2: rgba(245,245,255,0.96);
  --border2: rgba(20,20,40,0.16);
  --shadow: 0 0 0 2px rgba(20,20,40,0.04), 0 18px 50px rgba(53,60,80,0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; scroll-behavior: smooth; }
body {
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(39,245,255,0.1), transparent 26%),
    radial-gradient(circle at 85% 15%, rgba(255,79,216,0.16), transparent 22%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
  padding: 0 0 6rem;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.65), rgba(0,0,0,0.2));
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 56px;
  position: relative;
  z-index: 1;
}
.hero { position:relative; text-align:center; padding:34px 18px 18px; }
.hero-glow {
  position:absolute;
  inset:-10px auto auto 50%;
  width:360px;
  height:220px;
  transform:translateX(-50%);
  background: radial-gradient(circle, rgba(255,79,216,0.22), rgba(39,245,255,0.08), transparent 70%);
  filter: blur(14px);
  pointer-events:none;
}
.hero-home-link,
.hero-home-link:link,
.hero-home-link:visited,
.hero-home-link:hover,
.hero-home-link:active {
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  text-decoration:none;
  color:inherit;
}
.logo {
  margin:0;
  font-family:"Press Start 2P", cursive;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height:1.2;
  color:var(--text);
  text-shadow: 0 0 10px rgba(39,245,255,0.45), 0 0 28px rgba(255,79,216,0.3);
}
.logo span {
  color: rgba(53, 112, 125, 0.62);
  opacity:0.82;
  text-shadow: 0 0 8px rgba(39,245,255,0.18), 0 0 18px rgba(255,79,216,0.08);
}
.logo-sub {
  display:inline-block;
  font-family:"Press Start 2P", cursive;
  font-size:1.03rem;
  line-height:1.45;
  color:var(--text);
  text-shadow:0 0 14px rgba(39,245,255,0.4);
  margin-top: 10px;
}
.theme-toggle{
  position:fixed;
  top:16px;
  right:16px;
  z-index:1100;
  width:44px;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  border:0.5px solid var(--border2);
  background:var(--surface);
  color:var(--text);
  box-shadow:var(--shadow);
  transition:transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.theme-toggle:hover{ transform:translateY(-1px); background:var(--surface2); border-color:var(--cyan); }
.theme-toggle:active{ transform:scale(.96); }
.theme-toggle-icon{ font-size:20px; line-height:1; }

.main-content { display: grid; gap: 22px; }
.hero-card,
.result-card,
.error-box {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26, 21, 52, 0.92), rgba(10, 8, 24, 0.95));
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.hero-card {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 26px;
  align-items: center;
  padding: clamp(22px, 4vw, 42px);
}
.eyebrow,
.input-panel label,
.card-header h2,
.primary-btn,
.copy-btn {
  font-family:"Press Start 2P", cursive;
}
.eyebrow {
  width: fit-content;
  margin: 0 0 14px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(39,245,255,0.32);
  background: rgba(39,245,255,0.10);
  color: var(--cyan);
  font-size: 8px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: .98;
  letter-spacing: -0.06em;
  text-shadow: 0 0 22px rgba(255,79,216,0.22);
}
.hero-description {
  max-width: 52ch;
  margin: 16px 0 0;
  color: var(--text2);
  font-size: 1rem;
  line-height: 1.65;
}
.input-panel {
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 20px;
  background: rgba(8, 7, 22, 0.42);
}
.input-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
#numberInput {
  width: 100%;
  min-width: 0;
  font-family: 'DM Mono', monospace;
  font-size: 1.08rem;
  padding: 1rem 1rem;
  background: rgba(8, 7, 22, 0.86);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#numberInput:focus {
  border-color: rgba(39,245,255,0.48);
  box-shadow: 0 0 0 3px rgba(39,245,255,0.12);
}
#numberInput.input-warning {
  border-color: rgba(255,221,102,0.95);
  box-shadow: 0 0 0 3px rgba(255,221,102,0.18), 0 0 22px rgba(255,221,102,0.14);
}
.primary-btn {
  min-height: 56px;
  padding: 1.05rem 1.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,79,216,0.98), rgba(194,37,158,0.94));
  color:#fff;
  box-shadow: 0 8px 24px rgba(255,79,216,0.22);
  text-transform: uppercase;
  font-size: .72rem;
  transition: transform .12s, box-shadow .15s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(255,79,216,0.3); }

.input-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.input-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0;
  cursor: pointer;
  user-select: none;
}
.input-type-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.input-type-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(39,245,255,0.24);
  background: rgba(39,245,255,0.07);
  color: var(--text2);
  font-family: "Press Start 2P", cursive;
  font-size: 7px;
  line-height: 1.35;
  letter-spacing: .04em;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.input-type-pill span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: .72;
}
.input-type-pill:hover span {
  transform: translateY(-1px);
  border-color: rgba(39,245,255,0.48);
  background: rgba(39,245,255,0.12);
}
.input-type-pill input:checked + span {
  border-color: rgba(255,79,216,0.72);
  background: rgba(255,79,216,0.16);
  color: var(--text);
  box-shadow: 0 0 18px rgba(255,79,216,0.16);
}
.input-type-pill input:checked + span::before {
  background: var(--green-neon);
  border-color: var(--green-neon);
  box-shadow: 0 0 10px rgba(105,255,139,0.55);
}
:root[data-theme="light"] .input-type-pill span {
  background: rgba(39,245,255,0.08);
  color: var(--text2);
}
:root[data-theme="light"] .input-type-pill input:checked + span {
  color: var(--text);
  background: rgba(255,79,216,0.12);
}

.input-hint {
  margin: 12px 0 0;
  color: var(--text3);
  font-size: .84rem;
  line-height: 1.5;
}
.error-box {
  padding: 15px 18px;
  color: #ffced6;
  border-color: rgba(255,139,156,0.44);
  background: rgba(255,139,156,0.10);
}
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.result-card {
  padding: 1.3rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .24s ease, transform .24s ease, box-shadow .15s ease, border-color .15s ease;
}
.result-card.show {
  opacity: 1;
  transform: translateY(0);
}
.result-card.full-width { grid-column: 1 / -1; }
.words-card {
  border-color: rgba(105,255,139,0.52);
  box-shadow: 0 0 0 2px rgba(105,255,139,0.11), 0 0 30px rgba(105,255,139,0.20), 0 18px 50px rgba(0,0,0,0.45);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 15px;
}
.card-header h2 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.copy-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(39,245,255,0.38);
  background: rgba(39,245,255,0.10);
  color: #b9fbff;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 8px;
  line-height: 1.4;
  box-shadow: 0 0 14px rgba(39,245,255,0.16);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.copy-btn:hover,
.copy-btn.copied {
  background: rgba(39,245,255,0.18);
  border-color: rgba(39,245,255,0.62);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(39,245,255,0.28);
}
.word-output {
  margin: 0;
  color: #effff2;
  font-size: clamp(1.18rem, 2.7vw, 2rem);
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.info-list {
  display: grid;
  gap: 10px;
}
.info-list div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.045);
}
.info-list span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
.info-list strong,
.large-output,
.factor-output,
.known-output {
  margin: 0;
  font-family: 'DM Mono', monospace;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.55;
}
.info-list strong { font-size: .94rem; }
.badge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.fact-badge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.055);
  color: var(--text2);
  font-family: 'DM Mono', monospace;
  font-size: .86rem;
  line-height: 1.25;
  width: 100%;
}
.fact-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}
.fact-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.12);
  font-weight: 900;
  text-align: center;
}
.fact-badge.yes {
  border-color: rgba(105,255,139,0.52);
  background: rgba(105,255,139,0.14);
  color: var(--green-neon);
  box-shadow: 0 0 18px rgba(105,255,139,0.16);
}
.fact-badge.no {
  border-color: rgba(218,229,245,0.28);
  background: rgba(218,229,245,0.075);
  color: var(--text2);
}
.fact-badge.neutral {
  border-color: rgba(39,245,255,0.26);
  background: rgba(39,245,255,0.09);
  color: var(--cyan);
}
.fact-badge.no .fact-value {
  color: var(--text3);
}
.fact-badge.neutral .fact-value {
  color: var(--cyan);
}
.fact-badge.yes .fact-value {
  color: var(--green-neon);
}

.info-list div.property-highlight {
  border-color: rgba(105,255,139,0.52);
  background: rgba(105,255,139,0.10);
  box-shadow: 0 0 18px rgba(105,255,139,0.16);
}

.prime-highlight {
  color: var(--green-neon) !important;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(105,255,139,0.35);
}
.large-output {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: .03em;
}
.small-note {
  margin: 12px 0 0;
  color: var(--text3);
  font-size: .82rem;
  line-height: 1.55;
}
.factor-output,
.known-output {
  font-size: .98rem;
}

.factor-warning-line {
  display: inline-block;
  margin-top: 8px;
  color: #facc15;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
}


.factor-resume-line {
  display: inline-block;
  margin-top: 4px;
  color: var(--text2);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.factor-found-label {
  display: inline-block;
  margin-top: 8px;
  color: var(--text2);
  font-weight: 800;
}

.factor-found-values {
  display: block;
  margin-top: 4px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.factorization-output {
  font-size: .98rem;
  overflow-wrap: anywhere;
  line-height: 1.75;
}

.factor-prime {
  color: var(--green-neon);
  font-weight: 900;
  text-shadow: 0 0 8px rgba(105,255,139,0.35);
}

.factor-prime:hover {
  text-shadow: 0 0 12px rgba(105,255,139,0.72);
}

.tooltip-inline {
  position: relative;
  cursor: help;
  display: inline-block;
}

.tooltip-inline::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(4px);
  min-width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(105,255,139,0.38);
  background: rgba(10, 8, 24, 0.97);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(0,0,0,0.34), 0 0 18px rgba(105,255,139,0.14);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  z-index: 30;
  white-space: nowrap;
}

.tooltip-inline:hover::after,
.tooltip-inline:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}


/* Keep factor prime tooltips above the factor cards instead of clipped inside the panel */
.factors-card,
.factorization-card {
  overflow: visible;
  position: relative;
}

.factors-card:hover,
.factorization-card:hover {
  z-index: 50;
}

.factor-output,
.factorization-output,
.factor-found-values {
  overflow: visible;
}

.factor-output .tooltip-inline::after,
.factorization-output .tooltip-inline::after,
.factor-found-values .tooltip-inline::after {
  z-index: 9999;
}

.factor-output .tooltip-inline:first-child::after,
.factorization-output .tooltip-inline:first-child::after,
.factor-found-values .tooltip-inline:first-child::after {
  left: 0;
  transform: translateX(0) translateY(4px);
}

.factor-output .tooltip-inline:first-child:hover::after,
.factorization-output .tooltip-inline:first-child:hover::after,
.factor-found-values .tooltip-inline:first-child:hover::after,
.factor-output .tooltip-inline:first-child:focus-visible::after,
.factorization-output .tooltip-inline:first-child:focus-visible::after,
.factor-found-values .tooltip-inline:first-child:focus-visible::after {
  transform: translateX(0) translateY(0);
}

:root[data-theme="light"] .tooltip-inline::after {
  background: rgba(255,255,255,0.98);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(53,60,80,0.18), 0 0 18px rgba(105,255,139,0.12);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at top, rgba(39,245,255,0.18), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(255,79,216,0.16), transparent 24%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
}
:root[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(20,20,40,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,20,40,0.045) 1px, transparent 1px);
}
:root[data-theme="light"] .hero-card,
:root[data-theme="light"] .result-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(245,245,255,0.96));
}
:root[data-theme="light"] .input-panel {
  background: rgba(255,255,255,0.45);
  border-color: rgba(20,20,40,0.10);
}
:root[data-theme="light"] #numberInput {
  background: rgba(255,255,255,0.9);
  color: var(--text);
  border-color: rgba(20,20,40,0.16);
}
:root[data-theme="light"] .theme-toggle { background: rgba(255,255,255,0.72); color: #352f48; border-color: rgba(20,20,40,0.16); }
:root[data-theme="light"] .word-output { color: #073d1a; }
:root[data-theme="light"] .info-list div,
:root[data-theme="light"] .fact-badge {
  background: rgba(20,20,40,0.035);
  border-color: rgba(20,20,40,0.11);
}
:root[data-theme="light"] .copy-btn { color: #095e73; }
:root[data-theme="light"] .fact-badge.no { color: #352f48; }


.warning-action-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(250, 204, 21, 0.58);
  background: rgba(250, 204, 21, 0.14);
  color: #facc15;
  border-radius: 999px;
  padding: 7px 11px;
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  line-height: 1.4;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.16);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s, opacity .15s;
}
.warning-action-btn:hover {
  background: rgba(250, 204, 21, 0.22);
  border-color: rgba(250, 204, 21, 0.82);
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(250, 204, 21, 0.28);
}
.warning-action-btn:disabled {
  cursor: wait;
  opacity: .72;
  transform: none;
}
:root[data-theme="light"] .warning-action-btn {
  color: #8a5a00;
}

@media (max-width: 860px) {
  .hero-card { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 24px; }
  .hero { padding-top: 18px; }
  .theme-toggle{ top:10px; right:10px; width:40px; height:40px; }
  .hero-card,
  .result-card { border-radius: 20px; }
  .input-row { grid-template-columns: 1fr; }
  .primary-btn { width: 100%; }
  .info-list div { grid-template-columns: 1fr; gap: 4px; }
  .badge-list { grid-template-columns: 1fr; }
  .fact-badge { min-height: 44px; }
  .card-header { align-items: flex-start; }
}


/* Numbers layout refinements */
.hero-card {
  grid-template-columns: minmax(0, 0.72fr) minmax(340px, 1.28fr);
}
.compact-hero-copy {
  align-self: stretch;
  display: flex;
  align-items: center;
}
.main-subtext {
  margin: 0;
  font-size: clamp(1.05rem, 2.1vw, 1.42rem);
  line-height: 1.65;
}
.input-panel {
  padding: clamp(22px, 3vw, 32px);
  border-radius: 24px;
}
.input-panel label {
  font-size: 11px;
  margin-bottom: 14px;
}
.input-row {
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
  gap: 14px;
}
#numberInput {
  min-height: 74px;
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  padding: 1.15rem 1.2rem;
}
.primary-btn {
  min-height: 74px;
  padding: 1.15rem 1.75rem;
  font-size: .86rem;
}
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.secondary-action-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(105,255,139,0.42);
  background: rgba(105,255,139,0.12);
  color: var(--green-neon);
  border-radius: 999px;
  padding: 7px 11px;
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  line-height: 1.4;
  box-shadow: 0 0 14px rgba(105,255,139,0.14);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s, opacity .15s;
}
.secondary-action-btn:hover {
  background: rgba(105,255,139,0.18);
  border-color: rgba(105,255,139,0.62);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(105,255,139,0.24);
}
.secondary-action-btn:disabled {
  cursor: wait;
  opacity: .72;
  transform: none;
}
:root[data-theme="light"] .secondary-action-btn {
  color: #097a2d;
}

.warning-action-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(250, 204, 21, 0.58);
  background: rgba(250, 204, 21, 0.14);
  color: #facc15;
  border-radius: 999px;
  padding: 7px 11px;
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  line-height: 1.4;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.16);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s, opacity .15s;
}
.warning-action-btn:hover {
  background: rgba(250, 204, 21, 0.22);
  border-color: rgba(250, 204, 21, 0.82);
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(250, 204, 21, 0.28);
}
.warning-action-btn:disabled {
  cursor: wait;
  opacity: .72;
  transform: none;
}
:root[data-theme="light"] .warning-action-btn {
  color: #8a5a00;
}

@media (max-width: 860px) {
  .hero-card { grid-template-columns: 1fr; }
  .compact-hero-copy { display: block; }
}
@media (max-width: 720px) {
  .input-row { grid-template-columns: 1fr; }
  #numberInput, .primary-btn { min-height: 66px; }
  .card-actions { justify-content: flex-start; }
}

/* Special check hover explanations */
.special-card {
  overflow: visible;
}
.fact-badge {
  position: relative;
  cursor: help;
}
.fact-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: min(280px, 78vw);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(39,245,255,0.34);
  background: rgba(10, 8, 24, 0.97);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 12px 34px rgba(0,0,0,0.36), 0 0 18px rgba(39,245,255,0.14);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  z-index: 20;
  white-space: normal;
}
.fact-badge::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top: 0;
  border-bottom-color: rgba(39,245,255,0.34);
  opacity: 0;
  visibility: hidden;
  transition: opacity .14s ease, visibility .14s ease;
  z-index: 21;
}
.fact-badge:hover::after,
.fact-badge:focus-visible::after,
.fact-badge:hover::before,
.fact-badge:focus-visible::before {
  opacity: 1;
  visibility: visible;
}
.fact-badge:hover::after,
.fact-badge:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}

/* Numerals panel */
.numeral-grid {
  display: grid;
  gap: 12px;
}
.numeral-subpanel {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 13px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.045);
}
.numeral-subpanel span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}
.numeral-subpanel strong {
  font-family: 'DM Mono', monospace;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.5;
}
:root[data-theme="light"] .fact-badge::after {
  background: rgba(255,255,255,0.98);
  color: var(--text);
  box-shadow: 0 12px 34px rgba(53,60,80,0.18), 0 0 18px rgba(39,245,255,0.12);
}
:root[data-theme="light"] .numeral-subpanel {
  background: rgba(20,20,40,0.035);
  border-color: rgba(20,20,40,0.11);
}
@media (max-width: 720px) {
  .fact-badge::after {
    left: 0;
    transform: translateX(0) translateY(4px);
  }
  .fact-badge:hover::after,
  .fact-badge:focus-visible::after {
    transform: translateX(0) translateY(0);
  }
  .fact-badge::before { left: 22px; }
  .numeral-subpanel { grid-template-columns: 1fr; gap: 5px; }
}

/* Large number word output support */
.words-card {
  overflow: visible;
}

.word-output {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

.word-output.word-output-long {
  font-size: clamp(0.96rem, 2vw, 1.35rem);
}

.word-output.word-output-very-long {
  font-size: clamp(0.78rem, 1.45vw, 1.05rem);
  max-height: 460px;
}

.word-output::-webkit-scrollbar {
  width: 8px;
}

.word-output::-webkit-scrollbar-thumb {
  background: rgba(105,255,139,0.34);
  border-radius: 999px;
}

.factor-progress-wrap {
  margin-top: 12px;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.055);
  opacity: 0.86;
}

.factor-progress-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.12);
}

.factor-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(250, 204, 21, 0.58);
  box-shadow: none;
  transition: width 0.22s ease;
}

.factor-progress-text {
  margin-top: 5px;
  color: var(--muted-text);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.82;
  overflow-wrap: anywhere;
}


/* SEO support content, intentionally subtle and placed after the main utility UI */
.seo-support {
  max-width: 980px;
  margin: 36px auto 18px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--card-bg-soft);
  color: var(--muted-text);
  font-size: 0.78rem;
  line-height: 1.65;
  opacity: 0.72;
}

.seo-support h1 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.seo-support p {
  margin: 6px 0;
}

.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.seo-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.seo-links a:hover {
  opacity: 0.86;
}

/* Light mode contrast improvements for highlighted results */
:root {
  --highlight-primary: #69ff8b;
  --highlight-primary-glow: rgba(105,255,139,0.35);
  --highlight-warning: #facc15;
  --highlight-warning-glow: rgba(250,204,21,0.35);
  --highlight-danger: #ff8b9c;
}

:root[data-theme="light"] {
  --highlight-primary: #166534;
  --highlight-primary-glow: rgba(22,101,52,0.10);
  --highlight-warning: #92400e;
  --highlight-warning-glow: rgba(146,64,14,0.10);
  --highlight-danger: #991b1b;
}

.prime-highlight,
.factor-prime,
.fact-badge.yes .fact-value {
  color: var(--highlight-primary) !important;
}

.prime-highlight,
.factor-prime {
  text-shadow: 0 0 8px var(--highlight-primary-glow);
}

.factor-warning-line {
  color: var(--highlight-warning) !important;
  text-shadow: 0 0 10px var(--highlight-warning-glow);
}

:root[data-theme="light"] .prime-highlight,
:root[data-theme="light"] .factor-prime,
:root[data-theme="light"] .factor-prime:hover,
:root[data-theme="light"] .factor-warning-line {
  text-shadow: none;
}

:root[data-theme="light"] .fact-badge.yes {
  border-color: rgba(22,101,52,0.42);
  background: rgba(22,101,52,0.10);
  color: var(--highlight-primary);
  box-shadow: none;
}

:root[data-theme="light"] .info-list div.property-highlight {
  border-color: rgba(22,101,52,0.42);
  background: rgba(22,101,52,0.10);
  box-shadow: none;
}

:root[data-theme="light"] .fact-badge.neutral .fact-value,
:root[data-theme="light"] .fact-badge.neutral {
  color: #075985;
}

:root[data-theme="light"] .secondary-action-btn {
  color: #166534;
  border-color: rgba(22,101,52,0.35);
  background: rgba(22,101,52,0.08);
  box-shadow: none;
}

:root[data-theme="light"] .warning-action-btn {
  color: #78350f;
  border-color: rgba(146,64,14,0.38);
  background: rgba(146,64,14,0.10);
  box-shadow: none;
}

/* v24 visual tuning: restore visible glow while preserving light-mode readability */
.fact-badge.yes {
  border-color: rgba(105,255,139,0.62);
  background: rgba(105,255,139,0.14);
  box-shadow: 0 0 0 1px rgba(105,255,139,0.16), 0 0 18px rgba(105,255,139,0.22);
}

.fact-badge.yes .fact-value {
  color: var(--highlight-primary) !important;
  font-weight: 900;
}

.factor-prime,
.prime-highlight {
  color: #4ade80 !important;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(74,222,128,0.48), 0 0 14px rgba(74,222,128,0.22);
}

.factor-prime:hover,
.prime-highlight:hover {
  color: #86efac !important;
  text-shadow: 0 0 10px rgba(134,239,172,0.70), 0 0 18px rgba(134,239,172,0.35);
}

:root[data-theme="light"] {
  --highlight-primary: #15803d;
  --highlight-primary-glow: rgba(34,197,94,0.28);
}

:root[data-theme="light"] .fact-badge.yes {
  border-color: rgba(21,128,61,0.58);
  background: rgba(34,197,94,0.13);
  color: #14532d;
  box-shadow: 0 0 0 1px rgba(21,128,61,0.12), 0 0 15px rgba(34,197,94,0.24);
}

:root[data-theme="light"] .fact-badge.yes .fact-value {
  color: #14532d !important;
  font-weight: 900;
}

:root[data-theme="light"] .factor-prime,
:root[data-theme="light"] .factor-prime:hover,
:root[data-theme="light"] .prime-highlight,
:root[data-theme="light"] .prime-highlight:hover {
  color: #15803d !important;
  font-weight: 900;
  text-shadow: 0 0 5px rgba(34,197,94,0.34), 0 0 10px rgba(34,197,94,0.18);
}


/* Numbers update feed pulled from DSCRAMBL homepage updates */
.numbers-updates-section {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 20px;
  position: relative;
  z-index: 1;
}

.numbers-updates-inner {
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 30px);
  overflow: hidden;
  position: relative;
}

.numbers-updates-inner::before {
  content: "";
  position: absolute;
  inset: -120px -80px auto auto;
  width: 300px;
  height: 220px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(39,245,255,0.16), rgba(255,79,216,0.08), transparent 70%);
  filter: blur(10px);
}

.numbers-updates-header,
.numbers-updates-grid,
.numbers-updates-link {
  position: relative;
  z-index: 1;
}

.section-kicker {
  display: inline-flex;
  color: var(--cyan);
  font-family: "Press Start 2P", cursive;
  font-size: 0.54rem;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.numbers-updates-header h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-family: "Press Start 2P", cursive;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  line-height: 1.45;
  text-shadow: 0 0 12px rgba(39,245,255,0.18);
}

.numbers-updates-header p {
  margin: 0 0 20px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.65;
}

.numbers-updates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.numbers-update-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: rgba(255,255,255,0.035);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.numbers-update-card[href]:hover,
.numbers-update-card[href]:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(39,245,255,0.56);
  box-shadow: 0 0 18px rgba(39,245,255,0.12);
  outline: none;
}

.numbers-update-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.numbers-update-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.35;
}

.numbers-update-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.55;
}

.numbers-update-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.numbers-update-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(39,245,255,0.22);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(39,245,255,0.08);
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.numbers-updates-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--cyan);
  font-weight: 850;
  text-decoration: none;
}

.numbers-updates-link:hover,
.numbers-updates-link:focus-visible {
  color: var(--pink);
  outline: none;
}

[data-theme="light"] .numbers-update-card {
  background: rgba(15, 23, 42, 0.035);
}

@media (max-width: 720px) {
  .numbers-updates-section {
    width: min(100% - 20px, 1120px);
  }
}
