/* Handwriting.css — scoped under .hw-page to prevent dashboard conflicts */

.hw-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  font-family: var(--body-font);
  color: #111827;
}

/* Header */
.hw-page .hw-header {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(226, 214, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 30;
}

.hw-page .hw-header-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (min-width: 768px) {
  .hw-page .hw-header-content {
    padding: 0 3rem;
    gap: 20px;
  }
}

.hw-page .hw-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.hw-page .hw-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.hw-page .hw-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  color: #4b5563;
  transition: background .15s ease;
  text-decoration: none;
}

.hw-page .hw-back-link:hover {
  background: rgba(236, 72, 153, 0.04);
}

.hw-page .hw-back-icon {
  width: 18px;
  height: 18px;
  color: #374151;
}

.hw-page .hw-header-info {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.hw-page .hw-header-sub {
  font-size: 13px;
  color: #6b7280;
}

.hw-page .hw-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.hw-page .hw-exercise-meta {
  margin-left: auto;
  font-size: 13px;
  color: #6b7280;
}

/* Main container */
.hw-page .hw-main {
  padding: 28px 0;
}

.hw-page .hw-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Card base */
.hw-page .card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
  padding: 20px;
  border: 1px solid rgba(233, 213, 255, 0.85);
  margin-bottom: 24px;
}

/* Titles */
.hw-page .card-title {
  font-size: 20px;
  margin-bottom: 12px;
  font-weight: 600;
  color: #111827;
}

.hw-page .card-subtitle {
  font-size: 18px;
  margin-bottom: 12px;
  font-weight: 600;
  color: #111827;
}

/* Instructions / Sample */
.hw-page .task-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hw-page .card-sample {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(90deg, #eef6ff 0%, #f3eefc 100%);
  border: 2px solid rgba(191, 219, 255, 0.6);
}

.hw-page .sample-label {
  color: #374151;
  margin-bottom: 8px;
}

.hw-page .sample-text {
  font-size: 28px;
  text-align: center;
  padding: 18px 0;
  font-family: "Times New Roman", Georgia, serif;
  color: #111827;
}

/* Steps */
.hw-page .task-steps {
  background: #fbf8ff;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(233, 213, 255, 0.7);
  color: #374151;
}

.hw-page .task-steps ol {
  margin: 0;
  padding-left: 18px;
}

.hw-page .task-steps li {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.4;
}

/* Upload area */
.hw-page .upload-placeholder {
  border-radius: 20px;
  border: 2px dashed rgba(139, 92, 246, 0.18);
  padding: 48px 18px;
  text-align: center;
  transition: background .15s ease, border-color .15s ease, transform .08s;
  cursor: pointer;
}

.hw-page .upload-placeholder:hover {
  background: rgba(236, 72, 153, 0.03);
  border-color: rgba(139, 92, 246, 0.28);
}

.hw-page .upload-camera {
  width: 80px;
  height: 80px;
  color: #8b5cf6;
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.hw-page .upload-cta {
  margin-bottom: 12px;
}

.hw-page .primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 14px;
  background: linear-gradient(90deg, #7c3aed 0%, #ec4899 100%);
  color: #fff;
  font-weight: 600;
  border: none;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.12);
  cursor: pointer;
}

.hw-page .primary-btn:hover {
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.16);
  transform: translateY(-2px);
}

.hw-page .upload-icon {
  width: 18px;
  height: 18px;
}

.hw-page .upload-note {
  color: #6b7280;
  font-size: 13px;
  margin-top: 8px;
}

/* Preview */
.hw-page .upload-preview {
  margin-top: 6px;
  margin-bottom: 12px;
}

.hw-page .preview-inner {
  background: linear-gradient(180deg, #f3f4f6 0%, #e9ecef 100%);
  border-radius: 16px;
  padding: 18px;
  border: 2px solid rgba(219, 234, 254, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hw-page .preview-inner .preview-text {
  color: #6b7280;
  text-align: center;
  padding: 28px;
}

.hw-page .preview-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 12px;
  object-fit: contain;
}

/* Upload actions */
.hw-page .upload-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.hw-page .secondary-btn {
  padding: 10px 18px;
  border-radius: 12px;
  background: transparent;
  border: 2px solid rgba(139, 92, 246, 0.15);
  color: #7c3aed;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.hw-page .secondary-btn:hover {
  background: rgba(139, 92, 246, 0.04);
}

.hw-page .secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hw-page .primary-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Processing spinner + text */
.hw-page .processing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7c3aed;
  font-size: 14px;
}

.hw-page .spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(147, 51, 234, 0.25);
  border-top-color: #7c3aed;
  animation: spin 1s linear infinite;
}

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

/* Feedback card specific */
.hw-page .hw-feedback {
  padding: 22px;
}

.hw-page .result-overall {
  display: flex;
  gap: 16px;
  background: linear-gradient(90deg, #ecfdf5 0%, #f0fdf4 100%);
  padding: 16px;
  border-radius: 14px;
  border: 2px solid rgba(16, 185, 129, 0.18);
  margin-bottom: 14px;
}

.hw-page .result-icon {
  width: 40px;
  height: 40px;
  color: #059669;
  flex-shrink: 0;
}

.hw-page .result-body {
  flex: 1;
}

.hw-page .result-title {
  font-size: 18px;
  margin-bottom: 6px;
  font-weight: 600;
}

.hw-page .result-desc {
  color: #374151;
  font-size: 14px;
  margin-bottom: 12px;
}

.hw-page .result-stats {
  display: flex;
  gap: 28px;
  align-items: center;
}

.hw-page .stat {
  text-align: left;
}

.hw-page .stat-label {
  font-size: 13px;
  color: #6b7280;
}

.hw-page .stat-value {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(90deg, #059669 0%, #047857 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hw-page .stat-value.plus {
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

/* Detailed feedback */
.hw-page .detailed-feedback {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 6px;
}

.hw-page .feedback-block {}

.hw-page .feedback-title {
  font-size: 16px;
  margin-bottom: 8px;
  font-weight: 600;
  color: #111827;
}

.hw-page .feedback-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hw-page .feedback-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #374151;
}

.hw-page .feedback-check {
  color: #059669;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.hw-page .feedback-alert {
  color: #d97706;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.hw-page .bordered {
  border-top: 2px solid rgba(233, 213, 255, 0.7);
  padding-top: 16px;
}

/* Feedback actions */
.hw-page .feedback-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 2px solid rgba(233, 213, 255, 0.75);
}

.hw-page .feedback-actions .primary-btn.full,
.hw-page .feedback-actions .secondary-btn.full {
  flex: 1;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px 18px;
  border-radius: 12px;
}

.hw-page .secondary-btn.full {
  border: 2px solid rgba(139, 92, 246, 0.12);
  background: transparent;
  color: #7c3aed;
}

.hw-page .primary-btn.full {
  background: linear-gradient(90deg, #7c3aed 0%, #ec4899 100%);
  color: white;
  border: none;
}

/* Dashboard Styles */
.hw-page .hw-stats-section {
  margin-bottom: 24px;
}

.hw-page .hw-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.hw-page .hw-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.hw-page .hw-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.hw-page .hw-stat-content {
  flex: 1;
}

.hw-page .hw-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  margin-bottom: 4px;
}

.hw-page .hw-stat-label {
  font-size: 13px;
  color: #6b7280;
}

.hw-page .hw-level-card {
  margin-bottom: 24px;
}

.hw-page .hw-sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.hw-page .hw-session-card {
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: #fff;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hw-page .hw-session-card:hover {
  border-color: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.hw-page .hw-session-card.hw-session-completed {
  border-color: #22c55e;
  background: #f0fdf4;
}

.hw-page .hw-session-number {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
}

.hw-page .hw-session-text {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  font-family: "Times New Roman", Georgia, serif;
}

.hw-page .hw-session-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #22c55e;
  font-weight: 600;
  font-size: 14px;
}

.hw-page .hw-session-start {
  color: #7c3aed;
  font-weight: 600;
  font-size: 14px;
}

.hw-page .hw-next-session-card {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
  margin-bottom: 24px;
}

.hw-page .hw-next-session-card .card-title {
  color: white;
}

.hw-page .hw-next-session-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hw-page .hw-next-session-text {
  flex: 1;
}

.hw-page .hw-next-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.hw-page .hw-next-text {
  font-size: 32px;
  font-weight: 700;
  font-family: "Times New Roman", Georgia, serif;
}

.hw-page .hw-levels-overview {
  margin-bottom: 24px;
}

.hw-page .hw-levels-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.hw-page .hw-level-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: #fff;
  transition: all 0.2s ease;
}

.hw-page .hw-level-item.hw-level-current {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.hw-page .hw-level-item.hw-level-complete {
  border-color: #22c55e;
  background: #f0fdf4;
}

.hw-page .hw-level-info {
  flex: 1;
}

.hw-page .hw-level-name {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.hw-page .hw-level-desc {
  font-size: 14px;
  color: #6b7280;
}

.hw-page .hw-level-status {
  flex-shrink: 0;
}

.hw-page .hw-level-badge {
  padding: 4px 12px;
  border-radius: 12px;
  background: #7c3aed;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.hw-page .hw-header-content {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hw-page .hw-star-icon {
  width: 16px;
  height: 16px;
  color: #f59e0b;
  margin-right: 4px;
  vertical-align: middle;
}

/* Tabs */
.hw-page .hw-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
  border-bottom: 2px solid rgba(233, 213, 255, 0.5);
  padding-bottom: 12px;
}

.hw-page .hw-tab-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  background: transparent;
  border: 2px solid transparent;
  color: #6b7280;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  justify-content: center;
  max-width: 200px;
}

.hw-page .hw-tab-button:hover {
  background: rgba(139, 92, 246, 0.06);
  color: #7c3aed;
}

.hw-page .hw-tab-button.hw-tab-active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
  border-color: rgba(124, 58, 237, 0.3);
  color: #7c3aed;
}

.hw-page .hw-tab-icon {
  width: 18px;
  height: 18px;
}

.hw-page .hw-tab-content {
  text-align: center;
}

/* Drawing Board */
.hw-page .hw-drawing-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.hw-page .hw-drawing-tools {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 600px;
  padding: 16px;
  background: linear-gradient(90deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 16px;
  border: 2px solid rgba(233, 213, 255, 0.5);
}

.hw-page .hw-tool-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.hw-page .hw-tool-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.hw-page .hw-color-picker {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.hw-page .hw-color-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hw-page .hw-color-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hw-page .hw-color-btn.hw-color-active {
  border-color: #7c3aed;
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.hw-page .hw-pen-size {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.hw-page .hw-size-btn {
  padding: 10px 20px;
  border-radius: 10px;
  background: #fff;
  border: 2px solid rgba(139, 92, 246, 0.2);
  color: #7c3aed;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.hw-page .hw-size-btn:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.4);
}

.hw-page .hw-size-btn.hw-size-active {
  background: linear-gradient(90deg, #7c3aed 0%, #ec4899 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.hw-page .hw-canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  border-radius: 16px;
  border: 2px solid rgba(233, 213, 255, 0.6);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.hw-page .hw-canvas {
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-width: 100%;
  height: auto;
  display: block;
}

.hw-page .hw-canvas-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

/* Tips card */
.hw-page .hw-tips {
  background: linear-gradient(90deg, #fffbeb 0%, #fff7ed 100%);
  border: 1px solid rgba(254, 231, 168, 0.9);
  padding: 18px;
  border-radius: 16px;
}

.hw-page .tips-label {
  color: #b45309;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-size: 13px;
}

.hw-page .tips-list {
  margin: 0;
  padding-left: 18px;
  color: #374151;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Animations */
.hw-page .animate-fade {
  animation: fade-in 0.45s ease-out forwards;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .hw-page .hw-header-inner {
    padding: 0 12px;
    gap: 10px;
    height: 56px;
  }

  .hw-page .hw-container {
    padding: 0 12px;
  }

  .hw-page .sample-text {
    font-size: 20px;
  }

  .hw-page .upload-placeholder {
    padding: 28px 12px;
  }

  .hw-page .activity-grid {
    grid-template-columns: 1fr;
  }

  .hw-page .card {
    padding: 16px;
    border-radius: 16px;
  }

  /* Tabs responsive */
  .hw-page .hw-tabs {
    gap: 6px;
  }

  .hw-page .hw-tab-button {
    padding: 10px 16px;
    font-size: 14px;
    max-width: none;
  }

  .hw-page .hw-tab-icon {
    width: 16px;
    height: 16px;
  }

  /* Drawing board responsive */
  .hw-page .hw-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .hw-page .hw-canvas-container {
    padding: 12px;
    overflow-x: auto;
  }

  .hw-page .hw-drawing-tools {
    padding: 12px;
  }

  .hw-page .hw-color-btn {
    width: 36px;
    height: 36px;
  }

  .hw-page .hw-size-btn {
    padding: 8px 16px;
    font-size: 13px;
    min-width: 70px;
  }

  .hw-page .upload-actions {
    flex-direction: column;
  }

  .hw-page .hw-canvas-actions {
    flex-direction: column;
  }

  .hw-page .hw-canvas-actions .primary-btn,
  .hw-page .hw-canvas-actions .secondary-btn {
    width: 100%;
  }
}