:root {
  --bg0: #071225;
  --bg1: #0b1e38;

  --card: rgba(255,255,255,.07);
  --card2: rgba(255,255,255,.10);
  --stroke: rgba(255,255,255,.12);

  --text: #eaf1ff;
  --muted: rgba(234,241,255,.72);
  --muted2: rgba(234,241,255,.52);

  --accent: #22e6b6;
  --accent2: #6aa9ff;
  --danger: #ff6b6b;

  --shadow: 0 18px 46px rgba(0,0,0,.34);
  --radius2: 24px;
  --gap: 16px;
  --max: 980px;

  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

html[data-theme="light"] {
  --bg0: #f6f9ff;
  --bg1: #eaf1ff;

  --card: rgba(0,0,0,.04);
  --card2: rgba(0,0,0,.06);
  --stroke: rgba(0,0,0,.10);

  --text: #0b1220;
  --muted: rgba(11,18,32,.72);
  --muted2: rgba(11,18,32,.52);

  --shadow: 0 18px 46px rgba(0,0,0,.14);
  --accent: #08b89b;
  --accent2: #2b6cff;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

html {
  background:
    radial-gradient(1100px 600px at 22% 10%, rgba(34,230,182,.16), transparent 60%),
    radial-gradient(900px 500px at 78% 20%, rgba(106,169,255,.14), transparent 58%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
  padding-bottom: max(110px, env(safe-area-inset-bottom));
  transition: padding-bottom 0.3s ease;
}

body.drawer-open {
  padding-bottom: calc(380px + max(110px, env(safe-area-inset-bottom)));
}

body.site-menu-open {
  overflow: hidden;
}

.bg { position: fixed; inset: 0; pointer-events: none; z-index: -1; }
.bg-grid {
  position: absolute; inset: -60px;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: .22;
}
html[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(to right, rgba(0,0,0,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,.06) 1px, transparent 1px);
  opacity: .16;
}
.bg-float { position: absolute; inset: 0; overflow: hidden; }
.bg-float span {
  position: absolute;
  font-family: var(--mono);
  color: rgba(234,241,255,.12);
  user-select: none;
  font-size: var(--size);
  opacity: 0;
  animation: drift var(--dur) linear infinite;
  animation-delay: var(--delay);
  transform: translate(var(--sx), var(--sy)) rotate(0deg);
}
html[data-theme="light"] .bg-float span { color: rgba(11,18,32,.12); }
@keyframes drift {
  0%   { transform: translate(var(--sx), var(--sy)) rotate(0deg); opacity: 0; }
  12%  { opacity: var(--op); }
  100% { transform: translate(var(--ex), var(--ey)) rotate(var(--rot)); opacity: 0; }
}

.topbar {
  max-width: var(--max);
  margin: 16px auto 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(34,230,182,.22), rgba(106,169,255,.18));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  font-weight: 900;
}
.brand-sub { font-size: 12px; color: var(--muted2); margin-top: 2px; }

.top-actions { display: flex; gap: 10px; align-items: center; }

.action-btn {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  border-radius: 16px;
  cursor: pointer;
  padding: 0 14px;
  height: 46px;
  box-shadow: 0 10px 22px rgba(0,0,0,.15);
  transition: transform .12s ease, background .12s ease;
  font-weight: 900;
}
.action-btn:hover { transform: translateY(-1px); background: var(--card2); }
.ab-ico { color: var(--accent); }
.ab-ico svg { width: 22px; height: 22px; fill: currentColor; opacity: .95; }

.icon-btn {
  width: 46px; height: 46px;
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,.15);
  display: grid; place-items: center;
  transition: transform .12s ease, background .12s ease;
  color: var(--accent2);
}
.icon-btn:hover { transform: translateY(-1px); background: var(--card2); }
.icon-btn.small { width: 40px; height: 40px; border-radius: 14px; font-size: 16px; }
.theme-ico svg { width: 24px; height: 24px; fill: currentColor; opacity: .95; }

.menu-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  opacity: .95;
}

/* Site Menu */
.site-menu-wrap {
  position: fixed;
  inset: 0;
  z-index: 12000;
  pointer-events: none;
}

.site-menu-wrap.open {
  pointer-events: auto;
}

.site-menu-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  background: rgba(4, 10, 20, .48);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .18s ease;
}

.site-menu-wrap.open .site-menu-backdrop {
  opacity: 1;
}

.site-menu-panel {
  position: absolute;
  top: 76px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  border-radius: 22px;
  border: 1px solid var(--stroke);
  background: rgba(10, 18, 35, .94);
  box-shadow: 0 24px 56px rgba(0,0,0,.34);
  padding: 14px;
  opacity: 0;
  transform: translateY(-8px) scale(.98);
  transform-origin: top right;
  transition: opacity .18s ease, transform .18s ease;
}

html[data-theme="light"] .site-menu-panel {
  background: rgba(255,255,255,.96);
}

.site-menu-wrap.open .site-menu-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.site-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.site-menu-kicker {
  font-size: 12px;
  color: var(--muted2);
  margin-bottom: 4px;
  font-weight: 700;
}

.site-menu-title {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
}

.site-menu-links {
  display: grid;
  gap: 10px;
}

.site-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.site-menu-link:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.07);
  border-color: rgba(34,230,182,.34);
}

html[data-theme="light"] .site-menu-link {
  background: rgba(0,0,0,.03);
}

html[data-theme="light"] .site-menu-link:hover {
  background: rgba(0,0,0,.05);
  border-color: rgba(8,184,155,.28);
}

.site-menu-link-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: #071225;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  box-shadow: 0 10px 20px rgba(34,230,182,.18);
}

.site-menu-link-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-menu-link-title {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.site-menu-link-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.site-menu-link-arrow {
  margin-left: auto;
  font-size: 20px;
  color: var(--accent);
  flex: 0 0 auto;
}

.wrap {
  max-width: var(--max);
  margin: 14px auto 40px;
  padding: 0 16px;
}
.main-col { display: flex; flex-direction: column; gap: var(--gap); }

.panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 14px;
}
.output-panel { padding: 0; }

.tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}
.tabs { display: flex; gap: 8px; }
.tab {
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 900;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  font-size: 14px;
}
.tab:hover { transform: translateY(-1px); }
.tab.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(34,230,182,.22), rgba(106,169,255,.18));
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(34,230,182,.14), 0 10px 24px rgba(0,0,0,.18);
}

.input-actions { display: flex; gap: 6px; }
.ibtn {
  width: 36px; height: 36px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
  flex: 0 0 auto;
}
.ibtn svg { width: 18px; height: 18px; fill: currentColor; opacity: .98; }
.ibtn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.ibtn:active { transform: translateY(0px) scale(.98); }
.ibtn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.ibtn.upload { background: linear-gradient(135deg, rgba(106,169,255,.25), rgba(34,230,182,.18)); color: var(--accent2); }
.ibtn.clear { background: linear-gradient(135deg, rgba(255,107,107,.22), rgba(255,255,255,.06)); color: var(--danger); }
.ibtn.kbd   { background: linear-gradient(135deg, rgba(34,230,182,.22), rgba(106,169,255,.18)); color: var(--accent); }

.input-bar {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
}
.mq-input, .txt-input {
  width: 100%;
  min-height: 86px;
  padding: 16px 18px;
  border-radius: 16px;
  position: relative;
  cursor: text;
  box-sizing: border-box;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
html[data-theme="light"] .mq-input,
html[data-theme="light"] .txt-input {
  background: rgba(0, 0, 0, 0.02);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}
.mq-input.mq-focused, .txt-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}
html[data-theme="light"] .mq-input.mq-focused,
html[data-theme="light"] .txt-input:focus {
  background: #ffffff;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.02), 0 0 0 3px rgba(8, 184, 155, 0.15);
}
.txt-input { font-size: 16px; }
.mq-input:not(.has-content)::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 18px; top: 18px;
  color: var(--muted2);
  pointer-events: none;
  font-size: 16px;
}
.mq-input .mq-root-block { font-size: 24px; line-height: 1.3; }

.upload-strip {
  margin-top: 12px;
  padding: 12px 12px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(255,255,255,.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.upload-left { display: flex; align-items: center; gap: 10px; }
.upload-title { font-weight: 900; }
.upload-sub { font-size: 12px; color: var(--muted2); margin-top: 2px; }
.spinner {
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}
.chip:disabled { opacity: .5; cursor: not-allowed; }

.primary-row { margin-top: 16px; }
.primary {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff, #22e6b6);
  background-size: 200% auto;
  color: #071225;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-radius: 20px;
  padding: 16px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(34, 230, 182, 0.25), 0 18px 34px rgba(0,0,0,.25);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.primary:hover {
  background-position: right center;
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 15px 30px rgba(106, 169, 255, 0.35), 0 22px 40px rgba(0,0,0,.3);
}

.primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 5px 15px rgba(34, 230, 182, 0.2);
}

.primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.preview { padding-top: 12px; }
.preview-title { font-size: 12px; color: var(--muted2); margin-bottom: 8px; }
.preview-box {
  border: 1px dashed var(--stroke);
  border-radius: 18px;
  padding: 12px 12px;
  background: rgba(255,255,255,.02);
  min-height: 56px;
  white-space: pre-wrap;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--stroke);
}
.mini-actions { display: flex; gap: 8px; }
.response { padding: 16px; min-height: 240px; }
.answer-box {
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius: 20px;
  padding: 14px 14px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.empty {
  padding: 30px 16px;
  border: 1px dashed var(--stroke);
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon { font-size: 42px; margin-bottom: 10px; }

.bottom-tools,
.bottom-help,
.bottom-faq,
.footerbar {
  position: relative;
  z-index: 2;
}

.footerbar {
  max-width: var(--max);
  margin: 32px auto 20px auto;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(7,18,37,.78);
  backdrop-filter: blur(10px);
}
html[data-theme="light"] .footerbar {
  background: rgba(246,249,255,.86);
}
.fb-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted2);
}
.fb-inner a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.fb-inner a:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
html[data-theme="light"] .fb-inner a {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}
html[data-theme="light"] .fb-inner a:hover {
  background: rgba(0,0,0,0.08);
  border-color: var(--accent);
  color: var(--accent);
}
.fb-dot { opacity: .6; }

.drawer { display: none; }
.drawer.show { display: block; position: relative; z-index: 9999; }
.drawer-card {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  background: rgba(10,18,35,.96);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -18px 36px rgba(0,0,0,.28);
  overflow: hidden;
}
html[data-theme="light"] .drawer-card {
  background: rgba(255,255,255,.96);
  border-color: rgba(0,0,0,.10);
}
.drawer-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
  gap: 10px;
}
.drawer-title { font-weight: 900; }

.dots { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.dot {
  width: 8px; height: 8px; border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.08);
  cursor: pointer;
  opacity: .9;
}
.dot.active {
  background: linear-gradient(135deg, rgba(34,230,182,.9), rgba(106,169,255,.9));
  border-color: transparent;
  width: 18px;
}

.kp-carousel {
  padding: 12px 0;
  overflow: hidden;
}
.kp-track {
  display: flex;
  width: 100%;
  max-width: 100%;
  transition: transform .22s ease;
  will-change: transform;
}
.kp-page {
  flex: 0 0 100%;
  width: 100%;
  padding: 0 12px;
  box-sizing: border-box;
  overflow: hidden;
}
.kp-slab { display: block; }

.kp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.kbtn {
  border: none;
  background: rgba(255,255,255,.05);
  color: var(--text);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  font-weight: 900;
  text-align: center;
  user-select: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
}
html[data-theme="light"] .kbtn { background: rgba(0,0,0,.04); }
.kbtn.small {
  font-size: 15px;
}
.kbtn.mixed {
  font-size: 13px;
  letter-spacing: .15px;
  white-space: nowrap;
}
.kbtn.small.mixed {
  font-size: 13px;
}
.kbtn.var { font-size: 22px; }
.kbtn.sym { font-size: 20px; }
.kbtn.blank { visibility: hidden; pointer-events: none; }
.kbtn sub { font-size: 12px; vertical-align: sub; margin-left: 2px; }

.kbtn.kback, .kbtn.kplay, .kbtn.kenter {
  width: 100%;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kbtn.kback { background: rgba(255,255,255,.14); color: rgba(255,255,255,.92); }
html[data-theme="light"] .kbtn.kback { background: #cbd0d9; color: #0b1220; }
.kbtn.kplay { background: #21c37a; color: #071225; }
.kbtn.kback svg, .kbtn.kplay svg { width: 26px; height: 26px; fill: currentColor; }

html[data-theme="light"] .dot { background: rgba(0,0,0,.15); border-color: rgba(0,0,0,.2); }
html[data-theme="light"] .dot.active { background: linear-gradient(135deg, rgba(8,184,155,.9), rgba(43,108,255,.9)); border-color: transparent; }

.toast {
  position: fixed;
  z-index: 10000;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,.75);
  color: white;
  font-weight: 900;
  font-size: 13px;
  transform: translate(-50%, -120%);
  pointer-events: none;
}

@media (max-width: 520px) {
  .brand-sub { display: none; }
  .action-btn .ab-txt { display: none; }
}

.answer-box h1, .answer-box h2, .answer-box h3, .answer-box h4 {
  margin: 24px 0 12px 0;
  color: var(--accent);
  line-height: 1.3;
}
.answer-box h1:first-child, .answer-box h2:first-child, .answer-box h3:first-child, .answer-box h4:first-child {
  margin-top: 0;
}
.answer-box strong {
  color: var(--text);
  font-weight: 900;
}
html[data-theme="dark"] .answer-box strong { color: #ffffff; }

.ocr-tip {
  background: linear-gradient(135deg, rgba(34,230,182,.15), rgba(106,169,255,.15));
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(34,230,182,.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kbtn.kenter { background: #6aa9ff; color: #071225; }
html[data-theme="light"] .kbtn.kenter { background: #2b6cff; color: #ffffff; }
.kbtn.kenter svg { width: 26px; height: 26px; fill: currentColor; }

.bottom-help {
  max-width: var(--max);
  margin: 14px auto 14px;
  padding: 0 16px;
  display: flex;
}

.help-panel {
  width: 100%;
  padding: 16px 24px;
}

.help-title{
  margin: 0 0 8px 0;
  font-size: 18px;
  letter-spacing: .2px;
}

.help-lead{
  margin: 0 0 14px 0;
  color: var(--muted);
  line-height: 1.55;
}

.help-grid{
  display: grid;
  gap: 12px;
}

.help-box{
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius: 18px;
  padding: 12px 12px;
}

html[data-theme="light"] .help-box{
  background: rgba(0,0,0,.03);
}

.help-box h3{
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--accent);
}

.help-box ul, .help-box ol{
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.help-box li{
  margin: 6px 0;
  color: var(--muted);
}

.help-box strong{
  color: var(--text);
}

.help-note{
  margin: 10px 0 0 0;
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.55;
}

@media (max-width: 720px){
  .bottom-help{ justify-content: center; }
  .help-panel{ max-width: 100%; }
}

@media (prefers-reduced-motion: reduce){
  .bg-float span { animation: none !important; opacity: .12 !important; }
  .action-btn:hover, .icon-btn:hover, .tab:hover, .ibtn:hover, .primary:hover, .site-menu-link:hover { transform: none !important; }
}

.bottom-faq {
  max-width: var(--max);
  margin: 0 auto 14px;
  padding: 0 16px;
  display: flex;
}

.faq-panel {
  width: 100%;
  padding: 16px 24px;
}

.faq-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  letter-spacing: .2px;
}

.faq-lead {
  margin: 0 0 14px 0;
  color: var(--muted);
  line-height: 1.55;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius: 18px;
  overflow: hidden;
}

html[data-theme="light"] .faq-item {
  background: rgba(0,0,0,.03);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
  color: var(--text);
  position: relative;
  padding-right: 48px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--accent);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--stroke);
}

html[data-theme="light"] .faq-item summary::after {
  background: rgba(0,0,0,.04);
}

.faq-item[open] summary::after {
  content: "–";
}

.faq-answer {
  padding: 0 16px 16px 16px;
  color: var(--muted);
  line-height: 1.65;
  border-top: 1px solid var(--stroke);
}

@media (max-width: 720px){
  .bottom-faq { justify-content: center; }
  .faq-panel { max-width: 100%; }
}

.brand-title,
.action-btn,
.tab,
.primary,
.chip,
.panel-head h2,
.help-title,
.help-box h3,
.faq-title,
.faq-item summary,
.footerbar,
.empty-title,
.site-menu-title,
.tools-title,
.tools-featured-title {
  font-family: var(--ui-font);
}

mjx-box{
  padding:0.2em 0.2em 0.5em 0.2em!important;
}

body.app-loading .input-bar {
  position: relative;
}

body.app-loading #mathInput,
body.app-loading #textInput,
body.app-loading .input-actions,
body.app-loading #btnSolve {
  pointer-events: none;
  opacity: 0.45;
}

.input-boot {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border-radius: inherit;
  background: rgba(7, 18, 37, 0.94);
  text-align: center;
  pointer-events: all;
}

[data-theme="light"] .input-boot {
  background: rgba(246, 249, 255, 0.96);
}

.input-boot-title {
  font-size: 16px;
  font-weight: 700;
}

.input-boot-sub {
  font-size: 14px;
  opacity: 0.8;
}

.blink-dots span {
  display: inline-block;
  animation: ms-blink 1.2s infinite;
}

.blink-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.blink-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ms-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.fc-shell {
  position: relative;
}

.fc-head {
  margin-bottom: 16px;
}

.fc-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
}

.fc-sub {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.fc-modebar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.fc-modebar .chip.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(34,230,182,.22), rgba(106,169,255,.18));
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(34,230,182,.14), 0 10px 24px rgba(0,0,0,.18);
}

.fc-panels {
  display: grid;
  gap: 14px;
}

.fc-panel {
  display: none;
}

.fc-panel.active {
  display: block;
}

.fc-grid {
  display: grid;
  gap: 14px;
}

.fc-grid-3 {
  grid-template-columns: minmax(0, 1fr) 220px minmax(0, 1fr);
}

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

.fc-card {
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius: 20px;
  padding: 14px;
  min-height: 100%;
}

html[data-theme="light"] .fc-card {
  background: rgba(0,0,0,.03);
}

.fc-card-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.fc-card-title {
  margin: 0 0 12px 0;
  font-family: var(--ui-font);
  font-weight: 900;
  font-size: 16px;
}

.fc-label {
  display: block;
  margin: 0 0 8px 0;
  color: var(--muted2);
  font-size: 13px;
  font-weight: 800;
}

.fc-mini-label {
  display: block;
  margin: 0 0 8px 0;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.fc-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.55;
}

.fc-frac-box {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: center;
}

.fc-whole-wrap {
  align-self: stretch;
}

.fc-frac-stack {
  display: grid;
  grid-template-rows: 1fr 3px 1fr;
  gap: 8px;
  align-items: center;
}

.fc-frac-line {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(34,230,182,.95), rgba(106,169,255,.95));
  box-shadow: 0 3px 14px rgba(34,230,182,.18);
}

.fc-num,
.fc-select,
.fc-decimal-input {
  width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 800;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.fc-num {
  text-align: center;
}

.fc-num:focus,
.fc-select:focus,
.fc-decimal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,230,182,.14);
  background: rgba(255,255,255,.06);
}

html[data-theme="light"] .fc-num,
html[data-theme="light"] .fc-select,
html[data-theme="light"] .fc-decimal-input {
  background: rgba(0,0,0,.03);
}

html[data-theme="light"] .fc-num:focus,
html[data-theme="light"] .fc-select:focus,
html[data-theme="light"] .fc-decimal-input:focus {
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(8,184,155,.14);
}

.fc-select {
  cursor: pointer;
}

.fc-operator-mark {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  color: var(--accent);
  padding: 8px 0;
}

.fc-actions-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fc-hidden {
  display: none !important;
}

.fc-typesetting {
  min-height: 120px;
}

#fcPreview mjx-container {
  margin: 0 !important;
}

body.app-loading .fc-shell input,
body.app-loading .fc-shell select,
body.app-loading #btnFractionSolve,
body.app-loading #btnFractionClear,
body.app-loading #btnFractionReset,
body.app-loading #btnFractionCopy,
body.app-loading .fc-modebar .chip {
  pointer-events: none;
  opacity: 0.45;
}

.fc-frac-box.fc-no-whole {
  grid-template-columns: 1fr !important;
}

@media (max-width: 920px) {
  .fc-grid-3,
  .fc-grid-2 {
    grid-template-columns: 1fr;
  }

  .fc-grid-3 > .fc-card:nth-child(1) { order: 1; }
  .fc-grid-3 > .fc-card:nth-child(2) { order: 2; }
  .fc-grid-3 > .fc-card:nth-child(3) { order: 3; }

  .fc-card-center {
    text-align: left;
    align-items: stretch;
    justify-content: center;
  }

  .fc-card-center .fc-select {
    width: 100%;
  }

  .fc-operator-mark {
    font-size: 34px;
    padding: 4px 0 8px;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .fc-modebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .fc-modebar .chip {
    width: 100%;
    min-height: 52px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .fc-card {
    padding: 16px 14px;
    border-radius: 18px;
  }

  .fc-frac-box {
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .fc-frac-box.fc-no-whole {
    grid-template-columns: 1fr !important;
  }

  .fc-whole-wrap {
    align-self: center;
    min-width: 0;
  }

  .fc-whole-wrap .fc-mini-label {
    margin-bottom: 6px;
    text-align: center;
  }

  .fc-frac-stack {
    min-width: 0;
    gap: 6px;
  }

  .fc-whole-wrap .fc-num,
  .fc-frac-stack .fc-num,
  .fc-select,
  .fc-decimal-input {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 16px;
  }

  .fc-frac-line {
    height: 3px;
    margin: 0 2px;
  }

  .fc-card-title {
    font-size: 15px;
    line-height: 1.25;
  }

  .fc-label,
  .fc-mini-label {
    font-size: 12px;
  }

  .fc-note {
    font-size: 14px;
    line-height: 1.6;
  }

  .fc-title {
    font-size: 28px;
  }

  .fc-sub {
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .fc-frac-box {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
  }

  .fc-frac-box.fc-no-whole {
    grid-template-columns: 1fr !important;
  }

  .fc-whole-wrap .fc-num,
  .fc-frac-stack .fc-num,
  .fc-select,
  .fc-decimal-input {
    min-height: 44px;
    padding: 9px 10px;
  }

  .fc-whole-wrap .fc-mini-label,
  .fc-label,
  .fc-mini-label {
    font-size: 11px;
  }

  .fc-card {
    padding: 14px 12px;
  }
}

/* More Tools */
.bottom-tools {
  max-width: var(--max);
  margin: 0 auto 14px;
  padding: 0 16px;
  display: flex;
  scroll-margin-bottom: 140px;
}

.tools-panel {
  width: 100%;
  padding: 18px 24px;
  background: rgba(106, 169, 255, 0.10);
  overflow: visible;
}

html[data-theme="light"] .tools-panel {
  background: rgba(106, 169, 255, 0.12);
}

.tools-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 16px;
  align-items: center;
}

.tools-head-copy {
  min-width: 0;
}

.tools-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  letter-spacing: .2px;
}

.tools-sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.tools-featured-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 16px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(34,230,182,.24);
  background:
    radial-gradient(120px 80px at 10% 20%, rgba(34,230,182,.14), transparent 70%),
    radial-gradient(140px 90px at 90% 20%, rgba(106,169,255,.16), transparent 70%),
    rgba(255,255,255,.04);
  box-shadow: 0 18px 36px rgba(0,0,0,.14);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.tools-featured-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34,230,182,.42);
  box-shadow: 0 22px 42px rgba(0,0,0,.18);
}

html[data-theme="light"] .tools-featured-card {
  background:
    radial-gradient(120px 80px at 10% 20%, rgba(8,184,155,.10), transparent 70%),
    radial-gradient(140px 90px at 90% 20%, rgba(43,108,255,.12), transparent 70%),
    rgba(255,255,255,.72);
}

.tools-featured-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  color: #071225;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  box-shadow: 0 12px 26px rgba(34,230,182,.22);
}

.tools-featured-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tools-featured-eyebrow {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .25px;
  text-transform: uppercase;
}

.tools-featured-title {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.2;
}

.tools-featured-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.tools-featured-arrow {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 24px;
  color: var(--accent);
}

@media (max-width: 840px) {
  .tools-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px){
  .bottom-tools {
    justify-content: center;
  }

  .tools-panel {
    max-width: 100%;
    padding: 16px 18px;
  }
}

@media (max-width: 520px) {
  .site-menu-panel {
    top: 72px;
    right: 12px;
    width: calc(100vw - 24px);
  }

  .tools-featured-card {
    padding: 14px;
    gap: 12px;
  }

  .tools-featured-icon {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    font-size: 24px;
  }

  .tools-featured-title {
    font-size: 16px;
  }

  .tools-featured-arrow {
    font-size: 20px;
  }
}

/* Answer mode */
.answer-mode-bar {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.answer-mode-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.answer-mode-select,
.directory-search {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--sans);
  outline: none;
}

.answer-mode-select:focus,
.directory-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,230,182,.14);
}

html[data-theme="light"] .answer-mode-select,
html[data-theme="light"] .directory-search {
  background: rgba(0,0,0,.03);
}

.action-link-btn {
  text-decoration: none;
  justify-content: center;
}

/* Homepage mini calculator cards */
.tools-head-stack {
  grid-template-columns: 1fr;
}

.tools-mini-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.tools-mini-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

.tools-mini-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34,230,182,.36);
  background: rgba(255,255,255,.06);
}

html[data-theme="light"] .tools-mini-card {
  background: rgba(255,255,255,.72);
}

.tools-mini-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  color: #071225;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  box-shadow: 0 10px 20px rgba(34,230,182,.18);
}

.tools-mini-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tools-mini-title {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.3;
}

.tools-mini-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tools-foot {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.tools-all-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  font-weight: 900;
  transition: transform .14s ease, border-color .14s ease;
}

.tools-all-link:hover {
  transform: translateY(-1px);
  border-color: rgba(34,230,182,.34);
}

/* Generic calculator pages */
.calc-suite-panel {
  padding: 18px;
  overflow: visible;
}

.calc-suite-hero {
  margin-bottom: 18px;
}

.calc-suite-kicker {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--accent);
}

.calc-suite-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
}

.calc-suite-sub {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.calc-builder {
  position: relative;
  display: grid;
  gap: 14px;
}

.calc-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.calc-builder-copy {
  color: var(--muted);
  line-height: 1.6;
}

.calc-mode-wrap {
  display: grid;
  gap: 8px;
}

.calc-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.calc-field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.calc-field-full {
  grid-column: 1 / -1;
}

.calc-textarea,
.calc-text-input {
  width: 100%;
}

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.calc-answer-mode {
  margin-top: 0;
}

/* Calculator device */
.calc-device-shell {
  border: 1px solid var(--stroke);
  border-radius: 28px;
  padding: 14px;
  background:
    radial-gradient(160px 120px at 10% 10%, rgba(34,230,182,.10), transparent 70%),
    radial-gradient(180px 140px at 90% 0%, rgba(106,169,255,.14), transparent 70%),
    rgba(255,255,255,.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 18px 42px rgba(0,0,0,.20);
}

html[data-theme="light"] .calc-device-shell {
  background:
    radial-gradient(160px 120px at 10% 10%, rgba(8,184,155,.08), transparent 70%),
    radial-gradient(180px 140px at 90% 0%, rgba(43,108,255,.10), transparent 70%),
    rgba(255,255,255,.88);
}

.calc-device-shell-basic {
  max-width: 420px;
}

.calc-device-display {
  width: 100%;
  min-height: 76px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(7,18,37,.86);
  color: #ecfff9;
  padding: 16px 18px;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  font-family: var(--mono);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(34,230,182,.08), inset 0 10px 30px rgba(0,0,0,.24);
}

html[data-theme="light"] .calc-device-display {
  background: #eef5ff;
  color: #0b1220;
  border-color: rgba(0,0,0,.08);
  box-shadow: inset 0 0 0 1px rgba(8,184,155,.08), inset 0 8px 18px rgba(255,255,255,.7);
}

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

.calc-device-grid-basic {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-device-btn {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.calc-device-btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.08);
  border-color: rgba(34,230,182,.30);
}

.calc-device-btn-accent {
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  color: #071225;
  border-color: transparent;
}

/* Directory */
.calculator-directory-panel {
  padding: 18px;
}

.calc-directory-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.directory-search-wrap {
  display: grid;
  gap: 8px;
}

.directory-search-results {
  margin-bottom: 18px;
}

.calculator-search-results-head {
  margin-bottom: 12px;
}

.calculator-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}


.calculator-group-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.calculator-group-section:first-of-type {
  margin-top: 0;
}

.calculator-group-head {
  display: grid;
  gap: 4px;
}

.calculator-group-title {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.2;
}

.calculator-group-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.calculator-card-grid-grouped {
  margin-top: 0;
}


.calculator-card-mini {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  color: var(--text);
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

.calculator-card-mini:hover {
  transform: translateY(-2px);
  border-color: rgba(34,230,182,.36);
  background: rgba(255,255,255,.06);
}

html[data-theme="light"] .calculator-card-mini {
  background: rgba(255,255,255,.76);
}

.calculator-card-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 900;
  color: #071225;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
}

.calculator-card-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calculator-card-title {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.3;
}

.calculator-card-cat {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .25px;
  text-transform: uppercase;
  color: var(--accent);
}

.calculator-card-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 1100px) {
  .tools-mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .calculator-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .calc-fields-grid,
  .calc-directory-head {
    grid-template-columns: 1fr;
  }

  .tools-mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .tools-mini-grid,
  .calculator-card-grid {
    grid-template-columns: 1fr;
  }

  .calc-device-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .calc-device-grid-basic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .calc-device-btn {
    min-height: 48px;
    font-size: 15px;
  }

  .calc-device-display {
    min-height: 70px;
    font-size: 24px;
  }

  .calc-suite-panel,
  .calculator-directory-panel {
    padding: 16px;
  }
}

/* 2026-03-29 calculator suite updates */
.brand-link {
  text-decoration: none;
  color: inherit;
}

.brand-link:hover {
  opacity: .98;
}

.tools-mini-icon,
.calculator-card-icon,
.calc-hero-icon {
  overflow: hidden;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  padding: 4px;
}

.icon-tight {
  font-size: 16px !important;
  letter-spacing: -.4px;
}

.icon-ultra-tight {
  font-size: 12px !important;
  letter-spacing: -.5px;
}

.calc-suite-hero-with-icon {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.calc-suite-hero-copy {
  min-width: 0;
}

.calc-hero-icon {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
  color: #071225;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  box-shadow: 0 14px 28px rgba(34,230,182,.18);
}

.inline-answer-wrap {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(34,230,182,.18);
  background: linear-gradient(180deg, rgba(34,230,182,.08), rgba(106,169,255,.07));
}

.inline-answer-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--accent);
}

.inline-answer-box {
  min-height: 58px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(7,18,37,.72);
  padding: 14px 16px;
  color: #ecfff9;
}

html[data-theme="light"] .inline-answer-box {
  background: rgba(255,255,255,.92);
  color: #0b1220;
}

.answer-box-inline {
  margin: 0;
  font-size: 18px;
}

.calc-preview-hidden {
  display: none !important;
}

.calc-device-shell-scientific {
  max-width: 620px;
}

.calc-device-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calc-device-status {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .32px;
  text-transform: uppercase;
  color: var(--accent);
}

.calc-angle-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calc-angle-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.calc-angle-toggle input {
  margin: 0;
}

.calc-device-result {
  margin-top: 10px;
  min-height: 22px;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent2);
  text-align: right;
  word-break: break-word;
}

.calc-device-result.is-error {
  color: #ff8a8a;
}

.calc-device-grid-scientific {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.calc-device-grid-scientific .calc-device-btn {
  min-height: 48px;
  border-radius: 14px;
  font-size: 15px;
  padding: 0 4px;
}

.calc-device-btn {
  overflow: hidden;
  white-space: nowrap;
}

.calc-device-btn-num {
  background: rgba(106,169,255,.14);
}

.calc-device-btn-op,
.calc-device-btn-plain,
.calc-device-btn-const {
  background: rgba(255,255,255,.05);
}

.calc-device-btn-secondary {
  background: rgba(255,255,255,.08);
}

.calc-device-btn-clear {
  background: rgba(106,169,255,.22);
  color: var(--text);
}

.calc-device-btn-accent {
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  color: #071225;
  border-color: transparent;
}

@media (max-width: 860px) {
  .calc-suite-hero-with-icon {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
  }

  .calc-hero-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .calc-suite-hero-with-icon {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .calc-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 20px;
  }

  .calc-device-shell-scientific {
    padding: 12px;
    border-radius: 24px;
  }

  .calc-device-grid-scientific {
    gap: 6px;
  }

  .calc-device-grid-scientific .calc-device-btn {
    min-height: 44px;
    border-radius: 12px;
    font-size: 14px;
  }
}


/* 2026-03-29 v4 answer-first flow */
.inline-answer-wrap[hidden],
.step-trigger-row[hidden] {
  display: none !important;
}

.step-trigger-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.step-trigger-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  margin-top:10px;
  border-radius: 999px;
  border: 1px solid rgba(106,169,255,.32);
  background: linear-gradient(180deg, rgba(106,169,255,.14), rgba(34,230,182,.10));
  color: #eff6ff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .01em;
  box-shadow: 0 12px 24px rgba(5,12,24,.22);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}

.step-trigger-link::before {
  content: "↳";
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #071225;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  box-shadow: 0 8px 16px rgba(34,230,182,.18);
}

.step-trigger-link::after {
  content: "";
}

.step-trigger-link:hover {
  transform: translateY(-1px);
  border-color: rgba(34,230,182,.46);
  background: linear-gradient(180deg, rgba(106,169,255,.18), rgba(34,230,182,.14));
  box-shadow: 0 16px 28px rgba(5,12,24,.28);
}

.step-trigger-link:focus-visible {
  outline: 2px solid rgba(34,230,182,.72);
  outline-offset: 2px;
}

html[data-theme="light"] .step-trigger-link {
  color: #0b1220;
  background: linear-gradient(180deg, rgba(43,108,255,.08), rgba(8,184,155,.10));
  border-color: rgba(43,108,255,.24);
  box-shadow: 0 12px 24px rgba(31,41,55,.08);
}

.inline-answer-box {
  word-break: break-word;
}

.answer-box-inline {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.22;
  font-weight: 900;
}

.output-panel {
  display: block;
  scroll-margin-top: 96px;
}

@media (max-width: 640px) {
  .step-trigger-link {
    width: 100%;
    justify-content: flex-start;
    min-height: 46px;
    padding: 0 14px;
    font-size: 13px;
  }

  .step-trigger-link::before {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }
}

.calc-field-full {
  justify-items: stretch;
}

.calc-device-shell,
.calc-device-shell-basic,
.calc-device-shell-scientific {
  width: 100%;
  margin-inline: auto;
}

.calc-device-shell-basic {
  max-width: 440px;
}

.calc-device-shell-scientific {
  max-width: 640px;
}

.calc-device-grid-scientific .calc-device-btn {
  min-height: 42px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .calc-device-grid-scientific .calc-device-btn {
    min-height: 40px;
    font-size: 12px;
  }
}

.tools-mini-icon,
.calculator-card-icon,
.calc-hero-icon,
.site-menu-link-icon {
  line-height: 1;
  letter-spacing: -.04em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.icon-tight {
  font-size: clamp(12px, 1.9vw, 16px) !important;
}

.icon-ultra-tight {
  font-size: clamp(10px, 1.5vw, 12px) !important;
}


/* no native number spinners anywhere */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}


/* 2026-03-29 v6 final-answer math rendering */
.answer-box-inline.answer-box-math-only {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.answer-box-inline.answer-box-math-only mjx-container[jax="CHTML"][display="true"] {
  margin: 0 !important;
}

.answer-box-inline.answer-box-math-only mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.calc-custom-stage {
  margin: 14px 0 6px;
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: var(--card);
}

.calc-stage-title {
  font-weight: 800;
  text-align: center;
  color: var(--text);
}

.calc-dice-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.calc-die {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(0,0,0,.18);
}

.calc-die-spinning {
  animation: calcDieSpin .7s linear infinite;
}

@keyframes calcDieSpin {
  from { transform: rotate(0deg) scale(.96); }
  50% { transform: rotate(180deg) scale(1.06); }
  to { transform: rotate(360deg) scale(.96); }
}

.calc-love-heart {
  font-size: 56px;
  text-align: center;
  line-height: 1;
  animation: calcHeartBeat .85s ease-in-out infinite;
}

.calc-love-heart-done {
  animation-duration: 1.1s;
}

@keyframes calcHeartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.16); }
  50% { transform: scale(.98); }
  75% { transform: scale(1.12); }
}

.calc-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.calc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  font-weight: 700;
}

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

.calc-inline-grid {
  display: grid;
  gap: 10px;
}

.calc-inline-grid-time {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-repeat-head,
.calc-repeat-row {
  display: grid;
  gap: 10px;
}

.calc-repeat-head {
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
}

.calc-repeat-head-gpa,
.calc-repeat-row-course {
  grid-template-columns: minmax(0, 2fr) minmax(110px, .95fr) minmax(130px, .9fr);
}

.calc-repeat-head-grade,
.calc-repeat-row-grade {
  grid-template-columns: minmax(0, 1.7fr) minmax(120px, .8fr) minmax(120px, .8fr);
}

.calc-repeat-list {
  display: grid;
  gap: 10px;
}

.calc-repeat-input,
.calc-repeat-select {
  width: 100%;
  min-height: 52px;
}

.calc-repeat-input {
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 16px;
  padding: 0 14px;
  font: inherit;
}

html[data-theme="light"] .calc-repeat-input,
html[data-theme="light"] .calc-repeat-select,
html[data-theme="light"] .calc-toggle {
  background: rgba(0,0,0,.03);
}

.chip-link {
  min-height: 44px;
  padding-inline: 16px;
}

.calc-section-box {
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
}

.calc-section-title {
  font-weight: 900;
  margin-bottom: 12px;
}

.calc-fields-grid-tight {
  gap: 12px;
}

@media (max-width: 760px) {
  .calc-inline-grid-time {
    grid-template-columns: 1fr;
  }

  .calc-repeat-head-gpa,
  .calc-repeat-row-course {
    grid-template-columns: minmax(0, 1.35fr) minmax(68px, .72fr) minmax(74px, .72fr);
  }

  .calc-repeat-head-grade,
  .calc-repeat-row-grade {
    grid-template-columns: minmax(0, 1.35fr) minmax(64px, .72fr) minmax(64px, .72fr);
  }

  .calc-repeat-head {
    display: none;
  }

  .calc-repeat-row {
    gap: 6px;
  }

  .calc-repeat-input,
  .calc-repeat-select {
    min-height: 42px;
    font-size: 13px;
  }

  .calc-repeat-input {
    padding: 0 8px;
    border-radius: 12px;
  }

  .calc-die {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }
}


.calc-time-parts-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.calc-time-parts-row:has(.calc-time-part:nth-child(4):last-child) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-time-parts-row:has(.calc-time-part:nth-child(3):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calc-time-part {
  min-width: 0;
}

.calc-time-part-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.calc-time-part-control {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding-inline: 10px;
}

.result-copy-list,
.password-result-list {
  display: grid;
  gap: 8px;
}

.result-copy-item,
.password-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,.04);
}

.result-copy-value,
.password-result-value {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.result-copy-btn,
.password-copy-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(111, 119, 255, .4);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(107,114,255,.95), rgba(139,92,246,.95));
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(80, 92, 255, .18);
}

.result-copy-btn:hover,
.password-copy-btn:hover {
  filter: brightness(1.06);
}


@media (max-width: 760px) {
  .calc-time-parts-row,
  .calc-time-parts-row:has(.calc-time-part:nth-child(4):last-child),
  .calc-time-parts-row:has(.calc-time-part:nth-child(3):last-child) {
    gap: 6px;
  }

  .calc-time-part-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .calc-time-parts-row .calc-time-part-control {
    min-height: 44px;
    padding-inline: 6px;
    font-size: 13px;
  }

  .result-copy-item,
  .password-result-item {
    gap: 8px;
    padding: 7px 8px;
  }

  .result-copy-value,
  .password-result-value {
    font-size: 11px;
  }

  .result-copy-btn,
  .password-copy-btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

}


/* 2026-04 loan calculator compact layout + result polish */
.loan-fields-root {
  display: grid;
  gap: 14px;
}

.loan-form-section {
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: rgba(255,255,255,.03);
}

.loan-section-head {
  margin-bottom: 14px;
}

.loan-section-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
}

.loan-section-intro {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.loan-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.loan-field {
  min-width: 0;
}

.loan-fields-root .fc-label {
  margin-bottom: 6px;
}

.loan-fields-root .fc-note {
  margin-top: 8px;
  font-size: 12px;
}

.loan-fields-root .fc-num,
.loan-fields-root .fc-select {
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 15px;
}

.loan-fields-root .fc-num {
  text-align: left;
}

.loan-input-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.loan-input-row--combo {
  grid-template-columns: minmax(0, 1fr) 88px;
}

.loan-input-row--split {
  grid-template-columns: minmax(0, 1fr) 118px;
}

.loan-control-main,
.loan-control-mode,
.loan-control-side {
  width: 100%;
  min-width: 0;
}

.answer-box-inline .loan-result-shell {
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text);
}

.loan-result-shell {
  display: grid;
  gap: 16px;
}

.loan-summary-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.05fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: start;
}

.loan-result-hero {
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(34,230,182,.08), rgba(106,169,255,.08));
}

.loan-result-kicker {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--accent);
}

.loan-result-amount {
  margin-top: 8px;
  font-size: clamp(28px, 4.5vw, 40px);
  line-height: 1.08;
  font-weight: 900;
  color: var(--text);
  word-break: break-word;
}

.loan-result-actions {
  margin-top: 14px;
}

.loan-pdf-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(111,119,255,.34);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(107,114,255,.95), rgba(139,92,246,.95));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(80,92,255,.18);
}

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

.loan-metric-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
}

.loan-metric-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.loan-metric-value {
  margin-top: 5px;
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.28;
  word-break: break-word;
}

.loan-result-note {
  font-size: 13px;
  color: var(--muted);
}

.loan-schedule-wrap {
  display: grid;
  gap: 12px;
}

.loan-schedule-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px 14px;
}

.loan-schedule-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}

.loan-schedule-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.loan-tab-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  color: #0b5da7;
  font-size: 16px;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.loan-tab-btn.is-active {
  color: var(--text);
  text-decoration: none;
}

.loan-table-shell {
  overflow: auto;
  border: 1px solid #c7ccd3;
  border-radius: 16px;
  background: #ffffff;
}

.loan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: #111827;
}

.loan-table th,
.loan-table td {
  padding: 11px 10px;
  border-top: 1px solid #d7dbe0;
  text-align: right;
  white-space: nowrap;
}

.loan-table thead th {
  border-top: 0;
  background: #3b6ea5;
  color: #ffffff;
  font-weight: 800;
}

.loan-table td.loan-table-cell-left,
.loan-table th.loan-table-cell-left {
  text-align: left;
}

.loan-table tbody tr:nth-child(even) td {
  background: #f5f5f5;
}

.loan-table-break {
  text-align: center !important;
  font-weight: 800;
  background: #ececec !important;
}

@media (max-width: 900px) {
  .loan-summary-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .loan-section-grid,
  .loan-result-grid {
    grid-template-columns: 1fr;
  }

  .loan-form-section {
    padding: 14px;
  }

  .loan-input-row--combo {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .loan-input-row--split {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .loan-fields-root .fc-num,
  .loan-fields-root .fc-select {
    font-size: 14px;
  }

  .loan-result-amount {
    font-size: clamp(26px, 8vw, 34px);
  }

  .loan-table {
    font-size: 13px;
  }

  .loan-table th,
  .loan-table td {
    padding: 10px 9px;
  }
}


/* 2026-04 loan result polish round 2 */
.loan-section-grid {
  grid-template-columns: repeat(2, minmax(0, 360px));
  justify-content: flex-start;
}

.loan-field {
  max-width: 360px;
}

.loan-form-section {
  max-width: 760px;
}

.loan-fields-root {
  justify-items: stretch;
}

.loan-result-shell {
  gap: 14px;
}

.loan-result-hero {
  max-width: 760px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(34,230,182,.06), rgba(106,169,255,.07));
}

.loan-result-kicker {
  color: var(--muted);
  letter-spacing: .18px;
}

.loan-result-amount {
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 42px);
}

.loan-result-actions {
  margin-top: 16px;
  display: grid;
  gap: 8px;
  max-width: 430px;
}

.loan-export-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.loan-export-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.loan-export-select {
  min-height: 42px;
  padding-right: 36px;
}

.loan-pdf-btn {
  min-height: 42px;
  padding: 0 18px;
  white-space: nowrap;
}

.loan-schedule-wrap {
  gap: 10px;
}

.loan-schedule-header {
  align-items: center;
}

.loan-schedule-title {
  font-size: 17px;
}

.loan-schedule-tabs {
  gap: 8px;
}

.loan-tab-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  line-height: 1;
}

.loan-tab-btn.is-active {
  color: #0f172a;
  background: #ffffff;
  border-color: rgba(255,255,255,.8);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .16);
}

.loan-table-shell {
  border-radius: 14px;
}

.loan-table {
  font-size: 13px;
}

.loan-table th,
.loan-table td {
  padding: 10px 9px;
}

.loan-table td,
.loan-table th {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .loan-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loan-field,
  .loan-form-section,
  .loan-result-hero {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .loan-export-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .loan-tab-btn {
    padding: 9px 12px;
    font-size: 13px;
  }
}


/* 2026-04-06 shared layout + ads + directory search */
.page-ad-slot {
  width: min(var(--max), calc(100% - 32px));
  margin: 18px auto;
}

.page-ad-slot[hidden] {
  display: none !important;
}

html[data-theme="light"] .page-ad-frame {
  background: rgba(255,255,255,.82);
}

.page-ad-frame {
  width: 100%;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  box-shadow: var(--shadow);
  overflow: visible;
  text-align: center;
}

.page-ad-frame--banner {
  min-height: 90px;
  display: block;
}

.page-ad-frame--responsive {
  min-height: 90px;
  display: block;
  width: 100%;
}

.page-ad-slot--between-categories .page-ad-frame--responsive {
  min-height: 90px;
}

.page-ad-frame .adsbygoogle {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  min-height: 90px;
}

.page-ad-slot--desktop .adsbygoogle {
  display: inline-block !important;
  width: 728px !important;
  height: 90px !important;
  min-height: 90px;
}

.page-ad-slot--desktop {
  display: none;
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .page-ad-slot--desktop.is-desktop-only {
    display: block;
  }
}

.directory-search-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .24px;
  text-transform: uppercase;
  color: var(--accent);
}

.directory-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.directory-search-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 4px 12px rgba(0,0,0,.08);
}

.directory-search-input:focus {
  outline: none;
  border-color: rgba(34,230,182,.5);
  box-shadow: 0 0 0 3px rgba(34,230,182,.12);
}

.directory-search-btn {
  min-width: 128px;
  min-height: 52px;
  padding: 0 20px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #22e6b6, #6aa9ff);
  color: #071225;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(34,230,182,.18);
}

.directory-search-meta {
  font-size: 13px;
  color: var(--muted);
}

.directory-empty-state {
  display: block;
}

.directory-empty-state[hidden],
.calculator-group-section[hidden],
.calculator-card-mini[hidden],
.calculator-card-grid[hidden] {
  display: none !important;
}

.calculator-group-head-fancy {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(34,230,182,.18);
  background: linear-gradient(135deg, rgba(34,230,182,.10), rgba(106,169,255,.12));
  overflow: hidden;
}

.calculator-group-head-fancy::after {
  content: "";
  position: absolute;
  inset: auto -40px -40px auto;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(106,169,255,.22), transparent 68%);
  pointer-events: none;
}

.calculator-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(7,18,37,.18);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .26px;
  text-transform: uppercase;
}

.calculator-group-title-fancy {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--text), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 640px) {
  .directory-search-control {
    grid-template-columns: 1fr;
  }

  .directory-search-btn {
    width: 100%;
  }

  .page-ad-frame {
    padding: 10px;
    border-radius: 18px;
  }

  .page-ad-frame--responsive {
    min-height: 124px;
  }

  .calculator-group-head-fancy {
    padding: 16px;
  }
}
