/*! components.css - Component-specific styles */

/* ===== Tab Navigation ===== */
.tabs-nav {
  position: sticky;
  top: 56px;
  z-index: 45;
  background: transparent;
  padding-top: 8px;
  margin-bottom: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 14px;
  flex-wrap: wrap;
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tabs-nav .tab-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  box-shadow: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  will-change: background, border-color, box-shadow;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.tabs-nav .tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  color: #ffffff;
}

.tabs-nav .tab-btn[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: none;
  color: #ffffff;
}

.tabs-nav .tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel:not(.active) {
  display: none !important;
}

/* ===== Responsive Tables & Canvases ===== */
.card canvas {
  max-width: 100%;
  display: block;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
table.wide {
  min-width: 600px;
}

.hscroll {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.hscroll table,
table.wide {
  min-width: 680px;
}

/* ===== Utilities ===== */
.mono {
  font-family: "Source Code Pro", "SFMono-Regular", Menlo, Consolas, monospace;
}

.big {
  font-size: 1.1em;
}

.kbd {
  font-family: "Source Code Pro", "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  contain: layout;
}

.kbd:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.kbd input[type="radio"] {
  cursor: pointer;
  accent-color: var(--accent);
}

.kbd input[type="radio"]:checked+span {
  color: #ffffff;
}

.banner {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(239, 68, 68, 0.08);
}

.kpi {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi .box {
  min-width: 200px;
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

/* ===== Keyword Tags (Homework Cards) ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.card:hover .tag {
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--text);
}

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

.toolbar .btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
}

.toolbar select,
.toolbar .select {
  height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
}

/* ===== Chart Containers ===== */
.limit-chart {
  width: 100%;
  height: 340px;
}

@media (min-width: 900px) {
  .limit-chart {
    height: 420px;
  }
}

@media (max-width: 800px) {
  .limit-chart {
    height: 260px;
  }
}

@media (max-width: 480px) {
  .limit-chart {
    height: 220px;
  }
}

/* ===== SQL Syntax Highlighting ===== */
code.language-sql .kw {
  color: #93c5fd;
  font-weight: 600;
}

code.language-sql .fn {
  color: #fde68a;
}

code.language-sql .num {
  color: #fca5a5;
}

code.language-sql .str {
  color: #86efac;
}

code.language-sql .op {
  color: #c4b5fd;
}

/* ===== Python Syntax Highlighting ===== */
code.language-python {
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  line-height: 1.6;
}

code.language-python .kw {
  color: #c792ea;
  font-weight: 600;
}

code.language-python .fn {
  color: #82aaff;
  font-weight: 600;
}

code.language-python .num {
  color: #f78c6c;
}

code.language-python .str {
  color: #c3e88d;
}

code.language-python .cm {
  color: #546e7a;
  font-style: italic;
}

/* ===== C/C++ Syntax Highlighting ===== */
code.language-c {
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  line-height: 1.6;
}

code.language-c .kw {
  color: #c792ea;
  font-weight: 600;
}

code.language-c .tp {
  color: #ff5370;
  font-weight: 600;
}

code.language-c .fn {
  color: #82aaff;
  font-weight: 600;
}

code.language-c .num {
  color: #f78c6c;
}

code.language-c .str {
  color: #c3e88d;
}

code.language-c .cm {
  color: #546e7a;
  font-style: italic;
}

/* ===== Homework 2 Styles ===== */
.HW2 .homework-section {
  margin-bottom: 48px;
}

.HW2 .homework-section:last-of-type {
  margin-bottom: 0;
}

.HW2 .homework-section .card+.card {
  margin-top: 20px;
}

.HW2 .toolbar {
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.HW2 select#lang {
  appearance: none;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
}

.HW2 select#lang:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.HW2 select#lang:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.HW2 .shift-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 8px;
  border-radius: 12px;
  box-shadow: none;
}

.HW2 .shift-control .prefix {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  margin-right: 2px;
}

.HW2 .shift-control input[type="number"] {
  width: 60px;
  height: 36px;
  background: rgba(5, 5, 8, 0.4);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.HW2 .shift-control input[type="number"]::-webkit-outer-spin-button,
.HW2 .shift-control input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.HW2 .shift-control input[type="number"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.HW2 .shift-control .steppers,
.rsa-keys .steppers,
.hw4-toolbar .stepper {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.btn.xs.inc,
.btn.xs.dec,
.btn.xs.minus,
.btn.xs.plus,
.HW2 .shift-control .steppers .btn.xs,
.hw4-toolbar .stepper .minus,
.hw4-toolbar .stepper .plus {
  /* WCAG 2.5.5: Touch targets must be at least 44×44px */
  height: 44px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
}

.btn.xs.inc:hover,
.btn.xs.dec:hover,
.btn.xs.minus:hover,
.btn.xs.plus:hover,
.HW2 .shift-control .steppers .btn.xs:hover,
.rsa-keys .key-chip .btn.xs:hover,
.hw4-toolbar .stepper .minus:hover,
.hw4-toolbar .stepper .plus:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.15);
  --btn-offset: -1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn.xs.inc:active,
.btn.xs.dec:active,
.btn.xs.minus:active,
.btn.xs.plus:active,
.HW2 .shift-control .steppers .btn.xs:active,
.rsa-keys .key-chip .btn.xs:active,
.hw4-toolbar .stepper .minus:active,
.hw4-toolbar .stepper .plus:active {
  --btn-offset: 0px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) inset;
}

/* ===== Homework 3 Styles ===== */
.HW3 .limit-chart {
  max-width: 100%;
}

/* HW3 textarea now uses unified textarea style defined below */

.HW3 label.kbd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.HW3 .box .big {
  font-weight: 800;
  font-size: 16px;
}

.HW3 .rsa-keys .key-chip,
.rsa-keys .key-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: none;
}

.HW3 .rsa-keys .key-chip .prefix {
  font-weight: 700;
  opacity: 0.9;
}

.HW3 .rsa-keys input[type="number"],
.rsa-keys input[type="number"],
.hw4-toolbar .stepper input[type="number"] {
  width: 72px;
  height: 36px;
  text-align: center;
  color: var(--text);
  background: rgba(5, 5, 8, 0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.HW3 .rsa-keys input[type="number"]:focus,
.rsa-keys input[type="number"]:focus,
.hw4-toolbar .stepper input[type="number"]:focus {
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.HW3 .rsa-keys input[type="number"]::-webkit-outer-spin-button,
.HW3 .rsa-keys input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.HW3 .rsa-keys input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ===== Homework 4 Styles ===== */
.HW4 .limit-chart {
  max-width: 100%;
  position: relative;
  width: 100%;
  background: rgba(5, 5, 8, 0.25);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.HW4 .limit-chart canvas {
  display: block;
  width: 100% !important;
}

.HW4 label.kbd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* HW4 input[type="number"] now uses unified style defined above */

/* HW4 uses standard components - no custom overrides needed */

.HW4 .card+.card {
  margin-top: 16px;
}

/* Modern Parameter Cards - Chips & Steppers (HW7) */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chips button {
  /* WCAG 2.5.5: Touch targets must be at least 44×44px */
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: rgba(235, 232, 248, 0.85);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
  contain: layout;
}

.chips button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.chips button.active,
.chips button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.chips button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: none;
  width: fit-content;
}

.stepper button {
  /* P0-3: Increased from 28px to 44px for touch accessibility (WCAG 2.5.5) */
  min-width: 44px;
  min-height: 44px;
  padding: 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(235, 232, 248, 0.9);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex-shrink: 0;
  contain: layout;
}

.stepper button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.stepper button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* P0-1: Add focus-visible for stepper buttons */
.stepper button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.stepper input[type="number"] {
  width: 70px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  padding: 0 6px;
  transition: all 0.2s ease;
  box-shadow: none;
  flex-shrink: 0;
}

.stepper input[type="number"]:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.stepper input[type="number"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.06);
}

/* Remove spinner arrows */
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Range slider styling for simulations */
input[type="range"] {
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
  margin-top: -6px;
  /* Center thumb: (18px thumb - 6px track) / 2 */
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
}

input[type="range"]::-moz-range-thumb:hover {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.6);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
}

.hw4-toolbar .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  grid-column: 1 / -1;
  margin-top: 2px;
}

/* Hide native number input spinners */
.hw4-toolbar input[type="number"]::-webkit-outer-spin-button,
.hw4-toolbar input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hw4-toolbar input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ===== Callouts & Tips ===== */
.callout {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  margin: 8px 0 12px 0;
}

.callout.tip {
  border-color: rgba(34, 197, 94, 0.35);
}

.tip {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  margin: 12px 0;
}

.card p {
  line-height: 1.55;
}

.card ul {
  margin: 6px 0 10px 16px;
}

.card ul li {
  margin: 4px 0;
}

/* ===== Prevent Grid Blowout ===== */
.grid>* {
  min-width: 0;
}

.grid .card {
  min-width: 0;
}

/* ===== Textarea Styles ===== */
textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
}

textarea:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

textarea::placeholder {
  color: rgba(235, 232, 248, 0.7);
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

/* ===== Homework 5 Styles ===== */
.HW5 .hw5-toolbar {
  margin-bottom: 16px;
}

.HW5 .hw5-toolbar .controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px 20px;
  margin-bottom: 16px;
}

.HW5 .hw5-toolbar .control {
  display: flex;
  flex-direction: column;
}

.HW5 .hw5-toolbar .control label {
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.HW5 .hw5-toolbar textarea,
.HW5 .hw5-toolbar input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
}

.HW5 .hw5-toolbar textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.HW5 .hw5-toolbar textarea:focus,
.HW5 .hw5-toolbar input[type="text"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.HW5 .hw5-toolbar .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.HW5 .results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
  max-width: 100%;
  overflow: hidden;
}

@media (min-width: 1400px) {
  .HW5 .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    max-width: 100%;
  }
}

@media (min-width: 1800px) {
  .HW5 .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    max-width: 100%;
  }
}

.HW5 .result-card {
  padding: 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  contain: layout;
}

.HW5 .result-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.HW5 .result-card.summary {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.HW5 .result-card h3,
.HW5 .result-card h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.HW5 .result-card h4 {
  font-size: 15px;
  opacity: 0.9;
}

.HW5 .result-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  margin: 12px 0;
  font-family: 'Source Code Pro', monospace;
  letter-spacing: -0.5px;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
}

.HW5 .result-formula {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  opacity: 0.85;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  overflow: hidden;
}

.HW5 .error {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-weight: 600;
}

/* ===== Homework 6 Styles ===== */
.HW6 .hw6-toolbar {
  margin-bottom: 16px;
}

.HW6 .hw6-toolbar .controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px 20px;
  margin-bottom: 16px;
}

.HW6 .hw6-toolbar .control {
  display: flex;
  flex-direction: column;
}

.HW6 .hw6-toolbar .control label {
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.HW6 .hw6-toolbar input[type="number"],
.HW6 .hw6-toolbar textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
}

.HW6 .hw6-toolbar textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.6;
}

.HW6 .hw6-toolbar input[type="number"]:focus,
.HW6 .hw6-toolbar textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.HW6 .hw6-toolbar .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.HW6 .stats-card {
  padding: 20px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: none;
  margin-bottom: 16px;
}

.HW6 .stats-card.online {
  border-color: rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}

.HW6 .stats-card.batch {
  border-color: rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}

.HW6 .stats-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 700;
}

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

.HW6 .stat-item {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.HW6 .stat-value {
  color: var(--accent);
  font-weight: 800;
  font-family: 'Source Code Pro', monospace;
  font-size: 16px;
}

.HW6 .values-list {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 16px;
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
}

.HW6 .formula-display {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.HW6 .formula-display p {
  margin: 8px 0;
}

.HW6 .comparison {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.HW6 .comparison h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--accent);
}

.HW6 table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.HW6 table th,
.HW6 table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.HW6 table thead th {
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
  color: var(--accent);
}

.HW6 table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== Homework 7 Styles ===== */
.HW7 .limit-chart {
  max-width: 100%;
  position: relative;
  width: 100%;
  background: rgba(5, 5, 8, 0.25);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.HW7 .limit-chart canvas {
  display: block;
  width: 100% !important;
}

.HW7 .hw4-toolbar {
  margin-bottom: 16px;
}

.HW7 .banner {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: rgba(239, 68, 68, 0.95);
  margin: 12px 0;
  font-weight: 600;
  font-size: 14px;
}