/* ==========================================================================
   GJ Practice - Ultra-Modern, Attractive Psychological Test Platform
   ========================================================================== */

:root {
  --bg-primary: #070d0a;
  --bg-secondary: #0e1713;
  --bg-card: rgba(14, 24, 19, 0.88);
  --bg-card-hover: rgba(22, 36, 29, 0.9);
  --bg-input: #08110c;
  --bg-muted: #1a2c22;
  --bg-subtle: #132019;
  
  --border-color: rgba(16, 185, 129, 0.14);
  --border-hover: rgba(212, 175, 55, 0.45);
  --border-active: #10b981;
  --border-gold: #d4af37;
  
  --text-primary: #f1f5f3;
  --text-secondary: #9cb5a5;
  --text-muted: #647f6f;
  
  --accent-cyan: #10b981;
  --accent-cyan-glow: rgba(16, 185, 129, 0.25);
  --accent-emerald: #10b981;
  --accent-gold: #eab308;
  --accent-brass: #d4af37;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-danger: #ef4444;
  --accent-danger-glow: rgba(239, 68, 68, 0.3);
  
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.25);
  --shadow-gold-glow: 0 0 25px rgba(212, 175, 55, 0.25);
  --shadow-red-glow: 0 0 35px rgba(239, 68, 68, 0.35);
}

[data-theme="light"] {
  --bg-primary: #f2f6f2;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.96);
  --bg-card-hover: #f7faf7;
  --bg-input: #ffffff;
  --bg-muted: #e2ebe2;
  --bg-subtle: #f1f6f1;
  
  --border-color: #cbd8cb;
  --border-hover: #82a382;
  --border-active: #047857;
  --border-gold: #b45309;
  
  --text-primary: #0d1e14;
  --text-secondary: #3b5745;
  --text-muted: #5e7b68;
  
  --accent-cyan: #047857;
  --accent-cyan-glow: rgba(4, 120, 87, 0.18);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px rgba(13, 30, 20, 0.08);
  --shadow-glow: 0 0 20px rgba(4, 120, 87, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  /* Ultra-Clear High Visibility Pakistan Army Background */
  background-image: 
    linear-gradient(180deg, rgba(6, 12, 9, 0.22) 0%, rgba(8, 16, 12, 0.28) 45%, rgba(6, 11, 8, 0.40) 100%),
    url('army_bg.jpg');
  background-size: cover, cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] body {
  background-image: 
    linear-gradient(180deg, rgba(242, 246, 242, 0.18) 0%, rgba(235, 242, 235, 0.26) 100%),
    url('army_bg.jpg');
  background-size: cover, cover;
  background-position: center top;
  background-attachment: fixed;
}

/* Test Mode Viewport Adaptation */
@media (min-width: 769px) and (min-height: 620px) {
  body.in-test-mode {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }
  
  body.in-test-mode .main-container {
    padding-top: 0.4rem !important;
    padding-bottom: 0.4rem !important;
    height: calc(100vh - 65px) !important;
    max-height: calc(100vh - 65px) !important;
    overflow: hidden !important;
    justify-content: center;
  }
  
  body.in-test-mode .test-view {
    height: 100% !important;
    max-height: 100% !important;
    min-height: unset !important;
    overflow: hidden !important;
    justify-content: center;
  }
}

body.in-test-mode {
  overflow-x: hidden;
}

body.in-test-mode .test-view {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 2rem;
  background: rgba(14, 24, 19, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.app-header-logo-img {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  background: transparent;
  border: none;
  box-shadow: none;
  display: block;
  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.45));
  transition: transform 0.25s ease;
}

[data-theme="light"] .app-header-logo-img {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.app-header-logo-img:hover {
  transform: scale(1.04);
}

.logo-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(56, 239, 125, 0.35));
  transition: transform 0.25s ease;
}

.logo-icon-wrap:hover {
  transform: scale(1.06);
}

.logo-svg-mark {
  display: block;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.1;
}

.brand-accent {
  background: linear-gradient(135deg, #00f2fe, #38ef7d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
}

.app-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Main Container */
.main-container {
  flex: 1;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
}

/* 3 Test Selector Buttons */
.test-type-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

.test-type-btn {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
}

.test-type-btn:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.test-type-btn.active {
  border-color: var(--accent-cyan);
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.12), rgba(17, 24, 39, 0.9));
  box-shadow: 0 0 25px var(--accent-cyan-glow);
}

.test-type-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.type-icon {
  font-size: 1.5rem;
  background: var(--bg-muted);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease;
}

.test-type-btn:hover .type-icon {
  transform: scale(1.08);
}

.type-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.type-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.type-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.35;
}

/* Validation Toast Alert */
.validation-alert {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(185, 28, 28, 0.2));
  border: 1.5px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fca5a5;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  animation: shakeAlert 0.4s ease-in-out;
  box-shadow: var(--shadow-red-glow);
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Setup View */
.setup-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.test-setup-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.section-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.section-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

/* Guideline Banner for Picture/Pointer */
.guideline-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(4, 120, 87, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guideline-badge {
  align-self: flex-start;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.guideline-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.55;
  font-weight: 500;
}

/* Tabs */
.tabs-header {
  display: flex;
  gap: 6px;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 1.1rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 9px 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: #34d399;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-active);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Sets Grid Container */
.sets-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.set-card {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.set-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-muted);
  transform: translateY(-2px);
}

.set-card.selected {
  border-color: var(--accent-cyan);
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.08), var(--bg-secondary));
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.set-card-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.set-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.set-count-pill {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.set-card.selected .set-count-pill {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.set-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.set-radio-indicator {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.set-card.selected .set-radio-indicator {
  border-color: var(--accent-cyan);
}

.radio-inner {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: transparent;
  transition: background 0.2s ease;
}

.set-card.selected .radio-inner {
  background: var(--accent-cyan);
}

/* Coming Soon Showcase Card */
.coming-soon-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.9));
  border: 1.5px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.coming-soon-glow {
  position: absolute;
  top: -50px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.coming-soon-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  animation: floatIcon 3s ease-in-out infinite;
}

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

.coming-soon-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.coming-soon-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.coming-soon-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.coming-soon-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-chip {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Custom Textarea */
.custom-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.custom-textarea {
  width: 100%;
  min-height: 110px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  transition: all 0.2s ease;
}

.custom-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.custom-input-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.custom-word-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.setting-select {
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.setting-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Selection Chip Buttons */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

/* Set Group Titles */
.set-group-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 0.5rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-group-title:first-child {
  margin-top: 0;
}

.set-group-title.negative-title {
  color: #f87171;
  margin-top: 1.25rem;
}

.chip-grid-small {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  width: 100%;
}

.chip-btn {
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  user-select: none;
  backdrop-filter: blur(8px);
}

.chip-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chip-btn.active {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.25), rgba(4, 120, 87, 0.4));
  border-color: var(--accent-emerald);
  color: #34d399;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35), inset 0 0 8px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.chip-btn.chip-highlight {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.chip-btn.chip-highlight:hover {
  border-color: rgba(239, 68, 68, 0.6);
  color: #fecaca;
}

.chip-btn.chip-highlight.active {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.25), rgba(185, 28, 28, 0.35));
  border-color: #ef4444;
  color: #fca5a5;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4), inset 0 0 8px rgba(239, 68, 68, 0.15);
}

/* Start Button */
.start-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
  color: #ffffff;
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  padding: 1rem 2rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(4, 120, 87, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.start-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #047857 100%);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5), 0 0 15px rgba(212, 175, 55, 0.35);
}

.start-btn:active {
  transform: translateY(0);
}

/* Test Hall Screen */
.test-view {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 72vh;
  position: relative;
}

.test-view.active {
  display: flex;
}

.test-top-bar {
  width: 100%;
  max-width: 780px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
}

.progress-counter {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.counter-highlight {
  color: #34d399;
  font-weight: 800;
  font-size: 1.05rem;
}

[data-theme="light"] .progress-counter {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a !important;
  border-color: #cbd5e1;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .progress-counter span {
  color: #0f172a;
}

[data-theme="light"] .counter-highlight {
  color: #047857 !important;
  font-weight: 900;
}

[data-theme="light"] #itemLabelText,
[data-theme="light"] #totalWordsNum {
  color: #0f172a !important;
  font-weight: 800;
}

.badge-tag {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.phase-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.phase-badge.observing {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.phase-badge.writing {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.test-controls-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Main Display Card (Pure Focus) */
.word-display-card {
  width: 100%;
  max-width: 780px;
  min-height: auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow-md);
  position: relative;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.word-display-card.transition-flash {
  animation: cardFlash 0.3s ease-out;
}

@keyframes cardFlash {
  0% { transform: scale(0.98); border-color: var(--accent-cyan); }
  100% { transform: scale(1); border-color: var(--border-color); }
}

.word-display-card.warning-tick {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.25);
}

.timer-circle-wrapper {
  position: relative;
  width: 58px;
  height: 58px;
  margin-bottom: 0.75rem;
}

.timer-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.timer-bg {
  fill: none;
  stroke: var(--bg-muted);
  stroke-width: 5.5;
}

.timer-progress {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* The Big Word */
.current-word {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8vw, 4.2rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.picture-card-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.picture-svg-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0 auto;
}

.picture-svg-box img,
.picture-story-image {
  max-width: 100%;
  max-height: min(48vh, 380px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: #0f172a;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform var(--transition-normal);
}

.picture-svg-box svg {
  width: 100%;
  max-width: 560px;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
}

.pointer-card-wrapper {
  width: 100%;
  max-width: 640px;
  padding: clamp(1rem, 3vw, 1.75rem);
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.pointer-quote-icon {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--accent-cyan);
  margin-bottom: -4px;
}

.pointer-prompt-text {
  font-size: clamp(1rem, 3.8vw, 1.25rem);
  font-weight: 600;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Typing Input Area */
.typing-box-container {
  width: 100%;
  max-width: 680px;
  margin-top: 1rem;
  box-sizing: border-box;
}

.typing-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-family: var(--font-sans);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.story-textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.55;
  font-family: var(--font-sans);
  resize: vertical;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.typing-input:focus, .story-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 18px var(--accent-cyan-glow);
}

.typing-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

/* Review View */
.review-view {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

.review-view.active {
  display: flex;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  padding: 1.25rem 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 2px;
}

.stat-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: 10px;
}

.review-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.review-table th, .review-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.wat-meaning-box {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.wat-meaning-en {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.wat-meaning-ur {
  color: #38bdf8;
  font-family: 'Segoe UI', Tahoma, 'Noto Nastaliq Urdu', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
}

.wat-olq-sentence {
  display: inline-block;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.32);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.2px;
}

.review-table th {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.review-actions-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Pre-Test Pen & Paper Readiness Modal (URGENT RED THEME)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1.25rem;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card.modal-alert-red {
  background: linear-gradient(165deg, #180d12, #111827);
  border: 2px solid #ef4444;
  border-radius: var(--radius-xl);
  max-width: 460px;
  width: 100%;
  padding: 2.2rem 2rem;
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.35), var(--shadow-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.modal-alert-glow {
  position: absolute;
  top: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.35) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.modal-icon-badge {
  font-size: 2.5rem;
  line-height: 1;
  background: rgba(239, 68, 68, 0.15);
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.modal-urgent-pill {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
}

.red-alert-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: #fee2e2;
  letter-spacing: -0.3px;
}

.modal-red-notice-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  width: 100%;
  text-align: left;
}

.modal-text-red {
  font-size: 0.95rem;
  color: #fecaca;
  line-height: 1.55;
}

.modal-text-red strong {
  color: #ffffff;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: #ef4444;
  text-underline-offset: 3px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.btn-red-confirm {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45) !important;
  border: none !important;
}

.btn-red-confirm:hover {
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.6) !important;
  transform: translateY(-2px);
}

.btn-cancel-modal {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-cancel-modal:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* ==========================================================================
   Comprehensive Multi-Device Responsiveness (Mobile, Tablet, Laptop, Desktop)
   ========================================================================== */

/* Tablet and Small Laptops (900px down) */
@media (max-width: 900px) {
  .test-type-nav {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .current-word {
    font-size: clamp(2.4rem, 7vw, 3.6rem);
  }
}

/* Button White-space & Text Wrapping Rules */
.chip-btn,
.tab-btn,
.start-btn,
.btn-secondary,
.btn-danger,
.modal-action-btn,
.icon-btn,
.phase-badge,
.progress-counter {
  white-space: nowrap !important;
}

/* Tablets and Mobile Devices (768px down) */
@media (max-width: 768px) {
  .app-header {
    padding: 0.6rem 0.85rem;
  }
  
  .app-header-logo-img {
    height: 48px;
    max-width: 220px;
  }

  .main-container {
    padding: 0.85rem 0.65rem;
    max-width: 100%;
  }

  .test-type-nav {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 1rem;
  }

  .test-type-btn {
    padding: 0.85rem 1rem;
    gap: 10px;
  }

  .type-icon {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
  }

  .type-name {
    font-size: 0.92rem;
    white-space: nowrap !important;
  }

  .section-card {
    padding: 1.1rem 0.85rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
  }

  .tabs-header {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 4px;
  }

  .tabs-header::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.82rem;
    flex: 1 0 auto;
    text-align: center;
    white-space: nowrap !important;
  }

  .sets-grid,
  .chip-grid-small {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 6px;
  }

  .chip-btn {
    padding: 8px 6px;
    font-size: 0.8rem;
    white-space: nowrap !important;
  }

  .start-btn {
    padding: 0.85rem 1.2rem;
    font-size: 0.98rem;
    white-space: nowrap !important;
  }

  /* Test Hall on Mobile */
  .test-top-bar {
    margin-bottom: 0.75rem;
    padding: 0;
    gap: 6px;
  }

  .progress-counter {
    font-size: 0.82rem;
    padding: 4px 8px;
    gap: 5px;
  }

  .counter-highlight {
    font-size: 0.92rem;
  }

  .phase-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .word-display-card {
    padding: 1.2rem 0.75rem;
    max-height: none;
    min-height: auto;
    border-radius: var(--radius-lg);
  }

  .timer-circle-wrapper {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
  }

  .timer-text {
    font-size: 0.92rem;
  }

  .current-word {
    font-size: clamp(2rem, 8.5vw, 2.8rem);
    letter-spacing: 1px;
    line-height: 1.15;
  }

  .picture-svg-box img,
  .picture-story-image {
    max-width: 100%;
    max-height: min(42vh, 320px);
  }

  .pointer-card-wrapper {
    padding: 1rem 0.85rem;
  }

  .pointer-prompt-text {
    font-size: 1rem;
    line-height: 1.5;
  }

  .typing-box-container {
    margin-top: 0.75rem;
  }

  .typing-input {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .story-textarea {
    min-height: 110px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  /* Review Screen on Mobile */
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
  }

  .stat-card {
    padding: 0.85rem 0.65rem;
  }

  .stat-value {
    font-size: 1.45rem;
  }

  .table-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .table-header-row div {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .table-header-row button {
    flex: 1;
    text-align: center;
    padding: 7px 8px;
    font-size: 0.8rem;
    white-space: nowrap !important;
  }

  .review-table th, 
  .review-table td {
    padding: 8px 8px;
    font-size: 0.82rem;
  }

  .review-table th:first-child,
  .review-table td:first-child {
    width: 36px;
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
  }

  /* Pre-test Modal on Mobile */
  .modal-overlay {
    padding: 0.65rem;
  }

  .modal-card.modal-alert-red {
    padding: 1.4rem 1rem;
    gap: 10px;
  }

  .modal-icon-badge {
    width: 48px;
    height: 48px;
    font-size: 1.8rem;
  }

  .red-alert-title {
    font-size: 1.2rem;
  }

  .modal-text-red {
    font-size: 0.86rem;
  }
}

/* Extra Small Mobile Devices (420px down) */
@media (max-width: 420px) {
  .current-word {
    font-size: 1.95rem;
  }

  .sets-grid,
  .chip-grid-small {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .chip-btn {
    padding: 7px 4px;
    font-size: 0.74rem;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tab-btn {
    padding: 7px 8px;
    font-size: 0.76rem;
    white-space: nowrap !important;
  }

  .start-btn {
    font-size: 0.92rem;
    padding: 0.8rem 1rem;
    white-space: nowrap !important;
  }

  .stat-card {
    padding: 0.75rem 0.5rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-title {
    font-size: 0.7rem;
  }
}

@media print {
  .modal-overlay, .app-header, .header-actions, .start-btn, .btn-secondary, #newSetupBtn {
    display: none !important;
  }
  body { background: #ffffff; color: #000000; }
  .section-card { border: none; box-shadow: none; padding: 0; }
  .review-table th { background: #f1f5f9; }
}
