.ssafun-poly {
  --ssafun-text: #13263f;
  --ssafun-muted: #4c6685;
  --poly-shell: #f7faff;
  --poly-card: #ffffff;
  --poly-border: #d9e4f4;
  --poly-text: #13263f;
  --poly-muted: #4c6685;
  --poly-primary: #7b3fc8;
  --poly-primary-dark: #6131a0;
  --poly-accent: #e9712c;
}

.ssafun-poly,
.ssafun-poly p,
.ssafun-poly li,
.ssafun-poly span,
.ssafun-poly strong,
.ssafun-poly label {
  color: var(--poly-text) !important;
  -webkit-text-fill-color: currentColor !important;
}

.ssafun-poly h2,
.ssafun-poly h3,
.ssafun-poly h4 {
  color: #1f3f68 !important;
  -webkit-text-fill-color: #1f3f68 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

.ssafun-poly .poly-shell {
  max-width: 980px;
  margin: 20px auto;
  border: 1px solid var(--poly-border);
  border-radius: 20px;
  padding: 16px;
  background:
    radial-gradient(680px 260px at 100% -10%, rgba(123, 63, 200, 0.12), transparent 65%),
    radial-gradient(560px 260px at 0% 115%, rgba(233, 113, 44, 0.08), transparent 60%),
    var(--poly-shell);
  box-shadow: 0 10px 22px rgba(15, 40, 73, 0.12);
}

.ssafun-poly .poly-hero h2 {
  margin: 0 0 8px;
  color: #4e2798 !important;
  -webkit-text-fill-color: #4e2798 !important;
}

.ssafun-poly .poly-hero p {
  margin: 0 0 10px;
  color: var(--poly-muted) !important;
}

.ssafun-poly .poly-progress {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--poly-border);
  background: #edf3fc;
  margin-bottom: 12px;
}

.ssafun-poly .poly-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8f53db, #6f37ba);
  transition: width 0.25s ease;
}

.ssafun-poly .poly-question {
  border: 1px solid var(--poly-border);
  border-radius: 12px;
  background: var(--poly-card);
  padding: 12px;
}

.ssafun-poly .poly-question h3 {
  margin: 0 0 10px;
  color: #213b63 !important;
  -webkit-text-fill-color: #213b63 !important;
  font-size: 1.06rem;
}

.ssafun-poly .poly-options {
  display: grid !important;
  gap: 8px;
}

.ssafun-poly .poly-options label {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border: 1px solid #d9e4f4;
  border-radius: 10px;
  background: #f9fbff;
  padding: 10px;
  cursor: pointer;
  margin: 0 !important;
  color: #1f3f68 !important;
  -webkit-text-fill-color: #1f3f68 !important;
}

.ssafun-poly .poly-options label:hover {
  border-color: #bdd0eb;
  background: #f2f7ff;
}

.ssafun-poly .poly-options label span {
  color: #1f3f68 !important;
  -webkit-text-fill-color: #1f3f68 !important;
}

.ssafun-poly .poly-nav,
.ssafun-poly .poly-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ssafun-poly .poly-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ssafun-poly .poly-actions button {
  width: 100%;
}

.ssafun-poly .poly-status,
.ssafun-poly .poly-email-status,
.ssafun-poly .poly-feedback-status {
  margin-top: 10px;
  color: var(--poly-muted) !important;
}

.ssafun-poly .poly-results,
.ssafun-poly .poly-card {
  margin-top: 14px;
  border: 1px solid var(--poly-border);
  border-radius: 12px;
  background: var(--poly-card);
  padding: 12px;
}

.ssafun-poly .poly-card ul li,
.ssafun-poly .poly-card p {
  color: #27496f !important;
  -webkit-text-fill-color: #27496f !important;
}

.ssafun-poly .poly-results h3 {
  margin: 0 0 8px;
  color: #253e64 !important;
}

.ssafun-poly .poly-overall {
  margin: 0 0 10px;
  color: var(--poly-text) !important;
  font-weight: 700;
}

.ssafun-poly .poly-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ssafun-poly .poly-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.ssafun-poly .poly-meta-card {
  border: 1px solid #d7e3f4;
  border-radius: 10px;
  background: #f9fbff;
  padding: 8px;
  text-align: center;
}

.ssafun-poly .poly-meta-card span {
  display: block;
  color: #5a6f8c !important;
  font-size: 0.82rem;
}

.ssafun-poly .poly-meta-card strong {
  color: #1f3f68 !important;
  font-size: 1.08rem;
}

.ssafun-poly .poly-category {
  border: 1px solid #d7e3f4;
  border-radius: 10px;
  background: #f9fbff;
  padding: 9px;
}

.ssafun-poly .poly-category h4 {
  margin: 0 0 4px;
  color: #25426b !important;
  font-size: 0.92rem;
}

.ssafun-poly .poly-category p {
  margin: 0;
  color: #446082 !important;
  font-size: 0.9rem;
}

.ssafun-poly .poly-insights {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ssafun-poly .poly-insight-card {
  border: 1px solid #d7e3f4;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}

.ssafun-poly .poly-insight-card h4 {
  margin: 0 0 8px;
  color: #28456e !important;
}

.ssafun-poly .poly-insight-card ul {
  margin: 0;
  padding-left: 18px;
}

.ssafun-poly .poly-plan {
  margin-top: 10px;
  border: 1px solid #d7e3f4;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}

.ssafun-poly .poly-plan h4 {
  margin: 0 0 8px;
  color: #28456e !important;
}

.ssafun-poly .poly-plan ul {
  margin: 0 0 10px;
  padding-left: 18px;
}

.ssafun-poly .poly-plan ul:last-child {
  margin-bottom: 0;
}

.ssafun-poly .poly-email {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dce6f5;
}

.ssafun-poly .poly-email label {
  display: block;
  font-weight: 700;
  color: #28456e !important;
}

.ssafun-poly .poly-history-wrap {
  margin-top: 10px;
  border-top: 1px solid #dce6f5;
  padding-top: 10px;
}

.ssafun-poly .poly-history-wrap h4 {
  margin: 0 0 6px;
  color: #28456e !important;
}

.ssafun-poly .poly-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ssafun-poly .poly-history-table th,
.ssafun-poly .poly-history-table td {
  border: 1px solid #dce6f5;
  padding: 6px 8px;
  text-align: left;
}

.ssafun-poly .poly-history-table th {
  background: #eef4ff;
  color: #25426b !important;
}

.ssafun-poly .poly-history-empty {
  margin: 0;
  color: #5f7391 !important;
}

.ssafun-poly .poly-collapse-toggle {
  width: 100%;
  margin-top: 8px;
  text-align: left;
  background: #efe5fb;
  border: 1px solid #d2b9f2;
  color: #582d99 !important;
}

.ssafun-poly .poly-collapse {
  display: none;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #e1eaf8;
  border-radius: 10px;
  background: #fafcff;
}

.ssafun-poly .poly-feedback-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  border-radius: 999px;
  min-width: 90px;
  background: linear-gradient(180deg, #f98f43 0%, #e9712c 100%);
  border-color: #d86420;
}

.ssafun-poly .poly-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1001;
}

.ssafun-poly .poly-modal.is-open { display: block; }
.ssafun-poly .poly-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 36, 0.45);
}
.ssafun-poly .poly-modal-dialog {
  position: relative;
  z-index: 2;
  width: min(560px, 92vw);
  margin: 8vh auto 0;
  border: 1px solid var(--poly-border);
  border-radius: 12px;
  background: #fff;
}
.ssafun-poly .poly-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e1eaf8;
  padding: 10px 12px;
}
.ssafun-poly .poly-modal-body {
  padding: 12px;
}
.ssafun-poly .poly-modal-body textarea {
  min-height: 120px;
}

@media (max-width: 760px) {
  .ssafun-poly .poly-category-grid,
  .ssafun-poly .poly-meta,
  .ssafun-poly .poly-insights {
    grid-template-columns: 1fr;
  }
  .ssafun-poly .poly-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .ssafun-poly .poly-actions {
    grid-template-columns: 1fr;
  }
}

/* SSA dark-neon production polish. Keep this late in the cascade. */
.ssafun-poly {
  --poly-shell: rgba(3, 8, 18, 0.98);
  --poly-card: rgba(8, 18, 34, 0.96);
  --poly-border: rgba(45, 212, 191, 0.36);
  --poly-text: #f4fdff;
  --poly-muted: #dbeafe;
  --poly-primary: #2dd4bf;
  --poly-primary-dark: #0f766e;
  --poly-accent: #38bdf8;
  color-scheme: dark;
}

.ssafun-poly,
.ssafun-poly p,
.ssafun-poly li,
.ssafun-poly span,
.ssafun-poly strong,
.ssafun-poly label,
.ssafun-poly input,
.ssafun-poly textarea,
.ssafun-poly button,
.ssafun-poly td,
.ssafun-poly th {
  color: #f4fdff !important;
  -webkit-text-fill-color: currentColor !important;
}

.ssafun-poly h2,
.ssafun-poly h3,
.ssafun-poly h4 {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: 0 0 12px rgba(45, 212, 191, 0.22) !important;
}

.ssafun-poly .poly-shell {
  border-color: rgba(45, 212, 191, 0.44);
  background:
    radial-gradient(680px 260px at 100% -10%, rgba(56, 189, 248, 0.16), transparent 65%),
    radial-gradient(560px 260px at 0% 115%, rgba(45, 212, 191, 0.12), transparent 60%),
    rgba(3, 8, 18, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}

.ssafun-poly .poly-progress,
.ssafun-poly .poly-question,
.ssafun-poly .poly-results,
.ssafun-poly .poly-card,
.ssafun-poly .poly-meta-card,
.ssafun-poly .poly-category,
.ssafun-poly .poly-insight-card,
.ssafun-poly .poly-plan,
.ssafun-poly .poly-reflection,
.ssafun-poly .poly-collapse,
.ssafun-poly .poly-modal-dialog {
  border-color: rgba(45, 212, 191, 0.34);
  background:
    radial-gradient(circle at 8% 0%, rgba(56, 189, 248, 0.1), transparent 34%),
    rgba(8, 18, 34, 0.96);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
}

.ssafun-poly .poly-progress {
  background: rgba(2, 6, 23, 0.82);
}

.ssafun-poly .poly-progress-bar {
  background: linear-gradient(90deg, #2dd4bf, #38bdf8);
}

.ssafun-poly .poly-options label,
.ssafun-poly .poly-history-table th,
.ssafun-poly .poly-history-table td,
.ssafun-poly .poly-modal-body textarea,
.ssafun-poly input[type="email"] {
  border-color: rgba(125, 211, 252, 0.32);
  background: rgba(2, 6, 23, 0.74);
}

.ssafun-poly .poly-options label:hover {
  border-color: rgba(45, 212, 191, 0.72);
  background: rgba(8, 47, 73, 0.74);
}

.ssafun-poly .poly-reflection {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
}

.ssafun-poly .poly-reflection h4 {
  margin: 0 0 8px;
}

.ssafun-poly .poly-reflection ul {
  margin: 0;
  padding-left: 18px;
}

.ssafun-poly .poly-status,
.ssafun-poly .poly-email-status,
.ssafun-poly .poly-feedback-status,
.ssafun-poly .poly-history-empty {
  color: #dbeafe !important;
}

.ssafun-poly .poly-collapse-toggle,
.ssafun-poly .poly-feedback-btn,
.ssafun-poly .poly-nav button,
.ssafun-poly .poly-actions button,
.ssafun-poly .poly-email-send,
.ssafun-poly .poly-feedback-send,
.ssafun-poly .poly-modal-close {
  border-color: rgba(45, 212, 191, 0.56);
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.42), rgba(14, 116, 144, 0.42));
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.16);
}

.ssafun-poly .poly-modal-backdrop {
  background: rgba(2, 6, 23, 0.76);
}

.ssafun-poly .poly-modal-header,
.ssafun-poly .poly-email,
.ssafun-poly .poly-history-wrap {
  border-color: rgba(45, 212, 191, 0.24);
}

/* Final hard stop for dark-on-dark option text after shared shell overrides. */
body .ssafun-poly.ssafun-poly :is(.poly-question, .poly-options label, .poly-options label span, .poly-results, .poly-card, .poly-category, .poly-meta-card, .poly-insight-card, .poly-plan, .poly-reflection, .poly-collapse, .poly-modal-dialog, .poly-modal-dialog *) {
  color: #f4fdff !important;
  -webkit-text-fill-color: #f4fdff !important;
}

body .ssafun-poly.ssafun-poly :is(.poly-status, .poly-email-status, .poly-feedback-status, .poly-history-empty, .poly-card p, .poly-card li, .poly-category p) {
  color: #dbeafe !important;
  -webkit-text-fill-color: #dbeafe !important;
}

body .ssafun-poly.ssafun-poly input[type="radio"],
body .ssafun-poly.ssafun-poly input[type="checkbox"] {
  accent-color: #2dd4bf !important;
}

/* Final answer-control guard: keep the poly quiz answers compact and readable
   after shared neon card overrides. */
body .ssafun-poly.ssafun-poly :is(label, legend, span, input, button, a) {
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  letter-spacing: 0 !important;
  word-break: normal !important;
}

body .ssafun-poly.ssafun-poly .poly-options {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

body .ssafun-poly.ssafun-poly .poly-options > label {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 10px 12px !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
}

body .ssafun-poly.ssafun-poly .poly-options input[type="radio"] {
  flex: 0 0 18px !important;
  display: inline-block !important;
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  position: static !important;
}

body .ssafun-poly.ssafun-poly .poly-options > label > span {
  display: block !important;
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  color: #f8feff !important;
  -webkit-text-fill-color: #f8feff !important;
  line-height: 1.38 !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
}

@media (max-width: 760px) {
  body .ssafun-poly.ssafun-poly .poly-options {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
