
/* Matr UI - scoped */
#matr-app.matr-app{
  --bg0:#040018;
  --bg1:#13002d;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.08);
  --stroke: rgba(255,255,255,0.14);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.72);
  --muted2: rgba(255,255,255,0.58);
  --primary:#7C4DFF;
  --primary2:#8B63FF;
  --shadow: 0 18px 60px rgba(0,0,0,0.35);
  --radius: 22px;
  --shell-max: 1360px;
  /* Keep all screens visually aligned with the Home layout (left column width) */
  --left-col-max: 680px;

  position: relative;
  isolation: isolate;
  min-height: 100vh;
  /* Full-bleed: make the UI cover the viewport even when embedded inside
     a theme/container (including Elementor). */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  overflow: hidden;
}

/* Hard reset inside the component scope (prevents theme/Elementor CSS from breaking layout) */
#matr-app.matr-app,
#matr-app.matr-app *{
  box-sizing: border-box;
}

/* ──────────────────────────────────────────────────────────────
   MATR theme scrollbar (applies to all scrollable areas)
   Scoped to #matr-app so it won't affect the host WP theme.
   ────────────────────────────────────────────────────────────── */

/* Firefox */
#matr-app.matr-app *{
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 77, 255, 0.70) rgba(255, 255, 255, 0.08);
}

/* Chromium / Safari */
#matr-app.matr-app *::-webkit-scrollbar{
  width: 10px;
  height: 10px;
}

#matr-app.matr-app *::-webkit-scrollbar-track{
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
}

#matr-app.matr-app *::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(124, 77, 255, 0.85), rgba(147, 51, 234, 0.70));
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.22);
}

#matr-app.matr-app *::-webkit-scrollbar-thumb:hover{
  background: linear-gradient(180deg, rgba(124, 77, 255, 0.95), rgba(147, 51, 234, 0.82));
}

#matr-app.matr-app *::-webkit-scrollbar-corner{
  background: transparent;
}
#matr-app.matr-app button,
#matr-app.matr-app select,
#matr-app.matr-app textarea,
#matr-app.matr-app input{
  font: inherit;
}
/* Ensure inline SVG icons render consistently even when themes apply global SVG resets */
#matr-app.matr-app svg{ display:block; flex: 0 0 auto; overflow: visible; }
#matr-app.matr-app svg *{ vector-effect: non-scaling-stroke; }
#matr-app.matr-app .matr-swap svg{ width: 22px; height: 22px; }
#matr-app.matr-app button svg{ width: 1em; height: 1em; }
#matr-app.matr-app .matr-card__icon svg{ width: 22px; height: 22px; }

#matr-app .matr-bg{
  position:absolute;
  inset:0;
  background:
    radial-gradient(1200px 600px at 20% 75%, rgba(124,77,255,0.55), transparent 60%),
    radial-gradient(900px 520px at 85% 75%, rgba(64,77,255,0.42), transparent 65%),
    radial-gradient(900px 520px at 55% 10%, rgba(67,0,136,0.45), transparent 65%),
    linear-gradient(180deg, #06001b 0%, #050019 50%, #07001f 100%);
  z-index:0;
}
#matr-app .matr-bg::after{
  content:"";
  position:absolute;
  inset:-20%;
  /* Remove the decorative globe/bg overlay image per user request */
  background-image:none;
  opacity: 0;
}

#matr-app .matr-shell{
  position:relative;
  z-index:1;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 34px 28px 40px;
}

/* -----------------------------------------
   Consistent layout width across all screens
   (Home page alignment is the reference)
------------------------------------------ */

/* Make the "top controls" row sit on the same left column as Home */
#matr-app .matr-inner-top{
  width: min(var(--left-col-max), 100%);
  margin-right: auto;
}

/* Controls row alignment:
   - Home: left aligned (matches reference)
   - Other screens: centered
*/
#matr-app .matr-row--controls--inner{
  justify-content: center;
}
#matr-app .matr-screen[data-screen="home"] .matr-row--controls--inner{
  justify-content: flex-start;
}

/* Center the language controls on non-home screens */
#matr-app[data-screen="results"] .matr-row--controls--inner,
#matr-app[data-screen="gpt"] .matr-row--controls--inner{
  justify-content: center;
}

/* Remove artificial "narrow" cards so pages don't look different widths */
#matr-app .matr-card--big,
#matr-app .matr-card--chat{
  max-width: none;
  width: 100%;
}

#matr-app .matr-header{
  display:none;
  align-items:center;
  justify-content:center;
}
#matr-app .matr-header--home{
  margin-top: 6px;
  margin-bottom: 60px;
}
#matr-app .matr-logo{
  height: 54px;
  width: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.25));
}
#matr-app .matr-logo--small{
  height: 44px;
}
#matr-app[data-screen="home"] .matr-header--home{ display:flex; }
#matr-app:not([data-screen="home"]) .matr-header--inner{ display:flex; justify-content:space-between; gap: 20px; }

#matr-app .matr-header--inner{
  padding-top: 4px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(120,90,255,0.14);
  margin-bottom: 24px;
}
#matr-app .matr-title{
  font-size: 30px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
#matr-app .matr-subtitle{
  margin-top: 6px;
  color: var(--muted2);
  font-size: 14px;
}

#matr-app .matr-main{ position:relative; }

#matr-app .matr-screen{
  display:none;
}
#matr-app[data-screen="home"] .matr-screen[data-screen="home"]{ display:block; }
#matr-app[data-screen="results"] .matr-screen[data-screen="results"]{ display:block; }
#matr-app[data-screen="gpt"] .matr-screen[data-screen="gpt"]{ display:block; }
#matr-app[data-screen="chat"] .matr-screen[data-screen="chat"]{ display:block; }
#matr-app[data-screen="login"] .matr-screen[data-screen="login"]{ display:block; }
#matr-app[data-screen="loading"] .matr-screen[data-screen="loading"]{ display:flex; }

#matr-app .matr-grid{
  display:grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 44px;
  align-items:center;
}
#matr-app .matr-grid--results{
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 36px;
}

/* Results left column: keep spacing even */
#matr-app[data-screen="results"] .matr-grid--results .matr-left{
  display:flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 980px){
  #matr-app .matr-grid,
  #matr-app .matr-grid--results{
    grid-template-columns: 1fr;
    gap: 28px;
  }
  #matr-app .matr-header--home{ margin-bottom: 30px; }

  /* Center the language selector row on mobile */
  #matr-app .matr-row--controls--inner{
    justify-content: center;
  }
}

#matr-app .matr-left{ min-width: 0; }
#matr-app .matr-right{ min-width: 0; display:flex; justify-content:center; }

#matr-app .matr-pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.86);
  font-size: 14px;
}
#matr-app .matr-pill__icon{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(124,77,255,0.20);
  color: rgba(255,255,255,0.92);
}
#matr-app .matr-pill--center{ margin: 0 auto; }

#matr-app .matr-lead{
  margin-top: 16px;
  margin-bottom: 26px;
  font-size: 18px;
  color: rgba(255,255,255,0.78);
}

#matr-app .matr-row{
  display:flex;
  align-items:center;
  gap: 14px;
  flex-wrap: wrap;
}
#matr-app .matr-row--controls{
  gap: 12px;
}
#matr-app .matr-row--controls--inner{
  justify-content:flex-start;
}
#matr-app .matr-select-wrap{
  position:relative;
  min-width: 220px;
}
#matr-app .matr-select-wrap.is-enhanced::after{ display:none; }
#matr-app .matr-select{
  width: 100%;
  appearance: none;
  padding: 12px 44px 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.92);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  line-height: 1.2;
  font-size: 14px;
}
#matr-app .matr-select:focus{
  border-color: rgba(124,77,255,0.6);
  box-shadow: 0 0 0 4px rgba(124,77,255,0.12);
}

/* When JS enhances the select, we hide the native control but keep it in the DOM
   for accessibility and for the existing JS state handling. */
#matr-app .matr-select.is-enhanced-native{
  position:absolute;
  inset:0;
  opacity:0;
  pointer-events:none;
}
#matr-app .matr-select-wrap::after{
  content:"";
  position:absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255,255,255,0.65);
  border-bottom: 2px solid rgba(255,255,255,0.65);
  transform: translateY(-58%) rotate(45deg);
  pointer-events:none;
  opacity: 0.9;
}

/* Custom select (beautiful dropdown, consistent across browsers) */
#matr-app .matr-cselect-btn{
  width: 100%;
  height: 44px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)),
    rgba(0,0,0,0.28);
  color: rgba(255,255,255,0.92);
  cursor:pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
#matr-app .matr-cselect-btn:focus{
  outline:none;
  border-color: rgba(124,77,255,0.7);
  box-shadow: 0 0 0 4px rgba(124,77,255,0.14), inset 0 1px 0 rgba(255,255,255,0.05);
}
#matr-app .matr-cselect-btn__value{
  min-width: 0;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#matr-app .matr-cselect-btn__arrow{
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255,255,255,0.65);
  border-bottom: 2px solid rgba(255,255,255,0.65);
  transform: rotate(45deg);
  opacity: 0.9;
}

.matr-cselect-menu{
  position: fixed;
  z-index: 2147483647;
  min-width: 220px;
  max-height: 320px;
  overflow:auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10, 5, 26, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);

  /* Match MATR in-app scrollbar (this menu is appended to <body>, so it does
     not inherit the #matr-app scoped scrollbar styles) */
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 77, 255, 0.70) rgba(255, 255, 255, 0.08);
}

.matr-cselect-menu::-webkit-scrollbar{
  width: 10px;
  height: 10px;
}
.matr-cselect-menu::-webkit-scrollbar-track{
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
}
.matr-cselect-menu::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(124, 77, 255, 0.85), rgba(147, 51, 234, 0.70));
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.22);
}
.matr-cselect-menu::-webkit-scrollbar-thumb:hover{
  background: linear-gradient(180deg, rgba(124, 77, 255, 0.95), rgba(147, 51, 234, 0.82));
}
.matr-cselect-menu::-webkit-scrollbar-corner{
  background: transparent;
}
.matr-cselect-item{
  width:100%;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.84);
  cursor:pointer;
  text-align:left;
}
.matr-cselect-item:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.08);
}
.matr-cselect-item.is-selected{
  background: rgba(124,77,255,0.22);
  border-color: rgba(124,77,255,0.45);
  color: rgba(255,255,255,0.92);
}
#matr-app .matr-select-wrap--model{ min-width: 150px; margin-left: auto; }
@media (max-width: 980px){
  #matr-app .matr-select-wrap--model{ margin-left: 0; }
}

#matr-app .matr-swap{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

/* Force swap icon visibility under aggressive theme CSS */
#matr-app .matr-swap svg,
#matr-app .matr-swap svg *{
  stroke: currentColor !important;
  fill: none !important;
}
#matr-app .matr-swap:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.20); }
#matr-app .matr-swap:active{ transform: translateY(0px); }

#matr-app .matr-btn{
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
  transition: transform .15s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}
#matr-app .matr-btn--primary{
  background: linear-gradient(180deg, var(--primary2), var(--primary));
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 14px 40px rgba(124,77,255,0.20);
}
#matr-app .matr-btn--primary:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.7);
  box-shadow: none;
}
#matr-app .matr-btn--ghost{
  margin-left: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.10);
  display:flex;
  align-items:center;
  gap: 10px;
}
#matr-app .matr-btn--ghost:hover,
#matr-app .matr-btn:hover{ transform: translateY(-1px); }
#matr-app .matr-btn__icon{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(0,0,0,0.20);
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(255,255,255,0.10);
}

#matr-app .matr-card{
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
#matr-app .matr-card--home{
  margin-top: 18px;
  padding: 34px 28px;
  text-align:center;
}
#matr-app .matr-card__icon{
  margin: 0 auto 14px;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(255,255,255,0.82);
}
#matr-app .matr-card__text{
  color: rgba(255,255,255,0.70);
  line-height: 1.4;
  font-size: 15px;
}

#matr-app .matr-card--score{
  margin-top: 18px;
  padding: 26px 26px;
  display:flex;
  align-items:center;
  gap: 18px;
}
#matr-app .matr-score__label{
  width: 130px;
  font-size: 16px;
  color: rgba(255,255,255,0.78);
  line-height: 1.15;
}
#matr-app .matr-score__value{
  font-size: 38px;
  font-weight: 750;
  color: rgba(255,255,255,0.94);
  letter-spacing: 0.4px;
}

#matr-app .matr-globe{
  width: 520px;
  max-width: 100%;
}
#matr-app .matr-globe__frame{
  width: 100%;
  /* equirectangular world map is 2:1 */
  aspect-ratio: 2 / 1;
  border-radius: 34px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow: hidden;
  position: relative;
}
#matr-app .matr-globe__canvas{
  width: 100%;
  height: 100%;
  display:block;
  border-radius: 34px;
}
#matr-app .matr-globe__labels{
  position:absolute;
  inset: 0;
  pointer-events:none;
}
#matr-app .matr-globe__tag{
  position:absolute;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(12, 8, 28, 0.65);
  backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.86);
  font-size: 12px;
  display:flex;
  align-items:center;
  gap: 6px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}
#matr-app .matr-globe__tag-dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(124,77,255,0.95);
  box-shadow: 0 0 0 4px rgba(124,77,255,0.18);
}
#matr-app .matr-globe__tag.is-selected{
  border-color: rgba(255, 172, 64, 0.55);
  background: rgba(18, 10, 32, 0.78);
}
#matr-app .matr-globe__tag.is-selected .matr-globe__tag-dot{
  background: rgba(255, 172, 64, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 172, 64, 0.18);
}

#matr-app .matr-globe__tag.is-selected.is-output .matr-globe__tag-dot{
  background: rgba(124, 77, 255, 0.98);
  box-shadow: 0 0 0 4px rgba(124, 77, 255, 0.18);
}

#matr-app .matr-globe__img{
  width: 100%;
  height: auto;
  display:block;
  filter: none;
  border-radius: 0;
}
#matr-app .matr-globe__img--fallback{
  position:absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 32px;
  opacity: 0;
}
#matr-app.is-globe-fallback .matr-globe__canvas{ display:none; }
#matr-app.is-globe-fallback .matr-globe__img--fallback{ opacity: 1; }

/* Static globe image used by the PHP UI (no WebGL/Three.js required) */
#matr-app .matr-globe__img--static{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
  border-radius: 0;
  transform-origin: 50% 50%;
  animation: none;
}

#matr-app .matr-globe__svg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
}

#matr-app .matr-globe__line{
  fill:none;
  stroke: rgba(255,255,255,0.80);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.25));
}
#matr-app .matr-inner-top{
  margin-bottom: 22px;
}

#matr-app .matr-radial{
  position: relative;
  /* Slightly smaller to give more breathing room for the left column */
  width: 440px;
  max-width: 100%;
  margin-left:auto;
  margin-right:auto;
}
#matr-app .matr-radial__wrap{
  width: 100%;
  aspect-ratio: 1/1;
  position: relative;
  display:flex;
  align-items:center;
  justify-content:center;
}
#matr-app .matr-radial__ring{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit: contain;
  opacity: 0.9;
}
#matr-app .matr-radial__center{
  width: 66%;
  height: 66%;
  object-fit: contain;
  filter: drop-shadow(0 22px 60px rgba(0,0,0,0.48));
}
#matr-app .matr-radial__labels{
  position:absolute;
  inset:0;
  pointer-events:none;
}

/* Dynamic feature labels around the ring */
#matr-app .matr-feature-chip{
  position:absolute;
  max-width: 42%;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255,255,255,0.88);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(10px);
}

/* Full-width table when there are many features */

/* Features table (shown when there are many features) */
#matr-app .matr-features-table{
  margin-top: 26px;
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 12px;
}

#matr-app .matr-table{
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(120,90,255,0.18);
  border-radius: 16px;
  overflow: hidden;
}

#matr-app .matr-table th,
#matr-app .matr-table td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(120,90,255,0.12);
  font-size: 13px;
  text-align: center !important;
  border-left: none !important;
  border-right: none !important;
}

/* Subtle center divider (dark blue/purple) */
#matr-app .matr-table th:first-child,
#matr-app .matr-table td:first-child{
  border-right: 1px solid rgba(120,90,255,0.18) !important;
}

#matr-app .matr-table th{
  color: rgba(255,255,255,0.88);
  background: rgba(25,16,60,0.45);
  font-weight: 600;
}

#matr-app .matr-table td{
  color: rgba(255,255,255,0.80);
}

#matr-app .matr-table tbody tr:last-child td{ border-bottom: none; }


#matr-app .matr-radial__label{
  position:absolute;
  font-size: 12px;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.84);
  text-transform: uppercase;
  white-space: nowrap;
}
#matr-app .matr-radial__label span{
  margin-left: 6px;
  color: rgba(255,255,255,0.72);
}

#matr-app .matr-card--big{
  padding: 56px 46px;
  max-width: none;
  width: 100%;
  margin: 0;
  text-align:center;
}
#matr-app .matr-h1{
  margin-top: 18px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0.2px;
}
#matr-app .matr-p{
  margin-top: 10px;
  color: rgba(255,255,255,0.70);
  font-size: 14px;
  line-height: 1.5;
}
#matr-app .matr-p--center{
  text-align:center;
  margin-top: 20px;
}
#matr-app .matr-divider{
  margin: 22px auto 18px;
  height: 1px;
  width: 70%;
  background: rgba(255,255,255,0.10);
}
#matr-app .matr-gpt-grid{
  margin-top: 14px;
  display:flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content:center;
}
#matr-app .matr-gpt-btn{
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.86);
  cursor:pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
#matr-app .matr-gpt-btn:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.20); }
#matr-app .matr-gpt-btn.is-selected{ background: rgba(124,77,255,0.26); border-color: rgba(124,77,255,0.50); }

#matr-app .matr-card--chat{
  padding: 44px 40px 30px;
  max-width: none;
  width: 100%;
  margin: 0;
  text-align:center;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
#matr-app .matr-chatlog{
  margin-top: 14px;
  margin-bottom: 18px;
  padding: 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(30,20,70,0.35);
  min-height: 320px;
  max-height: 560px;
  overflow:auto;
  flex: 1;
  text-align:left;
}

/* Parallel chat layout (Selected model vs Matr) */
#matr-app .matr-chat-columns{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}
#matr-app .matr-chat-col{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.12);
  padding: 14px;
  min-height: 520px;
  display:flex;
  flex-direction:column;
}
#matr-app .matr-chat-col__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
#matr-app .matr-chat-col__title{
  font-size: 12px;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.72);
}
#matr-app .matr-chat-col__badge{
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.78);
}
#matr-app .matr-chat-col .matr-chatlog{
  margin-top: 12px;
  margin-bottom: 0;
  min-height: 320px;
  max-height: 520px;
}

@media (max-width: 860px){
  #matr-app .matr-chat-columns{
    grid-template-columns: 1fr;
  }
}
#matr-app .matr-msg{
  padding: 10px 12px;
  border-radius: 14px;
  margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.08);
}
#matr-app .matr-msg--user{
  background: rgba(124,77,255,0.12);
}
#matr-app .matr-msg--ai{
  background: rgba(255,255,255,0.06);
}

/* Chat top controls row: keep everything on a single row (desktop) and push model selector to the right */
#matr-app[data-screen="chat"] .matr-inner-top{
  width: 100%;
}
#matr-app[data-screen="chat"] .matr-inner-top .matr-row--controls--inner{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}
#matr-app[data-screen="chat"] .matr-controls-left{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}
#matr-app[data-screen="chat"] .matr-controls-right{
  margin-left: auto;
}

@media (max-width: 920px){
  #matr-app[data-screen="chat"] .matr-inner-top .matr-row--controls--inner{
    flex-wrap: wrap;
    justify-content: center;
  }
  #matr-app[data-screen="chat"] .matr-controls-left{
    flex-wrap: wrap;
    justify-content: center;
  }
  #matr-app[data-screen="chat"] .matr-controls-right{
    width: 100%;
    margin-left: 0;
    display: flex;
    justify-content: center;
  }
}
#matr-app .matr-msg__meta{
  font-size: 11px;
  color: rgba(255,255,255,0.62);
  margin-bottom: 6px;
}
#matr-app .matr-chatbox{
  position: relative;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
  display:flex;
  gap: 12px;
  align-items:flex-end;
}
#matr-app .matr-textarea{
  flex:1;
  resize:none;
  border:0;
  outline:none;
  background: transparent;
  color: rgba(255,255,255,0.90);
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 8px;
}
#matr-app .matr-send{
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.90);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .15s ease, background .15s ease;
}
#matr-app .matr-send:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.12); }

#matr-app .matr-screen--overlay{
  position: fixed;
  inset: 0;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(8, 4, 18, 0.45);
  backdrop-filter: blur(10px);
  z-index: 9999;
}
#matr-app .matr-loading-card{
  width: min(640px, 92%);
  text-align:center;
  padding: 46px 30px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 30px 120px rgba(0,0,0,0.55);
}
#matr-app .matr-loading-icon{
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.20);
}
#matr-app .matr-spinner{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.28);
  border-top-color: rgba(255,255,255,0.92);
  animation: matr-spin 1s linear infinite;
}
@keyframes matr-spin{
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
#matr-app .matr-loading-title{
  font-size: 28px;
  font-weight: 800;
}
#matr-app .matr-loading-sub{
  margin-top: 8px;
  font-size: 14px;
  color: rgba(255,255,255,0.70);
}

#matr-app .matr-foot{
  margin-top: 26px;
  display:flex;
  justify-content:center;
}
#matr-app .matr-foot__btn{
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.86);
  border-radius: 12px;
  padding: 10px 14px;
  cursor:pointer;
}

#matr-app .matr-debug{
  margin-top: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.70);
}


/* v1.8 layout unification */
/* Results stays aligned to the Home left-column width.
   Chat should be full width (per latest UI requirement). */
#matr-app .matr-screen[data-screen="results"] .matr-results-card{
  max-width: var(--left-col-max);
  width: 100%;
  margin-left: 0;
  margin-right: auto;
}

#matr-app .matr-screen[data-screen="chat"] .matr-card--chat{
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Chat controls row: center language controls + compare, keep model selector on the right */
#matr-app[data-screen="chat"] .matr-row--controls--inner{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
#matr-app[data-screen="chat"] .matr-controls--center{
  grid-column: 2;
  justify-content: center;
}
#matr-app[data-screen="chat"] .matr-controls--right{
  grid-column: 3;
  justify-self: end;
}

@media (max-width: 900px){
  #matr-app[data-screen="chat"] .matr-row--controls--inner{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  #matr-app[data-screen="chat"] .matr-controls--right{
    width: 100%;
    justify-content: center;
    justify-self: auto;
  }
}

/* GPT selector: make the main box centered and full width (match Home page container width) */
#matr-app .matr-screen[data-screen="gpt"] .matr-card--big{
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Controls row alignment:
   - Home: left aligned (matches reference)
   - Other screens: centered
*/
#matr-app .matr-row--controls--inner{
  justify-content: center;
}
#matr-app .matr-screen[data-screen="home"] .matr-row--controls--inner{
  justify-content: flex-start;
}

/* Match home grid proportions on results */
#matr-app .matr-grid--results{
  grid-template-columns: 1.1fr 0.9fr;
}

/* Make inner pages align like home */
#matr-app .matr-screen[data-screen="results"] .matr-shell,
#matr-app .matr-screen[data-screen="gpt"] .matr-shell,
#matr-app .matr-screen[data-screen="chat"] .matr-shell{
  padding-top: 54px;
}

/* GPT model selection buttons */
#matr-app .matr-model-buttons{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
#matr-app .matr-gpt-btn.is-selected{
  outline: 2px solid rgba(164, 126, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(164, 126, 255, 0.12);
}

/* Chat: keep model dropdown on the same row on desktop */
#matr-app[data-screen="chat"] .matr-row--controls--inner{
  flex-wrap: nowrap;
}
#matr-app[data-screen="chat"] .matr-select-wrap--model{
  margin-left: auto;
}

@media (max-width: 980px){
  #matr-app[data-screen="chat"] .matr-row--controls--inner{
    flex-wrap: wrap;
  }
  #matr-app[data-screen="chat"] .matr-select-wrap--model{
    margin-left: 0;
  }
}

/* Improve mobile responsiveness */
@media (max-width: 980px){
  #matr-app .matr-row--controls--inner{
    justify-content: center;
  }
  #matr-app .matr-card--big .matr-card__inner,
  #matr-app .matr-card--chat .matr-card__inner{
    padding: 18px;
  }
  #matr-app .matr-inner-top .matr-row--controls--inner{
    gap: 10px;
  }
}

/* Smaller phones */
@media (max-width: 560px){
  #matr-app .matr-shell{
    padding-left: 18px;
    padding-right: 18px;
  }
  #matr-app .matr-select{
    min-width: 0;
    width: 100%;
  }
  #matr-app .matr-btn{
    width: 100%;
  }
}

/* Tablet / small screens */
@media (max-width: 768px){
  #matr-app .matr-shell{
    padding: 28px 18px 44px;
  }

  #matr-app .matr-header{
    margin-bottom: 22px;
  }

  #matr-app .matr-logo{
    width: 160px;
  }

  #matr-app .matr-title{
    font-size: 30px;
    line-height: 1.15;
  }

  #matr-app .matr-grid{
    gap: 22px;
  }

  #matr-app .matr-globe{
    height: 320px;
  }

  #matr-app .matr-globe__frame{
    border-radius: 24px;
  }

  #matr-app .matr-card{
    padding: 26px 22px;
  }

  #matr-app .matr-controls{
    justify-content: center;
  }
}

/* Phones */
@media (max-width: 480px){
  #matr-app .matr-shell{
    padding: 22px 14px 38px;
  }

  #matr-app .matr-logo{
    width: 140px;
  }

  #matr-app .matr-title{
    font-size: 26px;
  }

  #matr-app .matr-subtitle{
    font-size: 13px;
  }

  #matr-app .matr-pill{
    font-size: 12px;
    padding: 8px 12px;
  }

  #matr-app .matr-globe{
    height: 260px;
  }

  #matr-app .matr-row--controls{
    gap: 10px;
  }

  #matr-app .matr-select{
    min-width: 0;
  }

  #matr-app .matr-card{
    padding: 22px 18px;
  }

  #matr-app .matr-gpt-grid{
    gap: 10px;
  }

  #matr-app .matr-gpt-btn{
    flex: 1 1 calc(50% - 10px);
    min-width: 0;
  }

  #matr-app .matr-chat-columns{
    gap: 12px;
  }

  #matr-app .matr-chat-col{
    min-height: 460px;
  }

  #matr-app .matr-chatlog{
    min-height: 260px;
    max-height: 420px;
  }

  #matr-app .matr-chatbox{
    flex-direction: column;
    align-items: stretch;
  }

  #matr-app .matr-send{
    width: 100%;
    height: 44px;
    border-radius: 14px;
  }
}


/* Login screen */
.matr-login{
  width: 50vw;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 18px;
  background: rgba(18, 12, 40, 0.38);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.matr-login__title{margin:0 0 8px 0;font-size:22px;color:#fff;}
.matr-login__text{margin:0 0 18px 0;color:rgba(255,255,255,0.8);}


/* Login fields (Matr theme) */
.matr-login__form{display:flex;flex-direction:column;gap:14px;margin-top:10px;}
.matr-field{display:flex;flex-direction:column;gap:8px;}
.matr-field__label{
  font-size:12px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:rgba(255,255,255,0.72);
}
.matr-input{
  width:100%;
  height:46px;
  border-radius:14px;
  padding:0 14px;
  border:1px solid rgba(130,90,255,0.35);
  background:rgba(10, 8, 24, 0.55);
  color:#fff;
  outline:none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10);
}
.matr-input::placeholder{color:rgba(255,255,255,0.45);}
.matr-input:focus{
  border-color:rgba(140,110,255,0.9);
  box-shadow: 0 0 0 4px rgba(140,110,255,0.18);
}

/* Force Matr input styles even if the theme overrides form fields */
#matr-app .matr-login .matr-input{
  background: rgba(10, 8, 24, 0.55) !important;
  color: rgba(255,255,255,0.92) !important;
  border: 1px solid rgba(130,90,255,0.45) !important;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10) !important;
  caret-color: rgba(255,255,255,0.92) !important;
  -webkit-text-fill-color: rgba(255,255,255,0.92) !important;
}
#matr-app .matr-login .matr-input:focus{
  border-color: rgba(140,110,255,0.95) !important;
  box-shadow: 0 0 0 4px rgba(140,110,255,0.18) !important;
}
.matr-login__error{
  min-height:18px;
  color:#ffb4b4;
  font-size:13px;
}
.matr-login__actions{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-top:6px;}
.matr-login__footer{margin-top:8px;}
.matr-login__register{
  font-size:13px;
  color:rgba(170, 210, 255, 0.95);
  text-decoration:none;
}
.matr-login__register:hover{color:#fff;text-decoration:underline;}


/* GPT disabled state */
.matr-gpt-btn.is-disabled{
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}
.matr-gpt-btn .matr-coming-soon{
  display:block;
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.85;
}


/* Small loader for Compare button */
#matr-app .matr-btn[data-loading="1"]{
  position: relative;
  pointer-events: none;
  opacity: 0.9;
  padding-right: 44px;
}
#matr-app .matr-btn[data-loading="1"]::after{
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: rgba(168,139,255,0.95);
  animation: matr-spin 0.8s linear infinite;
}
@keyframes matr-spin{ to{ transform: rotate(360deg); } }



/* ============================================================
   Mobile responsiveness (extra)
   ============================================================ */
@media (max-width: 768px){
  /* Make controls stack nicely */
  #matr-app .matr-controls{
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px !important;
  }
  #matr-app .matr-cselect,
  #matr-app select.matr-select,
  #matr-app .matr-cselect-btn{
    width: 100% !important;
    max-width: 100% !important;
  }
  #matr-app .matr-swap{
    order: 3;
  }
  #matr-app .matr-btn{
    width: 100%;
    justify-content: center;
  }

  /* Reduce page padding */
  #matr-app .matr-shell{
    padding: 26px 14px 34px;
  }

  /* Home + Results right visuals */
  #matr-app .matr-globe{
    max-width: 520px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  #matr-app .matr-globe__tag{
    font-size: 11px;
    padding: 6px 10px;
  }

  /* Radial / orbit: keep within viewport */
  #matr-app .matr-radial__wrap{
    width: min(360px, 92vw) !important;
    height: min(360px, 92vw) !important;
    margin-left: auto;
    margin-right: auto;
  }
  #matr-app .matr-radial__label{
    font-size: 11px;
    padding: 6px 10px;
    max-width: 44vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Features table: allow horizontal scroll if needed */
  #matr-app .matr-features-table{
    max-width: 100% !important;
    padding: 0 8px;
    overflow-x: auto;
  }
  #matr-app .matr-table{
    min-width: 520px; /* prevents cramped columns */
  }

  /* Chat: compact spacing */
  #matr-app .matr-chatlog{
    max-height: 60vh;
    min-height: 260px;
  }
  #matr-app .matr-chat-col{
    min-height: 420px;
  }

  /* GPT buttons wrap */
  #matr-app .matr-gpt-btn{
    min-width: 140px;
    flex: 1 1 140px;
  }

  /* Custom select menu on small screens */
  .matr-cselect-menu{
    max-height: 52vh !important;
  }
}

@media (max-width: 480px){
  /* Even tighter controls */
  #matr-app .matr-title{
    font-size: 24px;
  }
  #matr-app .matr-subtitle{
    font-size: 13px;
  }
  #matr-app .matr-card{
    padding: 16px;
  }
  #matr-app .matr-radial__wrap{
    width: min(320px, 92vw) !important;
    height: min(320px, 92vw) !important;
  }
  #matr-app .matr-globe__tag{
    font-size: 10px;
    padding: 5px 9px;
  }
}
