/* Shared controls and neutral windows for the static and React apps. */
:root {
  --action-blue: #1d4ed8;
  --action-purple: #6d28d9;
  --action-teal: #0f766e;
  --action-red: #b91c1c;
}
button, .w3-button { touch-action: manipulation; }
button:focus-visible, .w3-button:focus-visible, a:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}
button:disabled, button[aria-disabled="true"], .w3-button:disabled {
  opacity: .48;
  cursor: not-allowed;
  box-shadow: none;
}
.primary-button, .setup-primary, .flow-setup-modal button.w3-button,
.sielpa-modal-action {
  min-height: 44px;
  border: 1px solid var(--action-blue);
  border-radius: 10px;
  background: var(--action-blue) !important;
  color: #fff !important;
  font-weight: 750;
}
.secondary-button, .sielpa-modal-secondary {
  min-height: 44px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e40af;
}
.w3-button:not(.w3-display-topright) { border-radius: 10px; min-height: 44px; }
.w3-button.w3-blue { background: var(--action-blue) !important; color: #fff !important; }
.w3-button.w3-purple, .premium-action,
.hearBTN, #hear.primary-button {
  background: var(--action-purple) !important;
  border-color: var(--action-purple);
  color: #fff !important;
}
.w3-button.w3-green, .speak-action, .speakBTN {
  background: var(--action-teal) !important;
  border-color: var(--action-teal);
  color: #fff !important;
}
.w3-button.w3-red, .stop-action, .stopBTN {
  background: var(--action-red) !important;
  border-color: var(--action-red);
  color: #fff !important;
}
.hearBTN, .speakBTN, .stopBTN {
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
  text-shadow: none;
  box-shadow: none;
}
.sielpa-language-toggle button.is-active, .language-toggle button.is-active {
  background: var(--action-blue);
  border-color: var(--action-blue);
  color: #fff;
}
.sielpa-modal-close, .whats-new-close { min-width: 44px; min-height: 44px; }
.w3-modal:not(.flow-setup-modal) > .w3-modal-content,
.sielpa-modal-panel, .plus-upgrade-dialog, .sielpa-enquiry {
  border: 1px solid #dbe2ea;
  border-radius: 16px;
  background: #fff;
}
/* Decorative strips belong on controls, not on window frames. */
.w3-modal > .w3-modal-content > .w3-container[style*="background-color"] {
  background: #fff !important;
  color: #172536;
}
@media (hover: hover) {
  .primary-button:not(:disabled):hover, .setup-primary:not(:disabled):hover,
  .sielpa-modal-action:hover { filter: brightness(.9); }
  .hearBTN:not(:disabled):hover, .speakBTN:not(:disabled):hover,
  .stopBTN:not(:disabled):hover, .w3-button:not(:disabled):hover {
    filter: brightness(.92);
    opacity: 1;
  }
}

/* Summary feedback uses the same layout in both versions of the app. */
.summary-feedback {
  box-sizing: border-box;
  width: min(680px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 1px solid #dbe2ea;
  border-radius: 18px;
  background: #fff;
  color: #172536;
  box-shadow: 0 24px 70px #0f172a33;
  font: 15px/1.55 Inter, system-ui, sans-serif;
}
.summary-feedback-header { position: relative; padding: 22px 24px 16px; background: #fff; }
.summary-feedback-kicker { margin: 0 50px 6px 0; color: #64748b; font-size: 12px; font-weight: 750; letter-spacing: .04em; }
.summary-feedback h2, .summary-feedback h3 { color: #172536; text-align: left; }
.summary-feedback #advice_head, .summary-feedback #summary-advice-title { margin: 0 44px 16px 0; font-size: clamp(22px, 4vw, 28px); line-height: 1.2; font-weight: 750; }
.summary-feedback-close, .summary-feedback .writing-advice-close {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid #e2e8f0; border-radius: 10px;
  background: #f8fafc; color: #475569; font-size: 26px; cursor: pointer;
}
.summary-feedback-tabs { display: flex; gap: 8px; }
.summary-feedback-tabs button {
  flex: 1; min-height: 44px; padding: 10px 12px;
  border: 1px solid #bfdbfe; border-radius: 10px;
  background: #eff6ff; color: #1e40af; font: inherit; font-weight: 750; cursor: pointer;
}
.summary-feedback-tabs button:last-child { border-color: #ddd6fe; background: #f5f3ff; color: #5b21b6; }
.summary-feedback-tabs button[aria-pressed="true"] { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.summary-feedback-tabs button:last-child[aria-pressed="true"] { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.summary-feedback-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 24px 22px; }
.summary-feedback-status { display: inline-flex; padding: 5px 10px; margin: 0 0 14px; border-radius: 6px; background: #fff7ed; color: #9a3412; font-weight: 750; font-size: 13px; }
.summary-feedback-status.is-good { background: #ecfdf5; color: #065f46; }
.summary-feedback-status.is-empty { background: #f1f5f9; color: #475569; }
.summary-feedback-copy, .summary-feedback #advice_bun { margin: 0 0 18px; text-align: left; font-size: 16px; font-weight: 450; line-height: 1.6; }
.summary-feedback-chart { display: grid; gap: 12px; margin: 18px 0 0; }
.summary-feedback-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(100px, 2fr) auto; gap: 12px; align-items: center; font-size: 13px; }
.summary-feedback-track { height: 10px; border-radius: 6px; background: #f1f5f9; overflow: hidden; }
.summary-feedback-track span { display: block; height: 100%; border-radius: inherit; background: #94a3b8; }
.summary-feedback-track .current { background: #1d4ed8; }
.summary-feedback-row strong { min-width: 34px; color: #334155; text-align: right; font-size: 14px; }
.summary-feedback #TextHolder, .summary-feedback .writing-advice-feedback { margin: 20px 0 0; padding: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; overflow-wrap: anywhere; }
.summary-feedback #FeedbackText { margin: 0; }
.summary-feedback .sendtoThes, .summary-feedback .is-overused { color: #9f1239; background: #ffe4e6; border-radius: 3px; }
.summary-feedback-footer { flex-shrink: 0; padding: 14px 24px; border-top: 1px solid #e2e8f0; background: #fff; }
.summary-feedback-return { width: 100%; min-height: 46px; padding: 11px 16px; border: 1px solid #0f766e; border-radius: 10px; background: #0f766e; color: #fff; font: inherit; font-weight: 750; cursor: pointer; }
@media (max-width: 440px) {
  .summary-feedback-header { padding: 18px 16px 14px; }
  .summary-feedback-body { padding: 4px 16px 18px; }
  .summary-feedback-footer { padding: 12px 16px; }
  .summary-feedback-row { gap: 8px; grid-template-columns: minmax(76px, 1fr) minmax(70px, 1.25fr) auto; }
}
@media (prefers-reduced-motion: reduce) {
  button, .w3-button { transition: none !important; }
}
#advice_holder .summary-feedback {
  width: min(680px, 100%) !important;
  max-width: min(680px, 100%) !important;
  max-height: calc(100dvh - 40px);
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 auto !important;
}
/* The chart has no network dependency and no fixed empty canvas area. */
#advice_holder #graphDisplay { height: auto !important; width: 100%; max-width: 100%; }
/* Color remains readable on selected tool controls and status buttons. */
.tool-tab.is-active, .tool-tab.is-active:hover {
  background: var(--tab-accent-strong, var(--tool-accent-strong, #1d4ed8));
  border-color: transparent;
  color: #fff;
}
.choice-button.is-active, .vocabulary-mode-card.is-active {
  background: var(--tool-accent-strong, #047857);
  color: #fff;
}
.writing-advice-button { background: #1d4ed8; border-color: #1d4ed8; min-height: 44px; }
.writing-advice-button:hover { background: #1e40af; }
.summarizing-view .writing-advice-button:last-child { background: #6d28d9; border-color: #6d28d9; }
.summarizing-view .writing-advice-button:last-child:hover { background: #5b21b6; }
.writing-workspace > .w3-quarter .w3-red { background: #b91c1c !important; }
.writing-workspace > .w3-quarter .w3-green { background: #0f766e !important; }
.sielpa-language-toggle button, .language-toggle button, .level-switcher .level-link { min-height: 44px; }
