/**
 * TraitMind Test Framework Styles
 * Auto-advance quiz UI with progress bar and result card
 */

/* =============================================
   Container & Base
   ============================================= */
.tm-test-container {
    max-width: 1200px;
    margin: 40px auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--tm-text, #334155);
    background: var(--tm-white, #fff);
    border-radius: 20px;
    padding: 48px;
    box-shadow: 0 8px 40px rgba(91, 91, 214, 0.12);
    position: relative;
    overflow: hidden;
}

/* =============================================
   Progress Bar
   ============================================= */
.tm-test-progress-bar {
    height: 6px;
    background: #E2E8F0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.tm-test-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5B5BD6 0%, #7C7CF0 100%);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.tm-test-progress-text {
    text-align: center;
    font-size: 1.02rem;
    font-weight: 600;
    color: #94A3B8;
    margin-bottom: 32px;
    letter-spacing: 0.5px;
}

.tm-progress-current {
    color: #5B5BD6;
    font-size: 1.32rem;
}

/* =============================================
   Screens
   ============================================= */
.tm-test-screen {
    animation: tmFadeIn 0.35s ease-out;
}

@keyframes tmFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tm-test-screen.hidden {
    display: none !important;
}

/* =============================================
   Start Screen
   ============================================= */
.tm-test-start-icon {
    font-size: 4.8rem;
    text-align: center;
    margin-bottom: 24px;
    animation: tmBounce 2s ease-in-out infinite;
}

@keyframes tmBounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.tm-test-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: #1E293B;
    text-align: center;
    margin: 0 0 16px;
    line-height: 1.2;
}

.tm-test-desc {
    font-size: 1.2rem;
    color: #64748B;
    text-align: center;
    line-height: 1.7;
    margin: 0 0 12px;
}

.tm-test-count {
    text-align: center;
    font-size: 1.02rem;
    color: #94A3B8;
    margin: 0 0 32px;
    font-weight: 500;
}

/* =============================================
   Question Screen
   ============================================= */
.tm-test-question-text {
    font-size: 1.44rem;
    font-weight: 600;
    color: #1E293B;
    line-height: 1.6;
    margin-bottom: 28px;
    min-height: 60px;
}

.tm-iq-stimulus {
    display: block;
    width: 100%;
    max-width: 560px;
    margin: 18px auto 0;
    padding: 18px 16px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    color: #1E293B;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    line-height: 1.65;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tm-profile-form {
    display: grid;
    gap: 14px;
    max-width: 520px;
    margin: 0 auto;
}

.tm-profile-form label {
    display: grid;
    gap: 8px;
    text-align: left;
    color: #334155;
    font-weight: 800;
}

.tm-profile-form input,
.tm-profile-form select {
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 12px;
    padding: 13px 14px;
    color: #1E293B;
    background: #fff;
    font: inherit;
}

/* =============================================
   Options
   ============================================= */
.tm-test-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.tm-test-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.2rem;
    color: #334155;
    line-height: 1.5;
    text-align: left;
    width: 100%;
    font-family: inherit;
    position: relative;
}

.tm-test-option:hover {
    border-color: #5B5BD6;
    background: #EEF2FF;
    transform: translateX(4px);
}

.tm-test-option.selected {
    border-color: #5B5BD6;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #4545B8;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(91, 91, 214, 0.15);
}

.tm-test-option.selected::after {
    content: '✓';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #5B5BD6;
    font-weight: 700;
    font-size: 1.32rem;
}

.tm-test-option-marker {
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.96rem;
    font-weight: 700;
    color: #64748B;
    flex-shrink: 0;
    transition: all 0.2s ease;
    margin-top: 1px;
}

.tm-test-option.selected .tm-test-option-marker {
    background: #5B5BD6;
    color: white;
}

/* =============================================
   Navigation Buttons
   ============================================= */
.tm-test-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.tm-test-btn {
    display: inline-block;
    padding: 14px 36px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-align: center;
    text-decoration: none;
}

.tm-test-btn.hidden {
    display: none;
}

.tm-test-btn-start {
    background: linear-gradient(135deg, #5B5BD6 0%, #7C7CF0 100%);
    color: white;
    font-size: 1.32rem;
    padding: 16px 48px;
    box-shadow: 0 4px 20px rgba(91, 91, 214, 0.35);
}

.tm-test-btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(91, 91, 214, 0.45);
}

.tm-test-btn-next {
    background: #5B5BD6;
    color: white;
    box-shadow: 0 4px 16px rgba(91, 91, 214, 0.25);
}

.tm-test-btn-next:hover {
    background: #4545B8;
    transform: translateY(-1px);
}

.tm-test-btn-results {
    background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.tm-test-btn-results:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45);
}

.tm-test-btn-share {
    background: #E2E8F0;
    color: #334155;
}

.tm-test-btn-share:hover {
    background: #CBD5E1;
}

/* =============================================
   Loading
   ============================================= */
.tm-test-loading {
    text-align: center;
    padding: 40px 0;
}

.tm-test-loading p {
    color: #64748B;
    font-size: 1.2rem;
    margin-top: 20px;
}

.tm-test-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid #E2E8F0;
    border-top-color: #5B5BD6;
    border-radius: 50%;
    animation: tmSpin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes tmSpin {
    to { transform: rotate(360deg); }
}

/* =============================================
   Result Card
   ============================================= */
.tm-result-card {
    animation: tmFadeIn 0.5s ease-out;
}

.tm-result-badge {
    display: inline-block;
    background: linear-gradient(135deg, #5B5BD6 0%, #7C7CF0 100%);
    color: white;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    padding: 12px 32px;
    border-radius: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(91, 91, 214, 0.3);
}

.tm-result-name {
    font-size: 2.16rem;
    font-weight: 800;
    color: #1E293B;
    margin: 0 0 8px;
}

.tm-result-role {
    font-size: 1.2rem;
    color: #5B5BD6;
    font-weight: 600;
    margin: 0 0 24px;
}

.tm-result-divider {
    height: 2px;
    background: linear-gradient(90deg, #E2E8F0, transparent);
    margin: 24px 0;
}

.tm-result-desc {
    font-size: 1.2rem;
    color: #475569;
    line-height: 1.75;
    margin: 0 0 28px;
}

.tm-result-section {
    margin-bottom: 24px;
}

.tm-result-section-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px;
}

.tm-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tm-result-tag {
    display: inline-block;
    background: #EEF2FF;
    color: #4545B8;
    font-size: 1.02rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid #C7D2FE;
}

.tm-result-tag-career {
    background: #F0FDF4;
    color: #166534;
    border-color: #BBF7D0;
}

/* AI Placeholder */
.tm-result-ai-placeholder {
    background: #F8FAFC;
    border: 2px dashed #E2E8F0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 28px;
    text-align: center;
}

.tm-ai-placeholder-badge {
    display: inline-block;
    font-size: 1.02rem;
    font-weight: 700;
    color: #64748B;
    margin-bottom: 8px;
}

.tm-ai-placeholder-note {
    font-size: 1.02rem;
    color: #94A3B8;
    margin: 0;
}

/* Result Actions */
.tm-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================================
   Error State
   ============================================= */
.tm-test-error {
    text-align: center;
    color: #EF4444;
    padding: 40px;
    font-weight: 600;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 640px) {
    .tm-test-container {
        margin: 20px 16px;
        padding: 28px 24px;
        border-radius: 16px;
    }

    .tm-test-title {
        font-size: 1.68rem;
    }

    .tm-test-question-text {
        font-size: 1.26rem;
    }

    .tm-active-test-title {
        font-size: 0.84rem;
        padding: 6px 11px;
        margin-bottom: 12px;
    }

    .tm-test-btn {
        padding: 12px 28px;
        font-size: 1.14rem;
    }

    .tm-result-badge {
        font-size: 2.4rem;
        padding: 10px 24px;
    }

    .tm-result-name {
        font-size: 1.68rem;
    }
}

/* ============================================
   TEST FRAMEWORK v2 STYLES
   ============================================ */

/* Option buttons */
.tm-option-btn {
  display: block;
  width: 100%;
  padding: 18px 24px;
  margin-bottom: 12px;
  background: var(--tm-white);
  border: 2px solid var(--tm-light);
  border-radius: 12px;
  font-family: "Inter", sans-serif;
  font-size: 1.2rem;
  color: var(--tm-text);
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  line-height: 1.5;
}

.tm-option-btn:hover {
  border-color: var(--tm-primary);
  background: rgba(91,91,214,0.03);
  transform: translateX(4px);
}

.tm-option-btn.selected {
  border-color: var(--tm-primary);
  background: rgba(91,91,214,0.08);
  color: var(--tm-primary-dark);
  font-weight: 600;
}

/* Question text */
.tm-test-question-text {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.62rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin-bottom: 28px;
  line-height: 1.4;
  padding: 8px 0;
}

.tm-active-test-title {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0 0 14px;
  padding: 7px 13px;
  border: 1px solid rgba(91, 91, 214, 0.18);
  border-radius: 999px;
  background: rgba(91, 91, 214, 0.08);
  color: var(--tm-primary-dark);
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.tm-active-question-text {
  display: block;
}

/* Test screens */
.tm-test-screen {
  transition: opacity 0.3s ease;
}

.tm-test-screen.hidden {
  display: none;
}

/* Start screen */
.tm-test-start {
  text-align: center;
  padding: 60px 0;
}

.tm-test-start-icon {
  font-size: 4.8rem;
  margin-bottom: 24px;
}

.tm-test-count {
  color: #94A3B8;
  font-size: 1.14rem;
  margin-bottom: 32px;
}

/* Progress bar */
.tm-test-progress-bar {
  height: 6px;
  background: var(--tm-light);
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
}

.tm-test-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tm-primary), var(--tm-accent));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.tm-test-progress-text {
  text-align: center;
  font-size: 1.02rem;
  color: #94A3B8;
  margin-bottom: 24px;
}

/* Buttons */
.tm-test-btn {
  display: inline-block;
  background: var(--tm-primary);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 50px;
  font-family: "Inter", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tm-test-btn:hover {
  background: var(--tm-primary-dark);
  transform: translateY(-2px);
}

.tm-test-btn-start {
  font-size: 1.38rem;
  padding: 16px 48px;
}

.tm-test-btn-share {
  background: var(--tm-accent);
  color: var(--tm-dark);
}

.tm-test-btn-share:hover {
  background: #E6900A;
}

/* Loading spinner */
.tm-test-loading {
  text-align: center;
  padding: 80px 0;
}

.tm-test-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--tm-light);
  border-top-color: var(--tm-primary);
  border-radius: 50%;
  animation: tm-spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

@keyframes tm-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESULT CARD STYLES
   ============================================ */
.tm-result-card {
  background: var(--tm-white);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: var(--tm-shadow);
  text-align: center;
}

.tm-result-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--tm-primary), #7C7CF0);
  color: white;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 16px;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.tm-result-name {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--tm-dark);
  margin: 0 0 8px;
}

.tm-result-role {
  color: #64748B;
  font-size: 1.2rem;
  margin: 0 0 24px;
}

.tm-result-divider {
  width: 60px;
  height: 3px;
  background: var(--tm-primary);
  border-radius: 2px;
  margin: 0 auto 24px;
}

.tm-result-desc {
  color: var(--tm-text);
  font-size: 1.14rem;
  line-height: 1.7;
  margin: 0 0 32px;
  text-align: left;
}

/* Dimension bars */
.tm-result-dimensions {
  margin-bottom: 32px;
}

.tm-dim-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.tm-dim-label {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--tm-dark);
  min-width: 36px;
  text-align: center;
}

.tm-dim-bar {
  flex: 1;
  height: 8px;
  background: var(--tm-light);
  border-radius: 4px;
  overflow: hidden;
}

.tm-dim-fill {
  height: 100%;
  background: var(--tm-primary);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.tm-dim-fill-r {
  float: right;
}

.tm-dim-pct {
  font-size: 0.9rem;
  color: #94A3B8;
  min-width: 36px;
  text-align: center;
}

/* Result sections */
.tm-result-section {
  text-align: left;
  margin-bottom: 28px;
}

.tm-result-section h4 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin: 0 0 12px;
}

.tm-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tm-result-tag {
  display: inline-block;
  background: rgba(91,91,214,0.08);
  color: var(--tm-primary);
  font-size: 1.02rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 50px;
}

.tm-result-tag-career {
  background: rgba(245,158,11,0.1);
  color: #B45309;
}

.tm-result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

/* Result page comments */
.tm-result-page {
  max-width: 1200px;
  margin: 0 auto;
}

.tm-result-comments {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--tm-light);
}

.tm-result-comments h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin: 0 0 24px;
}

.tm-comments-placeholder {
  color: #94A3B8;
  font-size: 1.08rem;
  text-align: center;
  padding: 32px;
  background: var(--tm-bg);
  border-radius: 12px;
}

/* Test header in page */
.tm-test-header {
  text-align: center;
  margin-bottom: 40px;
}

.tm-test-header h1 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--tm-dark);
  margin: 0 0 8px;
}

.tm-test-header p {
  color: #64748B;
  font-size: 1.14rem;
  margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .tm-test-question-text { font-size: 1.38rem; }
  .tm-option-btn { padding: 16px 20px; font-size: 1.14rem; }
  .tm-result-card { padding: 28px 20px; }
  .tm-result-badge { font-size: 1.8rem; padding: 10px 20px; }
  .tm-result-name { font-size: 1.62rem; }
  .tm-result-actions { flex-direction: column; }
  .tm-test-btn { width: 100%; }
  .tm-dim-row { flex-wrap: wrap; gap: 4px; }
}
/* ============================================
   OVERVIEW SCREEN
   ============================================ */
.tm-overview {
  text-align: center;
  max-width: 1152px;
  margin: 0 auto;
  padding: 40px 0;
}

.tm-overview-icon { font-size: 4.8rem; margin-bottom: 20px; }

.tm-overview-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--tm-dark);
  margin: 0 0 16px;
}

.tm-overview-desc {
  color: #64748B;
  font-size: 1.2rem;
  line-height: 1.7;
  margin: 0 0 24px;
}

.tm-overview-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 28px;
  font-size: 1.08rem;
  color: #94A3B8;
}

.tm-overview-dims { margin-bottom: 32px; }

.tm-overview-dims h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin: 0 0 16px;
}

.tm-dim-chips {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.tm-dim-chip {
  background: rgba(91,91,214,0.08);
  color: var(--tm-primary);
  font-weight: 600;
  font-size: 1.02rem;
  padding: 8px 20px;
  border-radius: 50px;
  border: 1px solid rgba(91,91,214,0.15);
}

/* ============================================
   RESULT PAGE
   ============================================ */
.tm-result-type-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--tm-primary), #7C7CF0);
  color: white;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 3rem;
  font-weight: 800;
  padding: 16px 32px;
  border-radius: 16px;
  margin-bottom: 24px;
  letter-spacing: 3px;
}

.tm-result-dims { margin-bottom: 28px; }

.tm-dim-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tm-dl {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--tm-dark);
  min-width: 24px;
  text-align: center;
}

.tm-dbar {
  flex: 1;
  height: 8px;
  background: var(--tm-light);
  border-radius: 4px;
  overflow: hidden;
}

.tm-dfill {
  height: 100%;
  background: var(--tm-primary);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.tm-dfr { float: right; background: var(--tm-accent); }

.tm-dp {
  font-size: 0.9rem;
  color: #94A3B8;
  min-width: 32px;
  text-align: center;
}

.tm-rs { text-align: left; margin-bottom: 24px; }
.tm-rs h4 { font-family: "Plus Jakarta Sans", sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--tm-dark); margin: 0 0 12px; }
.tm-rtags { display: flex; flex-wrap: wrap; gap: 8px; }

.tm-rtag {
  display: inline-block;
  background: rgba(91,91,214,0.08);
  color: var(--tm-primary);
  font-size: 1.02rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 50px;
}

.tm-rtag-c { background: rgba(245,158,11,0.1); color: #B45309; }

/* All 16 types */
.tm-all-types { text-align: left; margin-bottom: 28px; }
.tm-all-types h4 { font-family: "Plus Jakarta Sans", sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--tm-dark); margin: 0 0 12px; }
.tm-type-list { display: flex; flex-wrap: wrap; gap: 6px; }

.tm-type-item {
  font-size: 0.94rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--tm-bg);
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 192px;
}

.tm-type-active {
  background: var(--tm-primary);
  color: white;
  font-weight: 600;
}

/* Result actions */
.tm-result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

.tm-btn-share {
  background: var(--tm-accent) !important;
  color: var(--tm-dark) !important;
}

.tm-btn-share:hover { background: #E6900A !important; }

/* Result page stats */
.tm-result-stats {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--tm-light);
}

.tm-result-stats h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin: 0 0 16px;
}

.tm-stats-placeholder {
  color: #94A3B8;
  font-size: 1.08rem;
  text-align: center;
  padding: 24px;
  background: var(--tm-bg);
  border-radius: 12px;
}

/* Share card */
#tm-share-card { background: white; border-radius: 20px; overflow: hidden; }

/* Responsive */
@media (max-width: 768px) {
  .tm-overview-title { font-size: 1.8rem; }
  .tm-result-type-badge { font-size: 2.1rem; padding: 12px 24px; }
  .tm-result-actions { flex-direction: column; }
  .tm-test-btn { width: 100%; }
  .tm-dim-row { flex-wrap: wrap; }
  .tm-type-item { max-width: 144px; font-size: 0.86rem; }
}

/* Overview dimension explanations */
.tm-dim-explain {
  margin-top: 20px;
  max-width: 576px;
  margin-left: auto;
  margin-right: auto;
}

.tm-dim-explain-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--tm-light);
  font-size: 1.06rem;
  text-align: left;
}

.tm-dim-explain-item strong {
  min-width: 44px;
  color: var(--tm-primary);
  font-weight: 700;
  flex-shrink: 0;
}

.tm-dim-explain-item span {
  color: #64748B;
  line-height: 1.5;
}

.tm-overview-purpose {
  margin-top: 20px;
  font-size: 1.08rem;
  color: #94A3B8;
  font-style: italic;
}

/* All 16 types compare grid */
.tm-all-types-compare {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--tm-light);
}

.tm-all-types-compare h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin: 0 0 20px;
  text-align: center;
}

.tm-compare-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tm-cmp-item {
  background: var(--tm-bg);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  transition: all 0.2s ease;
}

.tm-cmp-active {
  border-color: var(--tm-primary);
  background: rgba(91,91,214,0.06);
  box-shadow: 0 0 0 2px rgba(91,91,214,0.15);
}

.tm-cmp-type {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--tm-primary);
  margin-bottom: 4px;
}

.tm-cmp-active .tm-cmp-type {
  color: var(--tm-primary-dark);
}

.tm-cmp-name {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--tm-dark);
  margin-bottom: 2px;
  line-height: 1.3;
}

.tm-cmp-role {
  display: block;
  font-size: 0.84rem;
  color: #94A3B8;
  line-height: 1.3;
}

@media (max-width: 768px) {
  .tm-compare-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .tm-compare-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .tm-cmp-item { padding: 8px 4px; }
  .tm-cmp-type { font-size: 1.02rem; }
  .tm-cmp-name { font-size: 0.84rem; }
}

/* Statistics bars */
.tm-stats-total {
  color: #94A3B8;
  font-size: 1.02rem;
  text-align: center;
  margin-bottom: 20px;
}

.tm-stats-bars {
  max-width: 600px;
  margin: 0 auto;
}

.tm-stat-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tm-stat-type {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--tm-dark);
  min-width: 36px;
  text-align: right;
}

.tm-stat-bar {
  flex: 1;
  height: 20px;
  background: var(--tm-light);
  border-radius: 10px;
  overflow: hidden;
}

.tm-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tm-primary), #7C7CF0);
  border-radius: 10px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.tm-stat-pct {
  font-size: 0.9rem;
  color: #64748B;
  min-width: 70px;
  text-align: left;
}

/* Rich MBTI Overview Styles */
.tm-overview-rich {
  text-align: left;
  max-width: 1200px;
  margin: 0 auto;
}

.tm-ov-section {
  margin-bottom: 36px;
}

.tm-ov-section h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tm-dark);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tm-primary);
}

.tm-ov-section p {
  color: #475569;
  font-size: 1.14rem;
  line-height: 1.7;
  margin: 0;
}

.tm-ov-sub {
  color: #64748B !important;
  font-size: 1.08rem !important;
  margin-bottom: 24px !important;
}

/* Dimension Cards */
.tm-dim-card {
  background: var(--tm-white);
  border: 1px solid var(--tm-light);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.tm-dim-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.tm-dim-pair {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--tm-primary);
  background: rgba(91,91,214,0.08);
  padding: 4px 12px;
  border-radius: 6px;
}

.tm-dim-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--tm-dark);
}

.tm-dim-card-desc {
  color: #64748B !important;
  font-size: 1.02rem !important;
  margin-bottom: 16px !important;
}

.tm-dim-card-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tm-dim-card-side {
  background: var(--tm-bg);
  border-radius: 8px;
  padding: 16px;
}

.tm-dim-card-side strong {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.08rem;
  color: var(--tm-primary-dark);
  margin-bottom: 10px;
}

.tm-dim-card-side ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tm-dim-card-side li {
  font-size: 0.98rem;
  color: #475569;
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}

.tm-dim-card-side li::before {
  content: "•";
  color: var(--tm-primary);
  position: absolute;
  left: 4px;
}

@media (max-width: 768px) {
  .tm-dim-card-split { grid-template-columns: 1fr; }
  .tm-overview-rich { padding: 0 12px; }
  .tm-ov-section h3 { font-size: 1.32rem; }
}

/* Version Selector */
.tm-version-selector {
  margin: 24px 0;
  text-align: center;
}

.tm-version-selector h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.14rem;
  font-weight: 600;
  color: var(--tm-dark);
  margin: 0 0 12px;
}

.tm-version-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.tm-version-btn {
  background: var(--tm-white);
  border: 2px solid var(--tm-light);
  border-radius: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  min-width: 140px;
  font-family: "Inter", sans-serif;
}

.tm-version-btn:hover {
  border-color: var(--tm-primary);
  background: rgba(91,91,214,0.03);
}

.tm-version-active {
  border-color: var(--tm-primary) !important;
  background: rgba(91,91,214,0.08) !important;
}

.tm-v-name {
  display: block;
  font-weight: 700;
  font-size: 1.14rem;
  color: var(--tm-dark);
  margin-bottom: 4px;
}

.tm-v-meta {
  display: block;
  font-size: 0.94rem;
  color: #94A3B8;
}

/* Separator between card and content */
.tm-overview-rich {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 2px solid var(--tm-light);
}

/* Adjust start screen */
.tm-overview {
  text-align: center;
  max-width: 1152px;
  margin: 0 auto;
  padding: 20px 0;
}

.tm-result-comments-link {
  text-align: center;
  margin: 24px 0 8px;
}

.tm-result-comments-btn {
  display: inline-block;
  background: var(--tm-primary);
  color: white;
  padding: 12px 32px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
  transition: all 0.25s ease;
}

.tm-result-comments-btn:hover {
  background: var(--tm-primary-dark);
  transform: translateY(-2px);
  color: white;
}

.tm-comment-form-wrap {
  max-width: 672px;
  margin: 0 auto;
}

.tm-comment-form-wrap textarea,
.tm-comment-form-wrap input[type="text"],
.tm-comment-form-wrap input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--tm-light);
  border-radius: 10px;
  font-family: "Inter", sans-serif;
  font-size: 1.08rem;
  color: var(--tm-text);
  background: var(--tm-white);
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.tm-comment-form-wrap textarea:focus,
.tm-comment-form-wrap input:focus {
  outline: none;
  border-color: var(--tm-primary);
}

/* Enhanced comment form */
.tm-comment-form-wrap {
  max-width: 672px;
  margin: 0 auto;
  background: var(--tm-white);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--tm-shadow);
}

.tm-comment-form-wrap textarea,
.tm-comment-form-wrap input[type="text"],
.tm-comment-form-wrap input[type="email"] {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--tm-light);
  border-radius: 12px;
  font-family: "Inter", sans-serif;
  font-size: 1.14rem;
  color: var(--tm-text);
  background: var(--tm-bg);
  margin-bottom: 14px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.tm-comment-form-wrap textarea:focus,
.tm-comment-form-wrap input:focus {
  outline: none;
  border-color: var(--tm-primary);
  background: var(--tm-white);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.1);
}

.tm-comment-form-wrap textarea {
  min-height: 100px;
  resize: vertical;
}

.tm-comment-form-wrap .tm-test-btn {
  width: auto;
  min-width: 140px;
}

/* Keep result recommendation cards readable in light and dark themes. */
.tm-also-card,
.tm-also-card:visited {
  background: #fff !important;
  color: #1E293B !important;
  border-color: #E2E8F0 !important;
}

.tm-also-card,
.tm-also-card * {
  opacity: 1 !important;
}

.tm-also-card-name {
  color: #1E293B !important;
}

.tm-also-card-icon {
  opacity: 1 !important;
}

.tm-also-card:hover,
.tm-also-card:focus {
  background: #F8FAFC !important;
  color: #1E293B !important;
  border-color: #5B5BD6 !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-2px);
}

.tm-also-card:hover .tm-also-card-name,
.tm-also-card:focus .tm-also-card-name {
  color: #111827 !important;
}

@media (prefers-color-scheme: dark) {
  .tm-also-card,
  .tm-also-card:visited {
    background: #fff !important;
    color: #1E293B !important;
  }

  .tm-also-card:hover,
  .tm-also-card:focus {
    background: #F8FAFC !important;
    color: #1E293B !important;
  }
}

/* Final guard for result-page recommendation cards. Some mobile webviews keep
   visited/hover text-fill styles after touch, so reset parent and child text. */
html body .tm-result-page .tm-also-card,
html body .tm-result-page .tm-also-card:link,
html body .tm-result-page .tm-also-card:visited,
html body .tm-also-took .tm-also-card,
html body .tm-also-took .tm-also-card:link,
html body .tm-also-took .tm-also-card:visited {
  background: #fff !important;
  color: #1E293B !important;
  -webkit-text-fill-color: #1E293B !important;
  border-color: #E2E8F0 !important;
  opacity: 1 !important;
}

html body .tm-result-page .tm-also-card *,
html body .tm-also-took .tm-also-card * {
  opacity: 1 !important;
  visibility: visible !important;
  text-shadow: none !important;
  filter: none !important;
}

html body .tm-result-page .tm-also-card .tm-also-card-name,
html body .tm-also-took .tm-also-card .tm-also-card-name {
  color: #1E293B !important;
  -webkit-text-fill-color: #1E293B !important;
  font-weight: 700 !important;
}

html body .tm-result-page .tm-also-card:hover,
html body .tm-result-page .tm-also-card:focus,
html body .tm-result-page .tm-also-card:active,
html body .tm-also-took .tm-also-card:hover,
html body .tm-also-took .tm-also-card:focus,
html body .tm-also-took .tm-also-card:active {
  background: #F8FAFC !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  border-color: #5B5BD6 !important;
  opacity: 1 !important;
}

html body .tm-result-page .tm-also-card:hover .tm-also-card-name,
html body .tm-result-page .tm-also-card:focus .tm-also-card-name,
html body .tm-result-page .tm-also-card:active .tm-also-card-name,
html body .tm-also-took .tm-also-card:hover .tm-also-card-name,
html body .tm-also-took .tm-also-card:focus .tm-also-card-name,
html body .tm-also-took .tm-also-card:active .tm-also-card-name {
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  opacity: 1 !important;
}
