:root {
  --bg: #eef6ff;
  --bg-ink: rgba(80, 129, 191, 0.1);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-deep: #f0f7ff;
  --ink: #2a3a4e;
  --muted: #7e8ea1;
  --border: rgba(180, 210, 240, 0.6);
  --brand: #10b981;
  --brand-hover: #059669;
  --brand-light: rgba(16, 185, 129, 0.12);
  --secondary: #6366f1;
  --secondary-hover: #4f46e5;
  --shadow: 0 12px 40px rgba(51, 103, 168, 0.1);
  --shadow-hover: 0 16px 48px rgba(51, 103, 168, 0.16);
  --good-bg: #ecfdf5;
  --good-border: #6ee7b7;
  --good-text: #065f46;
  --pending-bg: #fffbeb;
  --pending-border: #fcd34d;
  --pending-text: #92400e;
  --radius: 20px;
  --radius-sm: 14px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #e0f2fe 0%, #f0e7fe 50%, #fce7f3 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("assets/magic-weather-bg.svg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  opacity: 0.35;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 25%, rgba(99, 102, 241, 0.08) 0, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(244, 114, 182, 0.08) 0, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0, transparent 50%);
  pointer-events: none;
}

/* ===================== ANIMATIONS ===================== */

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

@keyframes floatReverse {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(-3deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.08); opacity: 1; }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes rainbowBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5), 0 0 40px rgba(16, 185, 129, 0.2); }
}

@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

@keyframes starPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ===================== FLOATING DECORATIONS ===================== */

.floating-decor {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  font-size: 2rem;
  opacity: 0.25;
}

.floating-decor:nth-child(1) { top: 8%; left: 5%; animation: float 6s ease-in-out infinite; }
.floating-decor:nth-child(2) { top: 15%; right: 8%; animation: floatReverse 7s ease-in-out infinite 0.5s; }
.floating-decor:nth-child(3) { top: 45%; left: 3%; animation: float 8s ease-in-out infinite 1s; }
.floating-decor:nth-child(4) { top: 60%; right: 4%; animation: floatReverse 6.5s ease-in-out infinite 1.5s; }
.floating-decor:nth-child(5) { top: 80%; left: 7%; animation: float 7.5s ease-in-out infinite 2s; }
.floating-decor:nth-child(6) { top: 30%; right: 12%; animation: floatReverse 5.5s ease-in-out infinite 0.8s; }

/* ===================== LAYOUT ===================== */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.panel:hover {
  box-shadow: var(--shadow-hover);
}

/* ===================== LOGIN PAGE ===================== */

.login-panel {
  width: 100%;
  max-width: 1080px;
  margin: 10px auto;
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  animation: slideUp 0.6s ease-out;
}

.login-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #ec4899, #f59e0b);
  background-size: 200% 200%;
  animation: rainbowBg 4s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
  padding-bottom: 4px;
}

.login-subtitle {
  margin: 10px 0 6px;
  text-align: center;
  color: var(--secondary);
  font-size: 1.08rem;
  font-weight: 600;
}

.login-intro {
  margin: 10px auto 20px;
  max-width: 600px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(236, 72, 153, 0.06));
  border-radius: 16px;
  border-left: 5px solid var(--secondary);
  font-size: 1rem;
  color: #4338ca;
  line-height: 1.6;
}

.login-prompt {
  margin: 0 0 14px;
  text-align: center;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 700;
  color: var(--secondary);
}

.student-id-grid {
  max-height: 310px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(248, 250, 255, 0.8);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}

.student-id-grid::-webkit-scrollbar {
  width: 6px;
}

.student-id-grid::-webkit-scrollbar-track {
  background: transparent;
}

.student-id-grid::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
}

.student-id-btn {
  border: 2px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.student-id-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
  opacity: 0;
  transition: opacity 0.25s;
}

.student-id-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.student-id-btn:hover::before {
  opacity: 1;
}

.student-id-btn.selected {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.login-submit-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 14px;
  background: rgba(248, 250, 255, 0.8);
  text-align: center;
}

.login-choice-text {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 500;
}

.login-btn {
  min-width: 180px;
  font-size: 1.15rem;
  padding: 13px 24px;
  border-radius: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
  transition: all 0.25s ease;
  letter-spacing: 0.5px;
}

.login-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.4);
}

.login-state-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ===================== BUTTONS ===================== */

.btn {
  border: none;
  border-radius: 14px;
  padding: 11px 18px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #34d399);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.15) 50%, transparent 60%);
  background-size: 200%;
  animation: shimmer 3s ease-in-out infinite;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled::after {
  display: none;
}

.btn-secondary {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #78879a, #475569);
  box-shadow: 0 8px 24px rgba(100, 116, 139, 0.35);
}

.btn-star {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #78350f;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 22px;
  border-radius: 16px;
}

.btn-star:hover {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.4);
}

.btn-star:disabled {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  color: #6b7280;
}

/* ===================== STUDENT HEADER ===================== */

.student-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  margin-bottom: 14px;
  animation: slideUp 0.4s ease-out;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.student-id-badge {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
  background: rgba(99, 102, 241, 0.08);
  padding: 6px 16px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.star-badge {
  font-size: 1.25rem;
  font-weight: 800;
  color: #d97706;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.15));
  padding: 6px 16px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

/* ===================== NAVIGATION TABS ===================== */

.student-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  animation: slideUp 0.5s ease-out;
}

.nav-tab {
  flex: 1;
  min-width: fit-content;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #64748b;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
}

.nav-tab:hover {
  background: rgba(99, 102, 241, 0.06);
  color: var(--secondary);
}

.nav-tab.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ===================== PAGE CONTAINER ===================== */

.page-container {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: slideUp 0.6s ease-out;
}

.page-panel {
  display: none;
}

.page-panel.active {
  display: block;
  animation: slideUp 0.35s ease-out;
}

.page-panel h3 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-panel h3 .section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.page-panel h3 .section-icon.icon-f1 {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}
.page-panel h3 .section-icon.icon-f2 {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}
.page-panel h3 .section-icon.icon-f3 {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}
.page-panel h3 .section-icon.icon-f4 {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
}

.page-panel h3 .section-title-text {
  background: linear-gradient(135deg, #1e3a5f, #4338ca);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-panel .muted {
  margin-bottom: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===================== COMMON ELEMENTS ===================== */

.muted {
  color: var(--muted);
}

.summary h2,
.task-card h3,
#teacher-view h2 {
  margin-top: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.row p {
  margin: 0;
}

.row.compact {
  justify-content: flex-start;
}

.stack {
  display: grid;
  gap: 12px;
}

input,
select,
textarea {
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.25s ease;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

input::placeholder {
  color: #a1a8b8;
}

.result-text {
  margin: 0;
  color: #475569;
  font-weight: 500;
  padding: 8px 14px;
  background: rgba(241, 245, 249, 0.8);
  border-radius: 12px;
  font-size: 0.95rem;
}

.status-badge {
  margin: 0;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 16px;
  border: 2px solid transparent;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.status-pending {
  background: var(--pending-bg);
  border-color: var(--pending-border);
  color: var(--pending-text);
}

.status-done {
  background: var(--good-bg);
  border-color: var(--good-border);
  color: var(--good-text);
  animation: bounceIn 0.5s ease;
}

/* ===================== F1 — WEATHER TOOL ===================== */

#page-f1 .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.weather-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: 16px;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.weather-display .temp-icon {
  font-size: 2rem;
}

/* ===================== F2 — MATCHING GAME ===================== */

.matching {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.matching > div > h4 {
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--secondary);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.chip {
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  min-height: 56px;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.chip:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
}

.chip.selected {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: #8b5cf6;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
  animation: pulse 1s ease-in-out infinite;
}

.chip.matched {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #34d399;
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.2);
  animation: bounceIn 0.4s ease;
  cursor: default;
}

.chip.matched:hover {
  transform: none;
}

/* ===================== F3 — OUTFIT / CITY ===================== */

.city-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 2px dashed rgba(148, 163, 184, 0.3);
}

.city-section h4,
.outfit-section h4 {
  margin: 0 0 12px;
  color: var(--secondary);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-city-wrap {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.preset-city-label {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 700;
}

.preset-city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-city-btn {
  border: 1px solid rgba(79, 70, 229, 0.22);
  background: rgba(238, 242, 255, 0.95);
  color: #4338ca;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-city-btn:hover {
  background: rgba(224, 231, 255, 1);
  transform: translateY(-1px);
}

.city-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.city-empty {
  margin: 0;
  padding: 10px 14px;
  color: #64748b;
  background: rgba(241, 245, 249, 0.85);
  border-radius: 12px;
  font-weight: 500;
}

.city-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  animation: bounceIn 0.4s ease;
}

.city-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.city-item.active {
  border-color: rgba(79, 70, 229, 0.38);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(139, 92, 246, 0.14));
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.16);
}

.city-pick {
  border: none;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
  padding: 0;
}

.city-temp {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.1);
  color: #1e40af;
  font-size: 0.85rem;
  font-weight: 700;
}

.city-refresh {
  border: none;
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  cursor: pointer;
  font-size: 1rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.city-refresh:hover {
  background: rgba(59, 130, 246, 0.2);
}

.city-item .remove-city {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.city-item .remove-city:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.forecast-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.forecast-empty {
  padding: 14px;
  border-radius: 12px;
  color: #64748b;
  background: rgba(241, 245, 249, 0.85);
  font-weight: 500;
}

.forecast-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(248, 250, 255, 0.95), rgba(241, 245, 255, 0.92));
  cursor: pointer;
  transition: all 0.2s ease;
}

.forecast-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30, 64, 175, 0.12);
}

.forecast-card.active {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.15);
}

.forecast-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.forecast-head h5 {
  margin: 0;
  font-size: 1rem;
  color: #334155;
}

.forecast-time {
  font-size: 0.8rem;
  color: #64748b;
}

.forecast-current {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.forecast-main-icon {
  font-size: 1.9rem;
}

.forecast-current-temp {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e3a8a;
}

.forecast-current-desc {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: #64748b;
}

.forecast-days {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.forecast-day {
  min-width: 0;
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  text-align: center;
  display: grid;
  gap: 2px;
}

.day-label {
  font-size: 0.76rem;
  color: #475569;
  font-weight: 700;
}

.day-icon {
  font-size: 1.1rem;
}

.day-temp {
  font-size: 0.8rem;
  color: #334155;
  font-weight: 600;
}

.day-pop {
  font-size: 0.74rem;
  color: #0e7490;
}

.outfit-section {
  margin-top: 16px;
}

fieldset {
  border: 2px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 16px;
  background: rgba(248, 250, 255, 0.6);
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

fieldset:focus-within {
  border-color: rgba(99, 102, 241, 0.3);
}

fieldset legend {
  font-weight: 700;
  color: var(--secondary);
  font-size: 0.95rem;
  padding: 0 8px;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 500;
}

fieldset label:hover {
  background: rgba(99, 102, 241, 0.04);
  border-color: rgba(99, 102, 241, 0.1);
  transform: translateX(4px);
}

fieldset label:has(input:checked) {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border-color: rgba(99, 102, 241, 0.25);
}

fieldset label input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--secondary);
}

/* ===================== F4 — VOICE ASSISTANT ===================== */

.speaker-intro {
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  color: white;
  padding: 20px 24px;
  border-radius: 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.speaker-intro::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.speaker-intro p {
  margin: 0 0 8px;
  font-size: 1.02rem;
  line-height: 1.6;
  position: relative;
}

.speaker-intro p:last-child {
  margin-bottom: 0;
}

#voice-btn {
  font-size: 1.05rem;
  padding: 14px 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#voice-btn:hover {
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.4);
}

#voice-btn.listening {
  animation: glow 1.5s ease-in-out infinite;
  background: linear-gradient(135deg, #ef4444, #f87171);
}

/* ===================== TEACHER VIEW ===================== */

.teacher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  margin-bottom: 14px;
  animation: slideUp 0.4s ease-out;
}

.teacher-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1e3a5f, #4338ca);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.teacher-header h2:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
}

th {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #475569;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

th:first-child {
  border-radius: 12px 0 0 0;
}

th:last-child {
  border-radius: 0 12px 0 0;
}

td {
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
}

tbody tr:nth-child(even) {
  background: rgba(248, 250, 255, 0.5);
}

tbody tr:nth-child(even):hover {
  background: rgba(99, 102, 241, 0.06);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

textarea {
  border-radius: 14px;
  resize: vertical;
  min-height: 100px;
}

.feedback-box {
  margin-top: 12px;
  border-left: 5px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  padding: 14px 18px;
  border-radius: 14px;
  animation: slideIn 0.3s ease-out;
}

.feedback-box strong {
  color: #92400e;
}

.hidden {
  display: none;
}

.stars {
  font-size: 1.5rem;
  margin: 0;
}

.card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.task-card h3 {
  margin-bottom: 8px;
}

#student-view .feedback-box {
  margin-top: 16px;
}

/* ===================== CELEBRATION OVERLAY ===================== */

.celebration-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 3s ease-in forwards;
}

.star-celebration {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 6rem;
  z-index: 10000;
  pointer-events: none;
  animation: starPop 0.8s ease forwards;
}

/* ===================== RESPONSIVE ===================== */

@media (orientation: landscape) and (min-width: 680px) {
  .login-panel {
    max-width: 1140px;
    padding: 28px 24px;
  }

  .student-id-grid {
    max-height: 310px;
    overflow-x: hidden;
    overflow-y: auto;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    grid-auto-flow: row;
    grid-template-rows: repeat(5, minmax(54px, 1fr));
    grid-auto-columns: none;
    align-content: start;
  }
}

@media (max-width: 760px) {
  .login-panel {
    padding: 20px 14px;
    border-radius: 22px;
  }

  .student-id-grid {
    max-height: 250px;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .student-id-btn {
    font-size: 0.92rem;
    border-radius: 12px;
    padding: 8px 4px;
  }

  .login-choice-text {
    font-size: 0.95rem;
  }

  .matching {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .student-nav {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
  }

  .nav-tab {
    font-size: 0.82rem;
    padding: 10px 10px;
    border-radius: 12px;
  }

  .page-container {
    padding: 16px;
  }

  .page-panel h3 {
    font-size: 1.15rem;
  }

  .page-panel h3 .section-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    border-radius: 10px;
  }

  .floating-decor {
    display: none;
  }

  .chip {
    min-height: 48px;
    font-size: 1rem;
  }

  .city-item {
    padding: 8px 10px;
    gap: 8px;
  }

  .forecast-list {
    grid-template-columns: 1fr;
  }

  .forecast-days {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .forecast-day {
    min-width: 0;
  }

  .speaker-intro {
    padding: 14px 16px;
  }

  .student-header {
    padding: 10px 14px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .btn-star {
    padding: 10px 18px;
    font-size: 0.92rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 12px 8px 24px;
  }

  .login-title {
    font-size: 1.5rem;
  }

  .student-id-grid {
    grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
    gap: 6px;
  }

  .student-id-btn {
    font-size: 0.84rem;
    padding: 7px 3px;
    border-radius: 10px;
  }

  .chip-grid {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  }

  .forecast-days {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ===================== PRINT STYLES ===================== */

@media print {
  body::before,
  body::after,
  .floating-decor,
  .btn,
  .celebration-overlay {
    display: none !important;
  }

  .panel,
  .page-container,
  .student-header,
  .student-nav {
    box-shadow: none;
    backdrop-filter: none;
    border: 1px solid #ccc;
  }
}
