/* === Appliance Repair Theme Palette === */
:root {
  --google-blue: #2563eb;
  --google-blue-dark: #1d4ed8;
  --google-blue-light: #3b82f6;
  --google-purple: #8b5cf6;
  --google-purple-dark: #7c3aed;
  --google-purple-light: #a78bfa;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-600: #475569;
  --slate-500: #64748b;
  --google-grey-900: #0f172a;
  --google-grey-700: #475569;
  --google-grey-200: rgba(226, 232, 240, 0.6);
  --google-grey-100: #ffffff;
  --google-yellow: #f59e0b;
  --google-orange: #f59e0b;
  --google-green: #2ecc71;
}

body {
  background-color: #ffffff;
  font-family: 'Google Sans Text', sans-serif;
  color: var(--slate-600);
}

.elev-1 {
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

/* Header and Banner */
.header-container {
  margin-top: 40px;
  margin-bottom: 32px;
  text-align: center;
}

.header-container h1 {
  font-family: 'Google Sans', sans-serif;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  font-size: clamp(
    1.6rem,
    4vw + 0.5rem,
    2.75rem
  ); /* ~26px → 44px fluid scaling */
  line-height: 1.2; /* tighter on large screens */
  text-wrap: balance; /* modern browsers balance line lengths */
  color: var(--google-blue-dark);
}

/* Ensure brand-split stays inline by default */
.brand-split {
  display: inline;
}

.banner {
  background: #fff;
  color: var(--google-grey-900);
  border: 1px solid var(--google-grey-200);
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
  padding: 20px;
}

.banner-content h2 {
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  font-size: 28px;
  margin: 0 0 16px;
  color: var(--google-grey-900);
}

.banner-section-title {
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--google-blue-dark);
  margin: 0 0 12px 0;
}

.banner-description {
  font-family: 'Google Sans Text', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--google-grey-700);
  margin-bottom: 12px;
}

.banner-description:last-child {
  margin-bottom: 0;
}

.banner-link {
  color: var(--google-blue-dark);
  text-decoration: none;
}

.banner-link:hover {
  text-decoration: underline;
}

.banner-note {
  font-size: 13px;
  color: var(--google-grey-600);
  text-align: right;
  margin-top: 6px;
}

.citation-note {
  font-size: 14px;
  color: var(--google-grey-700);
  background: #fafbfc;
  border: 1px solid var(--google-grey-200);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0 0 0;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.05);
}

.how-to-use {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.how-to-use h3 {
  margin: 0 0 15px 0;
  font-size: 1.2em;
  font-weight: 500;
}

.how-to-use ol {
  margin: 0;
  padding-left: 20px;
}

.how-to-use li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Attribution block - semantic grouping */
.attribution {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Blog link in attribution section */
.blog-link-container {
  margin-top: 16px;
  margin-bottom: 8px;
}

.blog-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #e8f0fe;
  color: var(--google-blue-dark);
  text-decoration: none;
  border-radius: 20px;
  border: 1px solid #d2e3fc;
  font-family: 'Google Sans Text', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.15);
}

.blog-link:hover {
  background: #d2e3fc;
  color: var(--google-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(26, 115, 232, 0.2);
  text-decoration: none;
}

.blog-link .blog-icon {
  font-size: 16px;
}

.blog-link .external-icon {
  font-size: 14px;
  opacity: 0.8;
}

/* Disclaimer */
.disclaimer-container {
  margin-top: 8px;
}

.disclaimer-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fffbeb;
  border: none;
  border-left: 4px solid var(--google-yellow);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.1);
}

.disclaimer-box p {
  margin: 0;
}

.disclaimer-box strong {
  color: #495057;
  font-weight: 600;
}

.disclaimer-icon {
  color: var(--google-yellow);
  font-size: 18px;
}

.disclaimer-text {
  color: var(--google-grey-700);
}

/* Sample Reports */
.samples-container {
  background-color: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid #e9ecef;
}

.samples-container h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 20px;
  font-weight: normal;
  margin-bottom: 6px;
}

.samples-description {
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.6;
  color: var(--google-grey-700);
}

.samples-description strong {
  color: var(--google-blue-dark);
  font-weight: 600;
}

.instruction-step {
  margin-bottom: 6px;
  padding-left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #e8f0fe;
  color: var(--google-blue);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* === SAMPLE REPORT BUTTON GRID ================================= */
.sample-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: clamp(8px, 1vw, 16px);
  margin-top: 8px;
  grid-auto-flow: row;
  justify-content: center;
}

/* Tip under sample buttons */
.samples-tip {
  font-family:
    'Google Sans',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 14px;
  color: var(--google-grey-700);
  background-color: #f8f9fa;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 8px;
  font-weight: 400;
  line-height: 1.6;
}

/* Desktop tip visibility */
.tip-desktop {
  display: block;
}

/* Mobile tip - show only on touch devices */
@media (hover: none) {
  .mobile-tip {
    margin: 0.75rem 1rem 1rem;
    font-size: 0.875rem;
    color: #5f6368;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    line-height: 1.5;
    display: block;
    text-align: left;
  }
  .mobile-tip .icon {
    display: inline;
    font-size: 1rem;
    margin-right: 0.25rem;
  }
  .mobile-tip strong {
    color: #1a73e8;
    font-weight: 600;
  }
  .mobile-tip em {
    font-style: italic;
    color: #5f6368;
    font-size: 0.825rem;
  }
}

/* Hide mobile tip on mouse/desktop */
@media (hover: hover) {
  .mobile-tip {
    display: none;
  }
}

/* === CARD ====================================================== */
.sample-button {
  display: block;
  padding: clamp(12px, 1.2vw, 18px);
  border-radius: 8px;
  background: var(--google-grey-100);
  border: 1px solid var(--google-grey-200);
  color: var(--google-grey-900);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow:
    0 2px 6px rgba(60, 64, 67, 0.15),
    0 1px 2px rgba(60, 64, 67, 0.1);
}

.sample-button-content {
  text-align: left;
}

/* === TYPOGRAPHY =============================================== */
.sample-title {
  font-weight: 500;
  letter-spacing: -0.15px;
  font-size: clamp(0.95rem, 1.55vw, 1.1rem);
  line-height: 1.3;
  margin: 0 0 6px 0;
}
.sample-meta {
  font-size: clamp(0.72rem, 1.2vw, 0.85rem);
  opacity: 0.8;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.sample-modality {
  padding: 0.12em 0.7em;
  border-radius: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sample-modality.mod-ct {
  background: rgba(66, 133, 244, 0.15);
  color: var(--google-blue-dark);
}

.sample-modality.mod-mri {
  background: rgba(156, 39, 176, 0.15);
  color: var(--google-purple-dark);
}

.sample-modality.mod-xr {
  background: rgba(255, 152, 0, 0.15);
  color: #e65100;
}

.sample-modality.mod-us {
  background: rgba(0, 188, 212, 0.15);
  color: #00695c;
}

.sample-modality.mod-pet {
  background: rgba(255, 64, 129, 0.15);
  color: #ad1457;
}

.sample-button:hover {
  background: var(--google-grey-200);
  border-color: var(--google-blue-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.sample-button:active {
  transform: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* === MINIMUM TOUCH SIZE ======================================= */
@supports (height: 100lvh) {
  .sample-button {
    min-height: 44px;
  }
}

/* Mobile optimization for sample buttons */
@media (max-width: 768px) {
  .sample-button {
    padding: 10px 12px;
  }

  .sample-title {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    line-height: 1.3;
  }

  .sample-meta {
    margin-top: 4px;
  }

  /* Hide desktop tip on mobile */
  .tip-desktop {
    display: none;
  }
}

/* Very narrow phones - horizontal scroll */
@media (max-width: 360px) {
  .sample-buttons {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-inline: 4px;
  }
  .sample-button {
    flex: 0 0 80%;
    margin-inline: 4px;
    scroll-snap-align: start;
  }
}

/* Loading state */
.sample-button.loading {
  pointer-events: none;
  opacity: 0.6;
}
.sample-button.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" stroke="%234285F4" stroke-width="2" stroke-dasharray="31.416" stroke-dashoffset="31.416"><animateTransform attributeName="transform" type="rotate" dur="1s" values="0 12 12;360 12 12" repeatCount="indefinite"/></circle></svg>')
    center / 24px 24px no-repeat;
}

/* Mobile touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .large-text-area {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }

  .output-container,
  #prompt-output {
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
    overscroll-behavior: contain;
  }

  .text-span {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* Text Areas */
.text-area-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Ensure both panels handle long content consistently */
.large-text-area,
.output-container {
  min-width: 0; /* Prevent grid overflow */
  max-width: 100%; /* Stay within grid bounds */
  overflow-wrap: break-word; /* Break long words */
  word-break: break-word; /* Handle long headers */
}

.text-area-wrapper {
  flex: 1;
}

.text-area-wrapper h2 {
  margin: 0 0 15px 0;
  color: #2c3e50;
  font-size: 1.3em;
  font-weight: 500;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 8px;
}

.large-text-area {
  width: 100%;
  height: clamp(300px, 50vh, 500px);
  min-height: 300px;
  padding: 15px;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--google-grey-200);
  border-radius: 8px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.3s ease;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.large-text-area:focus {
  outline: none;
  border-color: var(--google-blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

.output-container {
  width: 100%;
  height: clamp(300px, 50vh, 500px);
  min-height: 300px;
  overflow: auto;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background-color: #f8f9fa;
  position: relative;
  /* Ensure container doesn't expand beyond grid bounds */
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(240, 248, 255, 0.85);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 8px;
  z-index: 10;
}

.loader-message {
  font-family: 'Google Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--google-blue-dark);
  display: inline-block;
}

.loader-text {
  margin-top: 24px;
  text-align: center;
}

.spinner {
  width: 80px;
  height: 80px;
  border: 8px solid rgba(26, 115, 232, 0.15);
  border-top-color: var(--google-blue-dark);
  border-right-color: var(--google-blue);
  border-radius: 50%;
  filter: drop-shadow(0 3px 6px rgba(26, 115, 232, 0.15));
}

.sample-button.active {
  background: var(--google-blue);
  color: #fff;
  border-color: var(--google-blue);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
  transform: translateY(-1px);
}

.sample-button.active .sample-modality {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.sample-button.active:hover {
  background: var(--google-blue-light);
  border-color: var(--google-blue-light);
  box-shadow: 0 3px 12px rgba(26, 115, 232, 0.4);
}

.output-text {
  width: 100%;
  height: 100%;
  padding: 15px;
  margin: 0;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  border: none;
  overflow: auto;
  white-space: normal;
  word-wrap: break-word;
  box-sizing: border-box;
  background-color: transparent;
  font-size: 14px;
  line-height: 1.5;
}

#output-text {
  white-space: pre-wrap;
}

#predict-button {
  padding: 12px 24px;
  background: var(--google-blue);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
  margin: 12px auto 8px auto;
  display: block;
  position: relative;
  overflow: hidden;
}

#predict-button:hover {
  background: var(--google-blue-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

#predict-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(26, 115, 232, 0.3);
}

#predict-button:disabled {
  background: #bdc1c6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.1);
}

.text-span {
  cursor: pointer;
  border-radius: 2px;
  transition: background-color 0.2s;
}

/* Style labels within text spans */
.text-span.has-label .label-part {
  font-weight: 600;
  color: var(--google-blue);
  font-family: 'Google Sans', sans-serif;
  pointer-events: none; /* Let hover events bubble to parent .text-span */
}

.text-span.has-label .content-part {
  font-weight: normal;
}

.text-span:hover {
  background-color: rgba(66, 165, 245, 0.2);
  outline: 1px solid rgba(66, 165, 245, 0.3);
}

.highlight {
  background-color: rgba(66, 165, 245, 0.35) !important;
  outline: 1px solid rgba(66, 165, 245, 0.5) !important;
}

/* Input textarea selection - exactly match output highlighting */
.large-text-area::selection {
  background-color: rgba(66, 165, 245, 0.35) !important;
  color: inherit !important;
}

.large-text-area::-moz-selection {
  background-color: rgba(66, 165, 245, 0.35) !important;
  color: inherit !important;
}

#output-text-container {
  position: relative;
}

#input-text-container {
  position: relative;
}

#output-text-container .significance-minor {
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: #fbc02d; /* subtle yellow */
  text-decoration-thickness: 2px;
}

#output-text-container .significance-significant {
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: #f48fb1; /* subtle light pink */
  text-decoration-thickness: 2px;
}

/* Report Structure */
.segment-label {
  font-weight: bold;
}

/* Sub-label styling */
.segment-sublabel {
  font-family: 'Google Sans', sans-serif; /* align with headers */
  font-weight: 600; /* stronger bold for clarity */
  color: var(--google-grey-900);
  margin-right: 2px;
  white-space: nowrap;
}

.segment-body {
  margin-bottom: 12px;
}

.section-header {
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  font-size: 1.1em;
  margin-top: 12px;
  margin-bottom: 2px;
  color: var(--google-blue-dark);
}

textarea::selection {
  background-color: #ffeb3b;
  color: #000;
}

.instructions {
  background: var(--google-grey-100);
  border-radius: 8px;
  border: 1px solid var(--google-grey-200);
  padding: 10px 16px;
  font-size: 14px;
  color: var(--google-grey-700);
}

.instructions p {
  margin: 0;
  line-height: 1.6;
  color: #2c3e50;
  font-size: 1em;
}

.instructions strong {
  color: #1565c0;
  font-weight: 600;
}

.instructions ul {
  margin: 15px 0;
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.instructions li strong {
  color: #2c3e50;
}

.samples-container h3,
.header-container h1 {
  font-weight: 400;
}

.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: #fff;
  border: 1px solid var(--google-grey-200);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
  padding: 24px;
}

.text-area-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.banner.card {
  padding: 24px;
  border-radius: 16px;
  margin-top: 24px;
  border-color: var(--google-grey-200);
}

.banner-content {
  max-width: 820px;
  margin: 0 auto;
  text-align: left;
}

.sub-header {
  margin: 0;
  font-family: 'Google Sans Text', sans-serif;
  font-size: 18px;
  color: var(--google-grey-700);
}

/* Modality color tags */
.sample-modality.ct {
  background: #e3f2fd;
  color: #1565c0;
}
.sample-modality.mri {
  background: #e8f5e9;
  color: #2e7d32;
}
.sample-modality.xr {
  background: #fff3e0;
  color: #e65100;
}
.sample-modality.us {
  background: #e0f2f1;
  color: #00695c;
}
.sample-modality.pet {
  background: #fce4ec;
  color: #ad1457;
}
/* keep active chip modality white when selected */
.sample-button.active .sample-modality.ct,
.sample-button.active .sample-modality.mri,
.sample-button.active .sample-modality.xr,
.sample-button.active .sample-modality.us,
.sample-button.active .sample-modality.pet {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.primary-label {
  font-family: 'Google Sans Text', sans-serif;
  font-weight: 500;
  margin-top: 10px;
  margin-bottom: 2px;
  color: var(--google-blue-dark);
}

.finding-list {
  margin: 0 0 4px 0;
  padding-left: 0;
  list-style-position: inside;
}
.finding-list li {
  margin-bottom: 6px;
  line-height: 1.5;
  padding-left: 0.4em;
  text-indent: -0.4em;
}
.single-finding {
  margin: 0 0 6px 0;
}

@keyframes loaderPulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.8;
  }
}

.source-link {
  display: none;
}

.footer-note {
  font-size: 13px;
  color: var(--google-grey-600);
  text-align: center;
  margin-top: 24px;
}
.footer-note .banner-link {
  font-weight: 500;
  color: var(--google-blue-dark);
}
.footer-note .hug-emoji {
  font-size: 16px;
}

.banner-description + .banner-description {
  border-top: 1px solid var(--google-grey-200);
  padding-top: 12px;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.copy-button-overlay {
  position: absolute;
  bottom: 12px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: #9aa0a6;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 5;
  opacity: 0.7;
}

.copy-button-overlay:hover {
  background-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  color: #5f6368;
  opacity: 1;
}

.copy-button-overlay:active {
  transform: scale(0.98);
}

.copy-button-overlay.copied {
  background-color: rgba(230, 247, 255, 0.8);
  border-color: rgba(24, 144, 255, 0.3);
  color: #1890ff;
  opacity: 0.9;
}

.copy-button-overlay svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.copy-button-overlay.copied svg {
  display: none;
}

.copy-button-overlay.copied::after {
  content: '✓';
  font-size: 16px;
  font-weight: 500;
}

.copy-button-overlay:disabled {
  opacity: 0;
  pointer-events: none;
}

.clear-button-overlay {
  position: absolute;
  bottom: 12px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: #9aa0a6;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 5;
  opacity: 0.7;
}

.clear-button-overlay:hover {
  background-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  color: #5f6368;
  opacity: 1;
}

.clear-button-overlay:active {
  transform: scale(0.98);
}

.clear-button-overlay.cleared {
  background-color: rgba(230, 247, 255, 0.8);
  border-color: rgba(24, 144, 255, 0.3);
  color: #1890ff;
  opacity: 0.9;
}

.clear-button-overlay svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.clear-button-overlay.cleared svg {
  display: none;
}

.clear-button-overlay.cleared::after {
  content: '✓';
  font-size: 16px;
  font-weight: 500;
}

.clear-button-overlay:disabled {
  opacity: 0;
  pointer-events: none;
}
.toggle-group {
  display: flex;
  gap: 16px;
  align-items: center;
}

.cache-toggle {
  font-size: 13px;
  color: var(--google-grey-700);
  user-select: none;
}

.raw-toggle,
.prompt-toggle {
  font-size: 13px;
  color: #546e7a;
  font-weight: 500;
  user-select: none;
  transition: color 0.2s ease;
}

.raw-toggle:hover,
.prompt-toggle:hover {
  color: #37474f;
}

.cache-toggle input,
.raw-toggle input {
  margin-right: 4px;
}

.cache-status {
  font-size: 11px;
  color: var(--google-grey-700);
  margin-left: 4px;
  opacity: 0.8;
}

.raw-json {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
  background: #fafafa;
  border: 1px solid var(--google-grey-200);
  border-radius: 8px;
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden !important;
  word-wrap: break-word;
  word-break: break-word;
  width: 100%;
  box-sizing: border-box;
}

/* Disable animations to prevent flicker */
.raw-json * {
  animation: none !important;
  transition: none !important;
}

/* Override JSON formatter table layout for text wrapping */
.raw-json .json-formatter-row {
  display: block !important;
  width: 100% !important;
  table-layout: auto !important;
}

.raw-json .json-formatter-row > * {
  display: inline !important;
  max-width: 100% !important;
}

/* Force the entire JSON formatter to use block layout */
.raw-json .json-formatter-table {
  display: block !important;
  width: 100% !important;
  table-layout: fixed !important;
}

.raw-json .json-formatter-table,
.raw-json .json-formatter-table * {
  table-layout: fixed !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Basic JSON formatter styling */
.raw-json .json-formatter-key {
  color: #0066cc;
}
.raw-json .json-formatter-string {
  color: #22863a;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  display: inline !important;
  max-width: 100% !important;
  vertical-align: top !important;
  overflow-wrap: break-word !important;
}
.raw-json .json-formatter-number {
  color: #005cc5;
}
.raw-json .json-formatter-boolean {
  color: #d73a49;
}
.raw-json .json-formatter-null {
  color: #6f42c1;
}
.raw-json .json-formatter-toggler {
  color: #586069;
  cursor: pointer;
}
.raw-json .json-formatter-toggler:hover {
  color: #0366d6;
}

/* Force text wrapping for all elements */
.raw-json .json-formatter-string,
.raw-json .json-formatter-key,
.raw-json .json-formatter-row,
.raw-json .json-formatter-row *,
.raw-json .json-formatter-preview {
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  width: auto !important;
}

/* Prevent horizontal scrolling and text cutoff */
.raw-json,
.raw-json * {
  max-width: 100% !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  hyphens: auto !important;
  overflow-x: hidden !important;
}

#raw-output {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-wrap: break-word !important;
}

.input-header,
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.input-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Panel controls at bottom of Input/Output container */
.panel-controls {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 4px 16px !important;
  border-top: 1px solid #e9ecef !important;
  background: #fafbfc !important;
  border-radius: 0 0 16px 16px !important;
  margin-top: 0px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  flex-wrap: wrap !important;
  text-align: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  grid-column: 1 / -1 !important;
}

.input-header h2,
.output-header h2 {
  margin: 0;
  line-height: 1.2;
}

.text-area-wrapper h2 {
  border: none;
}

#prompt-output {
  width: 100%;
  height: clamp(300px, 50vh, 500px);
  min-height: 300px;
  overflow: auto;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: #fafafa;
  padding: 16px;
  box-sizing: border-box;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Markdown styling for prompt output */
#prompt-output h1 {
  font-family: 'Google Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--google-blue-dark);
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--google-grey-200);
}

#prompt-output h2 {
  font-family: 'Google Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--google-blue-dark);
  margin: 24px 0 12px 0;
}

#prompt-output h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--google-grey-700);
  margin: 16px 0 8px 0;
}

#prompt-output strong {
  font-weight: 600;
  color: var(--google-blue-dark);
}

#prompt-output blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 4px solid var(--google-blue);
  background: rgba(26, 115, 232, 0.05);
  font-style: italic;
}

#prompt-output code {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 11px;
}

#prompt-output pre {
  background: #f5f5f5;
  border: 1px solid var(--google-grey-200);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
  font-size: 11px;
  line-height: 1.3;
  word-wrap: break-word;
  white-space: pre-wrap;
}

#prompt-output pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

#prompt-output ul,
#prompt-output ol {
  margin: 8px 0;
  padding-left: 20px;
}

#prompt-output li {
  margin-bottom: 4px;
  line-height: 1.4;
}

#prompt-output p {
  margin: 8px 0;
  line-height: 1.5;
  font-family: 'Google Sans Text', sans-serif;
  font-size: 13px;
}

.no-bold {
  font-weight: 400;
}

.model-select-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin: 0;
}

.model-select-container select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--google-grey-200);
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

.model-select-container select:focus {
  outline: none;
  border-color: var(--google-blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

.model-select-container label {
  font-weight: 500;
  color: var(--google-grey-700);
}

.banner-divider {
  border: none;
  border-top: 1px solid var(--google-grey-200);
  margin: 24px 0 18px 0;
}

/* Interface Options Panel */
.interface-options-panel {
  margin: 16px 0;
  padding: 16px !important; /* Override default card padding for more compact layout */
}

.interface-options-header {
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}

.interface-options-header:hover {
  background-color: var(--google-grey-100);
}

.interface-options-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 20px;
  font-weight: normal;
  margin: 0 0 6px 0;
  color: var(--google-grey-900);
}

.interface-options-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--google-grey-700);
  margin-bottom: 4px;
}

.expand-icon {
  color: var(--google-blue-dark);
  transition:
    transform 0.3s ease,
    color 0.2s ease,
    background-color 0.2s ease;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.9;
  padding: 3px;
  border-radius: 50%;
  background-color: transparent;
}

.expand-icon:hover {
  color: var(--google-blue);
  opacity: 1;
  background-color: rgba(66, 133, 244, 0.1);
  transform: scale(1.05);
}

.expand-icon.expanded {
  transform: rotate(180deg);
}

.expand-icon.expanded:hover {
  transform: rotate(180deg) scale(1.05);
}

.interface-options-content {
  margin-top: 10px;
  transition: all 0.3s ease;
}

.interface-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}

.interface-option {
  padding: 12px;
  border: 1px solid var(--google-grey-200);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s ease;
}

.interface-option:hover {
  border-color: var(--google-blue-light);
}

.option-header {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.option-icon {
  font-size: 18px;
  color: var(--google-blue);
  margin-right: 6px;
}

.option-header strong {
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  color: var(--google-grey-900);
}

.option-description {
  font-size: 13px;
  color: var(--google-grey-700);
  line-height: 1.3;
  margin: 0;
}

.interface-options-note {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: var(--google-grey-100);
  border-radius: 6px;
  font-size: 12px;
  color: var(--google-grey-700);
}

.note-icon {
  font-size: 16px;
  color: var(--google-blue);
  margin-right: 6px;
}

/* Knowledge Legend */
.knowledge-legend {
  margin: 0 0 4px 0;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--google-grey-200);
  border-radius: 6px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  font-size: 12px;
}

.legend-title {
  font-weight: 600;
  color: var(--google-grey-700);
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  color: var(--google-grey-700);
  font-weight: 500;
}

.legend-line {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  margin-right: 4px;
}

.legend-line.easy {
  background-color: #10b981;
}

.legend-line.moderate {
  background-color: #f59e0b;
}

.legend-line.complex {
  background-color: #ef4444;
}

.legend-line.grounding {
  background-color: rgba(66, 165, 245, 0.7);
  border: 1px solid rgba(66, 165, 245, 0.8);
}

.action-bar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
}

/* Social sharing buttons */

/* Top header share placement */
.share-top {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 8px 0 24px 0;
  justify-content: center;
  color: var(--google-grey-700);
}

/* Bottom share placement */
.share-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 48px 0 8px 0;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--google-grey-600);
  opacity: 0.85;
}

/* Bottom share button styling */
.share-bottom .shr-btn {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  opacity: 0.7;
}

.share-bottom .shr-btn svg {
  width: 18px;
  height: 18px;
}

.share-bottom .shr-btn:hover {
  background: #f8f9fa;
  opacity: 1;
  transform: none;
  box-shadow: none;
}

/* Common share button styling */
.shr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f8f9fa;
  color: #5f6368;
  transition: all 0.2s ease;
  text-decoration: none;
  border: 1px solid #e8eaed;
}

.shr-btn:hover {
  background: #e8f0fe;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
}

.shr-btn:focus {
  outline: 2px solid var(--google-blue);
  outline-offset: 2px;
}

.shr-btn.shr-x {
  color: #1da1f2;
}

.shr-btn.shr-x:hover {
  background: #e3f2fd;
  color: #1976d2;
}

.shr-btn.shr-li {
  color: #0a66c2;
}

.shr-btn.shr-li:hover {
  background: #e3f2fd;
  color: #1565c0;
}

/* Mobile-only toggles - hidden on desktop */
.mobile-toggle {
  display: none;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .share-bottom {
    margin-top: 20px;
  }

  .shr-btn {
    width: 28px;
    height: 28px;
  }

  .shr-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Center Input and Output headers on mobile */
  .input-header,
  .output-header {
    justify-content: center;
    text-align: center;
  }

  /* Mobile panel controls - 2-column grid layout */
  .panel-controls {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 8px;
    row-gap: 8px;
    padding: 12px 16px;
    justify-items: stretch;
    align-items: center;
    border-top: 1px solid #e9ecef;
    background: #fafbfc;
  }

  /* Grid item styling for all controls */
  .panel-controls .model-select-container,
  .panel-controls .cache-toggle,
  .panel-controls .prompt-toggle.mobile-toggle,
  .panel-controls .raw-toggle.mobile-toggle {
    font-size: 12px !important;
    color: var(--google-grey-700) !important;
    font-weight: normal !important;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: none !important;
    text-decoration: none !important;
  }

  /* Hide desktop header toggles on mobile */
  .input-header .prompt-toggle,
  .output-header .raw-toggle {
    display: none;
  }

  /* Hide cache status text on mobile */
  .cache-status {
    display: none;
  }

  /* Standardized checkbox sizing */
  .panel-controls label input {
    width: 16px;
    height: 16px;
    margin-right: 4px !important;
  }

  /* Uniform checkbox appearance */
  .panel-controls .cache-toggle input,
  .panel-controls .prompt-toggle.mobile-toggle input,
  .panel-controls .raw-toggle.mobile-toggle input {
    appearance: auto;
    margin: 0 4px 0 0 !important;
    padding: 0;
    border: none;
    background: none;
    width: 16px !important;
    height: 16px !important;
  }

  /* Remove hover effects on mobile */
  .panel-controls .cache-toggle:hover,
  .panel-controls .prompt-toggle.mobile-toggle:hover,
  .panel-controls .raw-toggle.mobile-toggle:hover {
    color: var(--google-grey-700) !important;
    transition: none !important;
    transform: none !important;
  }

  /* Mobile disclaimer styling */
  .disclaimer-container {
    margin-top: 24px;
  }

  .disclaimer-box {
    font-size: 12px !important;
    padding: 10px 14px !important;
    background: #fafbfc !important;
    border-left: 3px solid #e8c547 !important;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.05) !important;
    border-radius: 8px !important;
    gap: 10px !important;
  }

  .disclaimer-icon {
    font-size: 16px !important;
    color: #e8c547 !important;
  }

  .disclaimer-text {
    color: #6b7280 !important;
    line-height: 1.4 !important;
  }
}

/* Position legend on the right - desktop only */
@media (min-width: 769px) {
  .clinical-significance-legend {
    position: absolute;
    right: 0;
    font-size: 0.8em;
  }
}

/* === MOBILE RESPONSIVE OPTIMIZATIONS === */

/* Mobile breakpoint for tablets and phones */
@media (max-width: 768px) {
  /* Smaller citation note on mobile */
  .citation-note {
    font-size: 12px;
    padding: 8px 14px;
    margin: 10px 0 0 0;
  }
  /* Page wrapper adjustments for mobile */
  .page-wrapper {
    padding: 16px;
    max-width: 100%;
  }

  /* Header optimization for mobile */
  .header-container h1 {
    margin-bottom: 8px;
    margin-top: 1.2rem; /* Reduce top margin to keep content above fold */
  }
}

/* Optional forced break for perfect balance on very narrow screens */
@media (max-width: 430px) {
  .brand-split {
    display: block; /* Forces line break on very narrow screens */
  }

  .sub-header {
    font-size: 16px;
  }

  /* Card padding optimization for mobile */
  .card {
    padding: 16px;
    border-radius: 8px;
  }

  .banner.card {
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
  }

  /* Keep side-by-side but optimize for mobile */
  .text-area-container {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  .large-text-area {
    height: clamp(300px, 55vh, 450px);
    min-height: 300px;
    font-size: 13px !important;
  }

  .output-container {
    height: clamp(300px, 55vh, 450px);
    min-height: 300px;
  }

  .output-text {
    font-size: 13px !important;
  }

  #prompt-output {
    height: clamp(300px, 55vh, 450px);
    min-height: 300px;
  }

  /* Compact tip text for mobile */
  .samples-tip {
    font-size: 12px !important;
    padding: 8px 12px !important;
    margin-top: 12px !important;
    line-height: 1.4 !important;
  }

  .output-container,
  .large-text-area,
  #prompt-output {
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
  }

  /* Mobile highlighting and touch interactions */
  .text-span {
    cursor: pointer !important;
    padding: 2px 1px !important;
    margin: 1px 0 !important;
    border-radius: 3px !important;
    transition: all 0.2s ease !important;
    /* Increase touch target size slightly */
    min-height: 18px !important;

    display: inline !important;
    white-space: normal !important; /* ensure wrapping inside span */
    overflow-wrap: anywhere !important; /* long words like "FDG/CT" */
    word-break: break-word !important; /* safety net */
    position: relative !important;
    touch-action: manipulation !important;
  }

  .text-span:hover,
  .text-span:active {
    background-color: rgba(66, 165, 245, 0.2) !important;
    outline: 1px solid rgba(66, 165, 245, 0.3) !important;
    transform: none !important; /* Disable transform on mobile */
  }

  /* On mobile, add subtle visual cue that elements are tappable */
  @media (hover: none) and (pointer: coarse) {
    .text-span {
      position: relative;
    }

    .text-span:active {
      transform: scale(0.98) !important;
      transition: transform 0.1s ease !important;
    }
  }

  .text-span.highlight {
    background-color: rgba(66, 165, 245, 0.35) !important;
    outline: 1px solid rgba(66, 165, 245, 0.5) !important;
    font-weight: 500 !important;
  }

  /* Input textarea selection - exactly match output highlighting */
  .large-text-area::selection {
    background-color: rgba(66, 165, 245, 0.35) !important;
    color: inherit !important;
  }

  .large-text-area::-moz-selection {
    background-color: rgba(66, 165, 245, 0.35) !important;
    color: inherit !important;
  }

  /* Header adjustments for mobile - make more compact */
  .input-header,
  .output-header {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 6px !important;
  }

  .input-header h2,
  .output-header h2 {
    font-size: 1em !important;
    margin: 0 !important;
  }

  /* Compact toggles for mobile headers */
  .prompt-toggle,
  .raw-toggle {
    font-size: 10px !important;
  }

  .prompt-toggle label,
  .raw-toggle label {
    font-size: 10px !important;
  }

  /* Make toggle labels specifically smaller */
  .prompt-toggle,
  .raw-toggle {
    color: var(--google-grey-700) !important;
    font-weight: 400 !important;
  }

  /* Control panels optimization for mobile */
  .panel-controls {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  /* ========== Mobile layout for Process button + legend ========== */
  .action-bar {
    display: flex; /* already in your base CSS */
    flex-direction: column; /* vertical stack */
    align-items: center; /* centre both items */
    gap: 32px;
    margin-top: 24px;
  }

  /* Process button - REDUCED SIZE FOR MOBILE */
  #predict-button {
    /* width 100% on small screens, but <=200px as you had */
    width: 100%;
    max-width: 180px;
    padding: 10px 16px;
    font-size: 14px;
    /* no position, no z-index, no order change needed */
  }

  /* Legend – full-width, centred text */
  .clinical-significance-legend {
    display: flex; /* keep the flex row */
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;

    width: 100%;
    max-width: 320px;
    text-align: center; /* labels do not hug the left */
    font-size: 0.75em; /* you already tested this */

    /* Normal flow item – no position / top / left / z-index */
  }

  .legend-item {
    font-size: 1em;
  }

  /* Interface options panel for mobile */
  .interface-options-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .interface-option {
    padding: 12px !important;
  }

  /* Mobile toggle standardization */
  .cache-toggle,
  .raw-toggle,
  .prompt-toggle,
  .mobile-toggle {
    font-size: 12px !important;
    color: var(--google-grey-700) !important;
    font-weight: normal !important;
    transition: none !important;
  }

  .model-select-container {
    text-align: center !important;
  }

  .model-select-container label {
    font-size: 12px !important;
  }

  #model-select {
    padding: 6px !important;
    font-size: 12px !important;
  }

  /* Cache status text */
  .cache-status {
    font-size: 11px !important;
  }
}

/* Smaller mobile phones */
@media (max-width: 480px) {
  /* Even smaller citation note on small phones */
  .citation-note {
    font-size: 11px;
    padding: 6px 12px;
  }
  .page-wrapper {
    padding: 8px;
  }

  .header-container h1 {
    font-size: 22px;
  }

  .card {
    padding: 8px;
  }

  /* Even more compact for very small screens */
  .text-area-container {
    gap: 8px !important;
  }

  .large-text-area,
  .output-container,
  #prompt-output {
    height: clamp(250px, 50vh, 400px);
    min-height: 250px;
  }

  .large-text-area {
    font-size: 12px !important;
  }

  .output-text {
    font-size: 12px !important;
  }

  /* Even more compact tip for very small screens */
  .samples-tip {
    font-size: 11px !important;
    padding: 6px 10px !important;
    margin-top: 8px !important;
    line-height: 1.3 !important;
  }

  /* Smaller button for very small screens */
  #predict-button {
    max-width: 160px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
  }

  /* Tighter spacing for very small screens */
  .action-bar {
    gap: 28px; /* slightly smaller gap for tiny screens */
    margin-top: 20px;
  }

  .clinical-significance-legend {
    font-size: 0.65em; /* smaller text for tiny screens */
    max-width: 300px; /* slightly narrower */
  }

  .input-header h2,
  .output-header h2 {
    font-size: 0.9em !important;
  }

  /* Extra small toggle labels for tiny screens */
  .prompt-toggle,
  .raw-toggle {
    font-size: 9px !important;
  }

  .prompt-toggle label,
  .raw-toggle label {
    font-size: 9px !important;
  }
}

/* Simple Error Message Styling */
.error-message-simple {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 24px;
  margin: 16px 0;
  text-align: center;
  animation: fadeIn 0.3s ease-in;
}

.error-message-simple h3 {
  color: #991b1b;
  margin: 0 0 16px 0;
  font-size: 1.35rem;
  font-weight: 600;
  font-family: 'Google Sans', sans-serif;
}

.error-message-simple p {
  margin: 0 0 12px 0;
  line-height: 1.6;
  color: #7f1d1d;
}

.error-message-simple strong {
  color: #991b1b;
  font-weight: 600;
}

.error-message-simple .suggestion {
  color: #92400e;
  font-style: italic;
  margin-bottom: 20px;
}

.error-message-simple .deploy-note {
  background-color: #fef3c7;
  border-radius: 6px;
  padding: 12px;
  margin-top: 16px;
  font-size: 0.9rem;
  color: #78350f;
}

.error-message-simple .deploy-note strong {
  color: #92400e;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Copy and clear button overlays always use light mode styling */
/* Error messages always use light mode styling */

/* Knowledge UI Styles */
.knowledge-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.knowledge-item {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 4px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.knowledge-item:hover {
  background-color: var(--google-grey-100);
  transform: translateX(2px);
}

.knowledge-item.symptom-item {
  border-left-color: var(--error-color);
}

.knowledge-item.part-item {
  border-left-color: var(--warning-color);
}

.knowledge-item.fix-item {
  border-left-color: var(--success-color);
}

.knowledge-item.section-item {
  border-left-color: var(--google-green);
  background-color: rgba(34, 197, 94, 0.1);
}

/* Difficulty-based styling */
.knowledge-item[data-difficulty="easy"] {
  background-color: rgba(16, 185, 129, 0.1);
}

.knowledge-item[data-difficulty="moderate"] {
  background-color: rgba(245, 158, 11, 0.1);
}

.knowledge-item[data-difficulty="complex"] {
  background-color: rgba(239, 68, 68, 0.1);
}

.knowledge-item[data-difficulty="professional_only"] {
  background-color: rgba(139, 92, 246, 0.1);
}

/* Related highlighting */
.knowledge-item.related-highlight {
  background-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

/* Section headers */
.section-header {
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--google-blue-dark);
  margin: 24px 0 12px 0;
  padding: 8px 0;
  border-bottom: 2px solid var(--google-blue-light);
}

/* Highlighted input text */
.highlighted-input {
  background-color: white;
  border: 1px solid var(--google-grey-light);
  border-radius: 4px;
  padding: 1rem;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
  min-height: 200px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  position: relative;
}

.highlighted-input .highlight {
  background-color: var(--google-yellow);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.highlighted-input .highlight:hover {
  background-color: var(--google-orange);
}

.highlight {
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.highlight:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.highlight-symptom {
  background-color: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.highlight-part {
  background-color: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.highlight-fix {
  background-color: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.highlight-section {
  background-color: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(37, 99, 235, 0.4);
}

/* Difficulty-based highlighting */
.highlight.difficulty-easy {
  background-color: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.6);
}

.highlight.difficulty-moderate {
  background-color: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.6);
}

.highlight.difficulty-complex {
  background-color: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
}

.highlight.difficulty-professional_only {
  background-color: rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.6);
}

/* Loading overlay updates */
.loader-text .loader-message {
  color: var(--google-blue-dark);
}

/* Button styling updates */
#extract-button {
  background-color: var(--google-blue);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

#extract-button:hover:not(:disabled) {
  background-color: var(--google-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#extract-button:disabled {
  background-color: var(--google-grey-200);
  color: var(--google-grey-700);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.5;
}

#extract-button:not(:disabled) {
  opacity: 1;
  cursor: pointer;
}

/* Relationship tooltip */
.relationship-tooltip {
  background: white;
  border: 2px solid var(--google-blue);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--google-grey-900);
}

.relationship-tooltip.simple-tooltip {
  border-color: var(--google-grey-400);
  max-width: 250px;
  padding: 12px;
}

.relationship-tooltip strong {
  color: var(--google-blue-dark);
}

.relationship-tooltip small {
  color: var(--google-grey-700);
  font-style: italic;
}

/* Selected knowledge item */
.knowledge-item.selected-item {
  background-color: rgba(37, 99, 235, 0.2);
  border-left-color: var(--google-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
  transform: translateX(4px);
}

.knowledge-item.overall-fix-item {
  border-left-color: var(--google-orange);
  background-color: rgba(245, 158, 11, 0.1);
}





.relationship-tooltip .related-group {
  margin-bottom: 0.75rem;
}

.relationship-tooltip .related-group:last-child {
  margin-bottom: 0;
}

.relationship-tooltip .related-group ul {
  margin: 0.25rem 0 0 0;
  padding-left: 1rem;
}

.relationship-tooltip .related-group li {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.relationship-tooltip .relationship-type {
  color: var(--google-grey);
  font-style: italic;
  font-size: 0.8rem;
}

.knowledge-item .item-content {
  cursor: pointer;
  padding: 0.75rem;
  transition: background-color 0.2s ease;
  position: relative;
}

.knowledge-item .item-content:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.knowledge-item .item-content::after {
  content: "▼";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--google-grey);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.knowledge-item.selected-item .item-content::after {
  transform: translateY(-50%) rotate(180deg);
}

.relationships-dropdown {
  background-color: rgba(243, 244, 246, 0.8);
  border-top: 1px solid var(--google-grey-light);
  padding: 1rem;
  margin: 0 0.75rem 0.75rem 0.75rem;
  border-radius: 0 0 4px 4px;
  font-size: 0.9rem;
}

.relationships-content {
  max-height: 300px;
  overflow-y: auto;
}

.no-relationships {
  color: var(--google-grey);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.related-group {
  margin-bottom: 1rem;
}

.related-group:last-child {
  margin-bottom: 0;
}

.related-group strong {
  color: var(--google-blue);
  display: block;
  margin-bottom: 0.5rem;
}

.related-group ul {
  margin: 0;
  padding-left: 1.5rem;
}

.related-group li {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.relationship-type {
  color: var(--google-grey);
  font-style: italic;
  font-size: 0.8rem;
}
