:root {
  color-scheme: light;
  --primary: #b919ea;
  --primary-light: #eccdf2;
  --primary-dark: #7f0f9f;
  --text: #44194b;
  --bg: #ffffff;
  --border: #dbeafe;
  --accent: #2563eb;
}

:root[data-theme="ocean"] {
  --primary: #0369a1;
  --primary-light: #e0f2fe;
  --primary-dark: #0c4a6e;
  --text: #0c4a6e;
  --bg: #ffffff;
  --border: #bae6fd;
  --accent: #00496d;
}

:root[data-theme="forest"] {
  --primary: #15803d;
  --primary-light: #f0fdf4;
  --primary-dark: #1b4332;
  --text: #1b4332;
  --bg: #ffffff;
  --border: #dcfce7;
  --accent: #0f5c2b;
}

:root[data-theme="sunset"] {
  --primary: #ea580c;
  --primary-light: #fed7aa;
  --primary-dark: #92400e;
  --text: #78350f;
  --bg: #ffffff;
  --border: #fed7aa;
  --accent: #f97416;
}

body {
  background: var(--primary-light);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}


.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1rem;
  background: var(--primary);
  color: #ffffff;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.header-brand .eyebrow {
  margin: 0;
  font-size: 0.85rem;
}

.header-brand h1 {
  margin: 0;
  font-size: 1.5rem;
}

.header-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-button {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #ffffff;
  padding: 0.6rem 1rem;
  font-size: 14pt;
  border-radius: 0.75rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s ease;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.nav-button.active {
  background: #ffffff;
  color: var(--primary);
  border-color: #ffffff;
}

.theme-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.theme-option {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 0.75rem;
  align-items: center;
  cursor: pointer;
}

.theme-option input[type="radio"] {
  display: none;
}

.theme-preview {
  width: 100%;
  height: 80px;
  border: 3px solid transparent;
  border-radius: 1rem;
  transition: all 0.25s ease;
}

.theme-option input[type="radio"]:checked + .theme-preview {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
  transform: scale(1.05);
}

.theme-name {
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}

.page-container h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.page-container h3 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.home-main {
  display: grid;
  gap: 1.5rem;
}

.home-top {
  display: grid;
  gap: 1rem;
}

.hero-card,
.leader-banner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 1.75rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.hero-card {
  background: var(--primary-light);
  border-color: var(--border);
}

.hero-card .eyebrow {
  margin: 0 0 0.75rem;
  color: #000000;
  opacity: 0.95;
}

.hero-card h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: clamp(2rem, 2.5vw, 2.75rem);
  line-height: 1.05;
}

#prize-display {
  text-align: center;
}

.hero-copy {
  margin: 0 0 1.5rem;
  max-width: 45rem;
  color: #43332d;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

button.secondary {
  background: transparent;
  color: #1f3f6e;
  border: 2px solid #1f3f6e;
}

button.secondary:hover,
button.secondary:focus-visible {
  background: #e0e7ff;
}

.home-summary {
  padding: 1.5rem 1.75rem;
  border-radius: 1.5rem;
  background: #f8fafc;
  border: 1px solid #dbeafe;
}

.home-summary p {
  margin: 0;
  font-size: 1rem;
}

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

.assignment-card {
  border-top: 4px solid #2563eb;
}

.assignment-card-head {
  margin-bottom: 1rem;
}

.assignment-card ul {
  margin-top: 0.75rem;
  padding-left: 1.25rem;
}

.assignment-card li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.assignment-card li:last-child {
  margin-bottom: 0;
}

.assignment-card .task-name {
  font-weight: 700;
}

.assignment-card .completed-task {
  opacity: 0.65;
  text-decoration: line-through;
}

.home-chart {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.95));
  border: 1px solid #dbeafe;
  border-radius: 1.75rem;
  padding: 1.5rem;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.05);
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.08) 1px, transparent 1px);
  background-size: 1rem 1.5rem;
}

.graph-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.graph-title h3 {
  margin: 0.25rem 0 0;
  font-size: 1.3rem;
}

.graph-summary {
  margin: 0 0 1.25rem;
  color: #334155;
  font-size: 1rem;
}

.graph-scale {
  color: #475569;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.assignment-card {
  background: var(--bg);
  border: 2px solid var(--accent);
  border-top-width: 4px;
  border-radius: 1.5rem;
  padding: 1.25rem;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}

.assignment-card.leader {
  border-color: #f59e0b;
  box-shadow: 0 16px 40px rgba(251, 146, 60, 0.14);
}

.assignment-card::before {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  top: 1.25rem;
  height: 1px;
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-12px);
}

.assignment-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.assignment-task-main {
  min-width: 0;
}

.assignment-task-points {
  white-space: nowrap;
}

.complete-all-button {
  appearance: none;
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0.6rem 0.9rem;
  border-radius: 1rem;
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.complete-all-button:hover,
.complete-all-button:focus-visible {
  background: #dbeafe;
}

.task-row input[type="checkbox"],
.task-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.task-name {
  display: inline-block;
}

.completed-task {
  text-decoration: line-through;
  color: #475569;
}

.assignment-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.points-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.95rem;
}

.progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
  height: 1rem;
  overflow: hidden;
  margin: 0.75rem 0 0.5rem;
}

.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 999px 0 0 999px;
}

.bar-label {
  margin: 0;
  font-size: 0.95rem;
  color: #475569;
}

.task-heading {
  margin: 1rem 0 0.5rem;
}

.assignment-card ul {
  padding-left: 1rem;
  margin: 0;
}

.assignment-card li {
  margin-bottom: 0.4rem;
  color: #475569;
}

.leader-banner {
  text-align: center;
  background: var(--primary);
  color: #ffffff;
}

.leader-banner h2 {
  color: #ffffff;
  margin: 0;
}

.top-leader-banner {
  padding: 1rem 1.25rem;
}

@media (max-width: 900px) {
  .hero-card h2 {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .hero-card,
  .leader-banner {
    padding: 1.25rem;
  }

  .hero-actions button {
    width: 100%;
  }
}

.form-section {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
}

.list-section {
  margin-top: 2rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.sidebar {
  padding: 1.5rem;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 1.5rem;
  min-width: 260px;
}

.sidebar h2 {
  margin-top: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li + li {
  margin-top: 0.75rem;
}

.nav-list a {
  display: block;
  color: #1e3a8a;
}

.workspace {
  display: grid;
  gap: 1rem;
}

.card,
.panel {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}


.layout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.form-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 1rem;
}

.form-row label {
  font-weight: 700;
}

.form-row input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  background: #f8fafc;
}

.form-row-checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
}

.checkbox-option input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #2563eb;
}

.form-hint {
  color: #475569;
  font-size: 0.95rem;
}

button {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #ffffff;
  padding: 0.9rem 1.15rem;
  border-radius: 1rem;
  cursor: pointer;
  font-weight: 700;
}

button:hover,
button:focus-visible {
  background: var(--primary);
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: #f8fafc;
  margin-top: 0.75rem;
}

.roommate-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}

.list-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.task-row label {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  margin: 0;
}

button.remove-button {
  appearance: none;
  border: 1px solid rgba(75, 85, 99, 0.2);
  background: #f8fafc;
  color: #334155;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

button.remove-button:hover,
button.remove-button:focus-visible {
  background: #e2e8f0;
  transform: scale(1.05);
}

.task-item {
  position: relative;
  padding-right: 0;
  min-height: auto;
  overflow: visible;
}

.task-summary {
  display: grid;
  gap: 0.2rem;
}

.task-name {
  font-weight: 700;
  left: 0;
}

.task-points {
  color: #475569;
  font-size: 0.95rem;
}

.task-weather-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 10rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.task-weather-container {
  justify-self: end;
}

.list li:first-child {
  margin-top: 0;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.assignment-card {
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.5rem;
  background: #f8fafc;
  border-left: 4px solid #2563eb;
}

.assignment-card h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: #1e293b;
}

.assignment-card p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.assignment-card p strong {
  color: #1e293b;
}

.assignment-card ul {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.assignment-card ul li {
  margin: 0.5rem 0;
  padding-left: 1rem;
  position: relative;
  font-size: 0.95rem;
}

.assignment-task {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding-right: 0;
  min-height: 3rem;
}

.assignment-task-main {
  display: grid;
  gap: 0.2rem;
  align-items: start;
}

.assignment-task-name {
  display: block;
  font-weight: 700;
  min-width: 0;
}

.assignment-task-points {
  color: #475569;
  font-size: 0.9rem;
}

.assignment-card ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2563eb;
}

.button-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button-row button {
  flex: 1;
  min-width: 120px;
}

/* Responsive Design */
.language-selector {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.language-option input[type="radio"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.language-option span {
  user-select: none;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-button {
    flex: 1;
    min-width: auto;
  }

  .page-container {
    padding: 1.5rem 1rem;
  }

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

  .assignment-task {
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
  }

  .task-weather-container {
    grid-column: auto;
  }

  .assignment-task-main {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 1rem 0.75rem;
  }

  .header-brand h1 {
    font-size: 1.25rem;
  }

  .header-nav {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .nav-button {
    width: 100%;
    text-align: center;
  }

  .page-container {
    padding: 1rem;
    border-radius: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row-checkbox {
    gap: 0.5rem;
  }

  .task-item {
    padding-right: 0;
  }

  .assignment-task {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.5rem;
    padding-right: 0;
    min-height: auto;
  }

  .assignment-task-main {
    grid-column: 1 / -1;
  }

  .task-weather-container {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
  }

  .task-weather-badge {
    max-width: 100%;
    font-size: 0.72rem;
    padding: 0.35rem 0.55rem;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }

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

  .main-content {
    padding: 1rem 0.75rem 1.5rem;
  }
}

/* Translation Loading Overlay */
.translation-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.translation-loading-content {
  background: var(--bg);
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.translation-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.translation-loading-content p {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

/* Form Validation Styles */
.form-group {
  position: relative;
  margin-bottom: 1rem;
}

.form-row input:invalid:not(:placeholder-shown),
.form-row input[aria-invalid="true"] {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.form-row input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.form-row input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(185, 25, 234, 0.1);
}

.form-error {
  display: none;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.375rem;
  margin-bottom: 0.5rem;
}

.form-error.show {
  display: block;
}

.form-error::before {
  content: "⚠ ";
  margin-right: 0.25rem;
}

.form-success {
  display: none;
  color: #15803d;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.375rem;
  margin-bottom: 0.5rem;
}

.form-success.show {
  display: block;
}

.form-success::before {
  content: "✓ ";
  margin-right: 0.25rem;
}

button[type="submit"]:disabled,
button[type="button"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

footer {
  text-align: center;
}