:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --panel: #ffffff;
  --soft: #f9fafb;
  
  /* Modern Corporate Color Shift */
  --brand: #003366;    /* Corporate Blue */
  --brand-2: #009245;  /* Success Green */
  --accent: #ffb400;   /* Premium Gold */
  --danger: #dc2626;   /* Rich Red */
  --shadow: 0 20px 40px rgba(0, 51, 102, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(0, 51, 102, 0.05), rgba(0, 146, 69, 0.02) 50%, #f3f4f6);
}

button, input, textarea {
  font: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.brand strong {
  font-size: 1.15rem;
  color: var(--brand);
}

.support span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
  color: var(--brand);
}

main {
  flex: 1;
  display: grid;
  align-items: center;
  padding: 32px 0 48px;
}

.intro-panel, .test-panel, .result-panel, .verify-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.intro-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 48px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand);
  text-transform: uppercase;
}

h1 {
  font-size: 2.5rem;
  line-height: 1.15;
  color: var(--brand);
  margin: 0 0 16px;
}

.credibility-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 32px;
}

.metric-pill {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.metric-pill strong {
  display: block;
  font-size: 1.4rem;
  color: var(--brand-2);
}

.metric-pill small {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.student-form {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 32px;
  border-radius: 10px;
}

.form-title {
  margin: 0 0 20px;
  font-size: 1.35rem;
  color: var(--brand);
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.full-width {
  grid-column: span 2;
}

label span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: #fff;
  transition: all 0.2s ease;
}

input:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 51, 102, 0.1);
  outline: none;
}

.duration-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  margin: 0 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.duration-select label {
  position: relative;
  cursor: pointer;
}

.duration-select input {
  position: absolute;
  opacity: 0;
}

.duration-select span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
  background: var(--soft);
}

.duration-select input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.privacy-consent {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  margin: 0 0 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.privacy-consent input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.privacy-consent span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
}

.primary-btn {
  width: 100%;
  min-height: 48px;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary-btn:hover { background: #002244; }

/* Test Screen Interface Updates */
.test-panel { padding: 40px; }
.test-header { display: flex; justify-content: space-between; align-items: center; }

/* Enhanced Dynamic Timers */
.timer-wrapper { position: relative; }
.timer {
  min-width: 140px;
  min-height: 58px;
  border-radius: 8px;
  font-size: 2.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.3s ease;
}

.state-green { background: var(--brand-2); }
.state-orange {
  background: var(--accent);
  color: #000;
  animation: pulse-warn 1.5s infinite ease-in-out;
}
.state-red {
  background: var(--danger);
  animation: flash-danger 0.5s infinite alternate;
}

@keyframes pulse-warn {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 180, 0, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(255, 180, 0, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 180, 0, 0); }
}

@keyframes flash-danger {
  0% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.8; transform: scale(0.95); }
}

/* Progress Bar Components */
.progress-container { margin: 24px 0 12px; }
.progress-bar-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.progress-track { background: var(--line); height: 10px; border-radius: 999px; overflow: hidden; }
.progress-fill { background: var(--brand); height: 100%; width: 0%; transition: width 0.2s linear; }

/* 6-Card Dashboard Layout */
.dashboard-6-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.dashboard-6-cards div {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 16px 12px;
  border-radius: 8px;
  text-align: center;
}

.dashboard-6-cards span {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand);
}

.dashboard-6-cards small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

/* Advanced Interactive Typing Portal Area */
.typing-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.passage-pane,
.input-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-title,
.typing-area-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.sample-text {
  min-height: 300px;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  font-size: 1.08rem;
  line-height: 1.65;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
  margin-bottom: 0;
  background: #fff;
  overflow: auto;
  white-space: normal;
}

.sample-text span {
  padding: 0 1px !important;
  border-radius: 2px;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
}
.sample-text .correct { color: var(--brand-2); background: rgba(0, 146, 69, 0.06); }
.sample-text .incorrect { color: var(--danger); background: rgba(220, 38, 38, 0.1); text-decoration: line-through; }

/* Premium Premium Character Cursor Selection Block Highlight */
.sample-text .current {
  background: var(--accent) !important;
  color: #000 !important;
  box-shadow: 0 2px 6px rgba(255, 180, 0, 0.4);
  font-weight: 700;
}

.typing-area {
  min-height: 300px;
  height: 100%;
  font-size: 1.08rem;
  line-height: 1.65;
  margin-bottom: 0;
  resize: vertical;
}

/* Badges Base */
.badge-group { display: flex; gap: 8px; }
.result-badge, .grade-badge {
  padding: 6px 16px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}
.result-badge { background: var(--brand-2); }
.grade-badge { background: var(--brand); border: 1px solid rgba(255,255,255,0.2); }

/* Result Grid Dashboard */
.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.result-grid div {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
}

.result-grid small { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
.result-grid strong { font-size: 1.3rem; color: var(--brand); }

/* Compact Buttons Styling */
.secondary-btn { background: transparent; border: 1px solid var(--line); font-weight: 600; padding: 10px 20px; border-radius: 6px; cursor: pointer; }
.secondary-btn:hover { background: var(--soft); }
.ghost-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; margin-left: 8px; }
.ghost-btn:hover { text-decoration: underline; }
.test-actions { display: flex; align-items: center; }

/* Instantly Scannable Verification Page Elements */
.verification-card-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-radius: 8px;
  margin: 24px 0;
  font-weight: 800;
  font-size: 1.35rem;
}

.badge-valid {
  background: rgba(0, 146, 69, 0.1);
  border: 2px solid var(--brand-2);
  color: var(--brand-2);
}

.badge-invalid {
  background: rgba(220, 38, 38, 0.1);
  border: 2px solid var(--danger);
  color: var(--danger);
}

.verify-photo {
  display: none;
  margin: 18px 0 8px;
}

.candidate-photo-card {
  width: min(100%, 460px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.candidate-photo-card img {
  width: 96px;
  height: 112px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--soft);
}

.candidate-photo-card small,
.candidate-photo-card strong,
.candidate-photo-card span {
  display: block;
}

.candidate-photo-card small {
  color: var(--muted);
  font-weight: 700;
}

.candidate-photo-card strong {
  margin-top: 6px;
  color: var(--brand);
  font-size: 1.15rem;
}

.candidate-photo-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.hidden { display: none !important; }

/* Responsive Viewports Overrides */
@media (max-width: 900px) {
  .dashboard-6-cards { grid-template-columns: repeat(3, 1fr); }
  .typing-workspace { grid-template-columns: 1fr; }
  .sample-text,
  .typing-area { min-height: 220px; }
}

@media (max-width: 1024px) {
  .dashboard-6-cards { grid-template-columns: repeat(3, 1fr); }
  .intro-panel { grid-template-columns: 1fr; gap: 32px; padding: 24px; }
}

@media (max-width: 640px) {
  .dashboard-6-cards { grid-template-columns: repeat(2, 1fr); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: span 1; }
  .duration-select { grid-template-columns: 1fr; }
}
