/* ============================================
   Praxius PWA — Mobile App Styles
   Primary: #2563EB  |  Font: Inter
   Target: 375px mobile-first
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #2563EB;
  --blue-light: #DBEAFE;
  --blue-dark: #1D4ED8;
  --green: #16A34A;
  --green-light: #DCFCE7;
  --orange: #EA580C;
  --orange-light: #FFF7ED;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --yellow: #CA8A04;
  --yellow-light: #FEF9C3;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --tab-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: 56px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

a { color: var(--blue); text-decoration: none; }
a:active { opacity: 0.7; }

img { max-width: 100%; display: block; }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-appearance: none;
}

/* --- Utility classes --- */
.hidden { display: none !important; }
.text-blue { color: var(--blue); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: var(--red); }
.text-gray { color: var(--gray-500); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 0.5rem; }
.mt-12 { margin-top: 0.75rem; }
.mt-16 { margin-top: 1rem; }
.mt-24 { margin-top: 1.5rem; }
.mb-8 { margin-bottom: 0.5rem; }
.mb-16 { margin-bottom: 1rem; }

/* --- Login Page --- */
#login-page {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #2563EB, #1E40AF);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #2563EB;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.login-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-xs);
  padding: 3px;
  margin-bottom: 8px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  border-radius: 6px;
  transition: all 0.2s;
}

.login-tab.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-xs);
  font-size: 1rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.login-error {
  color: var(--red);
  font-size: 0.8125rem;
  text-align: center;
  min-height: 1.2em;
}

.login-name-row {
  display: none;
}

.login-name-row.visible {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-blue {
  background: var(--blue);
  color: var(--white);
}

.btn-blue:active {
  background: var(--blue-dark);
}

.btn-blue:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}

.btn-outline:active {
  background: var(--blue-light);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  font-weight: 500;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8125rem;
  border-radius: var(--radius-xs);
}

.btn-block {
  width: 100%;
}

.btn-round {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- App Shell --- */
#app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
}

/* --- Page containers --- */
.page {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: absolute;
  inset: 0;
  bottom: calc(var(--tab-height) + var(--safe-bottom));
}

.page.active {
  display: flex;
}

.page.no-tabs {
  bottom: 0;
}

.page-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.page-content {
  padding: 16px;
  padding-bottom: 24px;
}

/* --- Sticky Header --- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-height);
  transition: box-shadow 0.2s;
}

.page-header.scrolled {
  box-shadow: var(--shadow);
}

.page-header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.header-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--gray-700);
  flex-shrink: 0;
}

.header-back:active {
  background: var(--gray-100);
}

.header-back svg {
  width: 20px;
  height: 20px;
}

/* --- Tab Bar --- */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  padding-top: 6px;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  color: var(--gray-400);
  font-size: 0.625rem;
  font-weight: 500;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.tab-item.active {
  color: var(--blue);
}

.tab-item.active svg {
  stroke-width: 2.2;
}

.tab-label {
  font-size: 0.625rem;
  line-height: 1;
}

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 12px;
}

/* --- Dashboard Page --- */
.dash-greeting {
  font-size: 1rem;
  color: var(--gray-600);
}

.dash-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue);
}

.dash-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.dash-date {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.dash-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--orange-light);
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 600;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-circle.lg {
  width: 64px;
  height: 64px;
  font-size: 1.25rem;
}

/* --- Score Ring --- */
.score-ring-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.score-ring-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

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

.score-ring-track {
  fill: none;
  stroke: var(--gray-100);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--blue);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}

.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.score-ring-label {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 2px;
}

.score-ring-info {
  flex: 1;
}

.score-ring-level-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  color: var(--gray-400);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.score-ring-level {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
}

.score-ring-sublabel {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* --- Task Card (daily exercise) --- */
.task-card {
  border-left: 4px solid var(--blue);
  padding-left: 16px;
}

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

.task-card-icon {
  font-size: 1.25rem;
}

.task-card-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
}

.skill-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.skill-pill-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.skill-pill-green {
  background: var(--green-light);
  color: var(--green);
}

.skill-pill-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

.task-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.task-card-desc {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Alert Banner --- */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.alert-orange {
  background: var(--orange-light);
  color: var(--orange);
  border: 1px solid rgba(234, 88, 12, 0.15);
}

.alert-green {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(22, 163, 74, 0.15);
}

.alert-blue {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  margin-top: 4px;
  flex-shrink: 0;
}

/* --- Activity Row --- */
.activity-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.activity-scroll::-webkit-scrollbar { display: none; }

.activity-widget {
  flex-shrink: 0;
  width: 140px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.activity-widget-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.activity-widget-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-align: center;
}

.activity-widget-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* --- 30-Day Track Grid --- */
.track-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.track-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-400);
}

.track-day.completed {
  background: var(--green);
  color: var(--white);
}

.track-day.missed {
  background: var(--gray-200);
  color: var(--gray-400);
}

.track-day.today {
  border: 2px solid var(--blue);
  color: var(--blue);
}

.track-day.future {
  background: var(--gray-50);
  color: var(--gray-300);
}

/* --- Course Page --- */
.course-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.course-tab {
  padding: 12px 0;
  margin-right: 24px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-400);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.course-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* Video list */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.video-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.video-num.completed {
  background: var(--green);
  color: var(--white);
}

.video-num.current {
  background: var(--blue);
  color: var(--white);
}

.video-num.locked {
  background: var(--gray-200);
  color: var(--gray-400);
}

.video-info {
  flex: 1;
  min-width: 0;
}

.video-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-desc {
  font-size: 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.video-play svg {
  width: 16px;
  height: 16px;
  fill: var(--blue);
}

.video-item.locked-item {
  opacity: 0.5;
}

.video-item.locked-item .video-play {
  background: var(--gray-100);
}

.video-item.locked-item .video-play svg {
  fill: var(--gray-400);
}

/* --- Mentor / Chat Page --- */
.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9375rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--blue);
  color: var(--white);
  border-bottom-right-radius: 6px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--white);
  color: var(--gray-800);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble .bold { font-weight: 700; }
.chat-bubble .italic { font-style: italic; }

.chat-time {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 2px;
  text-align: right;
}

.chat-time.left {
  text-align: left;
}

.chat-typing {
  align-self: flex-start;
  display: none;
  gap: 4px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.chat-typing.visible {
  display: flex;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  background: var(--gray-300);
  border-radius: 50%;
  animation: chatDot 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}

.chat-input-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 24px;
  padding: 4px 16px;
  transition: border-color 0.2s;
}

.chat-input-wrap:focus-within {
  border-color: var(--blue);
}

.chat-textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.9375rem;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  min-height: 36px;
  padding: 6px 0;
  color: var(--gray-900);
}

.chat-textarea::placeholder {
  color: var(--gray-400);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-send-btn:disabled {
  background: var(--gray-300);
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-mic-btn.recording {
  background: var(--red);
  color: var(--white);
  animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.chat-mic-btn svg {
  width: 20px;
  height: 20px;
}

.chat-action-row {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  background: var(--white);
}

/* --- Exercise Page --- */
.exercise-header-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.exercise-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
}

.exercise-section {
  margin-bottom: 16px;
}

.exercise-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 6px;
}

.exercise-scenario {
  background: var(--blue-light);
  border-radius: var(--radius-xs);
  padding: 14px;
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.6;
}

.exercise-task {
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.6;
}

.exercise-answer-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.exercise-textarea {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--white);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.exercise-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.exercise-textarea::placeholder {
  color: var(--gray-400);
}

.exercise-char-count {
  font-size: 0.75rem;
  color: var(--gray-400);
  text-align: right;
  margin-top: 4px;
}

.exercise-bottom-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}

.exercise-bottom-bar .btn {
  flex: 1;
}

/* --- Evaluation Page --- */
.eval-score-ring {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 12px;
}

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

.eval-score-ring .ring-track {
  fill: none;
  stroke: var(--gray-100);
  stroke-width: 10;
}

.eval-score-ring .ring-fill {
  fill: none;
  stroke: var(--blue);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.eval-score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.eval-score-big {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.eval-score-max {
  font-size: 1rem;
  color: var(--gray-400);
}

.eval-score-unit {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.eval-delta {
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.eval-delta.positive { color: var(--green); }
.eval-delta.negative { color: var(--red); }

.eval-section {
  margin-bottom: 16px;
}

.eval-section-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.eval-feedback-text {
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.6;
  white-space: pre-wrap;
}

.eval-recommend-box {
  background: var(--green-light);
  border-radius: var(--radius-xs);
  padding: 14px;
  font-size: 0.8125rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.eval-recommend-box .eval-recommend-label {
  font-weight: 700;
  color: var(--green);
  display: block;
  margin-bottom: 4px;
}

.eval-ideal-box {
  background: var(--blue-light);
  border-radius: var(--radius-xs);
  padding: 14px;
  font-size: 0.8125rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.eval-ideal-box .eval-ideal-label {
  font-weight: 700;
  color: var(--blue);
  display: block;
  margin-bottom: 4px;
}

.eval-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eval-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
}

.eval-level-name {
  color: var(--gray-600);
}

.eval-level-value {
  font-weight: 700;
  color: var(--gray-900);
}

.eval-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.eval-actions .btn {
  flex: 1;
}

/* --- Progress / Stats Page --- */
.progress-score-section {
  text-align: center;
  margin-bottom: 24px;
}

.progress-score-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.progress-delta-label {
  font-size: 0.8125rem;
  color: var(--green);
  font-weight: 600;
  margin-top: 8px;
}

.progress-chart-card {
  position: relative;
  height: 200px;
}

.progress-chart-card canvas {
  width: 100% !important;
  height: 100% !important;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.skill-row-name {
  width: 110px;
  font-size: 0.75rem;
  color: var(--gray-600);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-bar-track {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
  transition: width 0.6s ease;
}

.skill-bar-fill.low { background: var(--red); }
.skill-bar-fill.mid { background: var(--yellow); }
.skill-bar-fill.high { background: var(--green); }

.skill-row-score {
  width: 30px;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* Radar chart */
.radar-chart-wrap {
  position: relative;
  height: 260px;
  margin-top: 16px;
}

.radar-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* --- Profile / Settings Page --- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
}

.profile-role {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.profile-email {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 2px;
}

.settings-group {
  margin-top: 16px;
}

.settings-group-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  padding: 0 4px;
  margin-bottom: 8px;
}

.settings-list {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  font-size: 0.9375rem;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
  cursor: pointer;
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:active {
  background: var(--gray-50);
}

.settings-item-icon {
  font-size: 1.25rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.settings-item-label {
  flex: 1;
}

.settings-item-value {
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.settings-item-arrow {
  color: var(--gray-300);
  flex-shrink: 0;
}

.settings-item-arrow svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: var(--gray-300);
  transition: background 0.2s;
  cursor: pointer;
}

.toggle input:checked + .toggle-track {
  background: var(--blue);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.logout-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--red);
  border: 1.5px solid var(--red-light);
  background: var(--white);
  text-align: center;
  margin-top: 24px;
}

.logout-btn:active {
  background: var(--red-light);
}

.app-version {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 12px;
  padding-bottom: 16px;
}

/* --- Achievements grid --- */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.achievement-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.achievement-item.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.achievement-emoji {
  font-size: 1.75rem;
}

.achievement-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-700);
  line-height: 1.2;
}

/* --- Segment tabs --- */
.segment-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-xs);
  padding: 3px;
}

.segment-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-500);
  border-radius: 6px;
  transition: all 0.2s;
}

.segment-tab.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  max-width: 260px;
}

/* --- Spinner / Loading --- */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

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

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
}

/* --- Quote card --- */
.quote-card {
  font-style: italic;
  font-size: 0.875rem;
  color: var(--gray-600);
  padding: 14px 16px;
  border-left: 3px solid var(--blue-light);
  background: var(--white);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.quote-author {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 6px;
}

/* --- Modal / Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.modal-overlay.visible .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
  text-align: center;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  left: 16px;
  right: 16px;
  padding: 14px 16px;
  background: var(--gray-800);
  color: var(--white);
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-xs);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-full { width: 100%; }

/* --- Progress bar (linear) --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* --- Responsive (tablets) --- */
@media (min-width: 480px) {
  .page-content {
    max-width: 480px;
    margin: 0 auto;
  }
  #tab-bar {
    max-width: 480px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
  }
}
