/* ==========================================================================
   سند (Sanad) - منصة التخاطب والتواصل المعزز للأطفال والمكفوفين
   Accessible CSS - High Contrast, Big Touch Targets, WCAG AAA Compliance
   ========================================================================== */

:root {
  --bg-color: #f0f7ff;
  --surface-color: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --focus-ring: #fbbf24;
  --card-radius: 24px;
  --font-family: "Segoe UI", Tahoma, "Cairo", Arial, sans-serif;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --card-press: 0 2px 4px rgba(0,0,0,0.1);
}

/* الوضع عالي التباين للمكفوفين وضعاف البصر (High Contrast Neon Mode) */
body.high-contrast {
  --bg-color: #000000;
  --surface-color: #121212;
  --text-main: #ffffff;
  --text-muted: #e2e8f0;
  --border-color: #ffd700;
  --primary: #ffd700;
  --primary-hover: #ffea00;
  --focus-ring: #00ffff;
  --shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  user-select: none;
}

/* Focus indicator for keyboard/blind navigation */
*:focus-visible {
  outline: 6px solid var(--focus-ring) !important;
  outline-offset: 4px !important;
}

/* Header */
header {
  background: var(--surface-color);
  border-bottom: 3px solid var(--border-color);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 38px;
  line-height: 1;
}

.brand-title h1 {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 2px;
}

body.high-contrast .brand-title h1 {
  color: #ffd700;
}

.brand-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-ctrl {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-ctrl:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

body.high-contrast .btn-ctrl:hover {
  background: #ffd700;
  color: #000;
}

.btn-ctrl.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

body.high-contrast .btn-ctrl.active {
  background: #ffd700;
  color: #000;
}

/* Nav Tabs */
nav.nav-tabs {
  background: var(--surface-color);
  border-bottom: 2px solid var(--border-color);
  padding: 10px 16px;
}

.tabs-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: 3px solid transparent;
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: rgba(37, 99, 235, 0.08);
}

body.high-contrast .tab-btn:hover {
  background: rgba(255, 215, 0, 0.15);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

body.high-contrast .tab-btn.active {
  background: #ffd700;
  color: #000;
  border-color: #fff;
}

/* Main Content Area */
main {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-intro {
  margin-bottom: 24px;
  text-align: center;
}

.section-intro h2 {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--primary);
}

body.high-contrast .section-intro h2 {
  color: #ffd700;
}

.section-intro p {
  font-size: 17px;
  color: var(--text-muted);
}

/* ==========================================================================
   1. AAC CARDS GRID (التواصل والاحتياجات)
   ========================================================================== */
.aac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.aac-card {
  background: var(--surface-color);
  border: 4px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
  min-height: 180px;
}

.aac-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--primary);
}

.aac-card:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: var(--card-press);
}

body.high-contrast .aac-card {
  border-width: 4px;
  border-color: #ffd700;
}

body.high-contrast .aac-card:hover {
  border-color: #ffffff;
  background: #1a1a1a;
}

.card-icon {
  font-size: 64px;
  margin-bottom: 12px;
  line-height: 1;
}

.card-label {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.3;
}

.card-subtext {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Card Categories Colors */
.aac-card[data-cat="need"] { border-bottom: 8px solid #38bdf8; }
.aac-card[data-cat="pain"] { border-bottom: 8px solid #f87171; }
.aac-card[data-cat="feeling"] { border-bottom: 8px solid #fbbf24; }
.aac-card[data-cat="social"] { border-bottom: 8px solid #34d399; }
.aac-card[data-cat="family"] { border-bottom: 8px solid #c084fc; }

body.high-contrast .aac-card[data-cat] {
  border-bottom: 8px solid #ffd700;
}

/* ==========================================================================
   2. LETTERS & PHONICS (مدرسة الحروف والنطق)
   ========================================================================== */
.letters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.letter-card {
  background: var(--surface-color);
  border: 4px solid var(--border-color);
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
  min-height: 140px;
}

.letter-card:hover {
  transform: scale(1.05);
  border-color: var(--primary);
}

.letter-char {
  font-size: 54px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 6px;
}

body.high-contrast .letter-char {
  color: #ffd700;
}

.letter-word {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.letter-example {
  font-size: 26px;
  margin-top: 4px;
}

/* ==========================================================================
   3. AUDIO GUESSING GAME (لعبة التمييز السمعي)
   ========================================================================== */
.game-container {
  background: var(--surface-color);
  border: 4px solid var(--border-color);
  border-radius: 32px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 850px;
  margin: 0 auto;
}

.game-audio-button {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border: 4px solid #fff;
  border-radius: 999px;
  width: 140px;
  height: 140px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-audio-button:hover {
  transform: scale(1.08);
}

body.high-contrast .game-audio-button {
  background: #ffd700;
  color: #000;
  border-color: #ffd700;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.game-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 32px;
}

.choice-btn {
  background: var(--surface-color);
  border: 4px solid var(--border-color);
  border-radius: 20px;
  padding: 22px 14px;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}

.choice-btn .choice-icon {
  font-size: 48px;
}

.choice-btn:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}

.choice-btn.correct {
  background: #22c55e !important;
  color: #fff !important;
  border-color: #16a34a !important;
  animation: pulse 0.5s ease;
}

.choice-btn.wrong {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.game-score {
  font-size: 22px;
  font-weight: 800;
  margin-top: 24px;
  color: var(--primary);
}

body.high-contrast .game-score {
  color: #ffd700;
}

/* ==========================================================================
   4. SETTINGS & LOGS (لوحة الأخصائي وولي الأمر)
   ========================================================================== */
.settings-box {
  background: var(--surface-color);
  border: 3px solid var(--border-color);
  border-radius: 28px;
  padding: 30px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  gap: 20px;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info h4 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 4px;
}

.setting-info p {
  font-size: 14px;
  color: var(--text-muted);
}

.setting-control input[type="range"] {
  width: 160px;
  height: 8px;
  cursor: pointer;
}

.setting-control select {
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  font-size: 16px;
  font-weight: 700;
  background: var(--surface-color);
  color: var(--text-main);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.log-table th, .log-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

.log-table th {
  background: rgba(37, 99, 235, 0.08);
  font-weight: 800;
}

body.high-contrast .log-table th {
  background: #222;
  color: #ffd700;
}

/* Speaking Visual Toast */
.speaking-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: #ffffff;
  padding: 16px 28px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  border: 3px solid #38bdf8;
}

body.high-contrast .speaking-toast {
  background: #000;
  border-color: #ffd700;
  color: #ffd700;
}

.speaking-toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-soundwave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.toast-soundwave span {
  width: 4px;
  height: 100%;
  background: #38bdf8;
  border-radius: 2px;
  animation: wave 0.8s ease infinite alternate;
}

body.high-contrast .toast-soundwave span {
  background: #ffd700;
}

.toast-soundwave span:nth-child(2) { animation-delay: 0.2s; height: 60%; }
.toast-soundwave span:nth-child(3) { animation-delay: 0.4s; height: 85%; }

@keyframes wave {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* Quick Custom Speech Box (for Mute & Non-verbal) */
.custom-speak-card {
  background: var(--surface-color);
  border: 3px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

body.high-contrast .custom-speak-card {
  background: #111;
  border-color: #ffd700;
}

.custom-speak-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.custom-speak-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
}

body.high-contrast .custom-speak-title {
  color: #ffd700;
}

.custom-speak-hint {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.custom-speak-body {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

#customTextInput {
  flex: 1;
  padding: 14px 18px;
  font-size: 20px;
  font-weight: 700;
  border: 3px solid var(--border-color);
  border-radius: 16px;
  background: var(--surface-color);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

#customTextInput:focus {
  border-color: var(--primary);
}

body.high-contrast #customTextInput {
  background: #000;
  color: #fff;
  border-color: #ffd700;
}

.btn-custom-speak {
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
  transition: transform 0.15s, background-color 0.2s;
  white-space: nowrap;
}

.btn-custom-speak:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-custom-speak:active {
  transform: translateY(2px);
}

body.high-contrast .btn-custom-speak {
  background: #ffd700;
  color: #000;
}

.quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.chips-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-muted);
}

.chip-btn {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text-main);
  border: 2px solid var(--border-color);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

body.high-contrast .chip-btn {
  background: #222;
  color: #ffd700;
  border-color: #ffd700;
}

body.high-contrast .chip-btn:hover {
  background: #ffd700;
  color: #000;
}

/* Speech-to-Text for the Deaf (أنا أسمعك) */
.stt-container {
  background: var(--surface-color);
  border: 3px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.high-contrast .stt-container {
  background: #111;
  border-color: #ffd700;
}

.stt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.stt-main-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-mic {
  background: #10b981;
  color: #ffffff;
  border: 3px solid #059669;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-mic:hover {
  transform: scale(1.04);
}

.btn-mic.recording {
  background: #ef4444;
  border-color: #b91c1c;
  animation: micPulse 1.4s infinite;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

body.high-contrast .btn-mic {
  background: #000;
  color: #ffd700;
  border-color: #ffd700;
}

body.high-contrast .btn-mic.recording {
  background: #ffd700;
  color: #000;
  border-color: #ffffff;
}

.stt-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  background: #f1f5f9;
  color: #475569;
}

.stt-status-badge .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.stt-status-badge.listening {
  background: #fee2e2;
  color: #991b1b;
}

.stt-status-badge.listening .status-dot {
  background: #ef4444;
  animation: blink 0.8s infinite alternate;
}

body.high-contrast .stt-status-badge {
  background: #222;
  color: #ffd700;
}

@keyframes blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

.stt-options {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.stt-option-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
}

.stt-option-item select {
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  font-weight: 700;
  background: var(--surface-color);
  color: var(--text-main);
}

.stt-buttons-row {
  display: flex;
  gap: 8px;
}

.btn-ctrl-alt {
  padding: 8px 16px;
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn-ctrl-alt:hover {
  background: #e2e8f0;
}

body.high-contrast .btn-ctrl-alt {
  background: #000;
  color: #ffd700;
  border-color: #ffd700;
}

/* Audio wave animation bars */
.stt-wave-container {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
}

.stt-wave-container.active {
  display: flex;
}

.wave-bar {
  width: 6px;
  height: 100%;
  background: #10b981;
  border-radius: 4px;
  animation: waveBar 0.9s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.15s; }
.wave-bar:nth-child(3) { animation-delay: 0.3s; }
.wave-bar:nth-child(4) { animation-delay: 0.45s; }
.wave-bar:nth-child(5) { animation-delay: 0.3s; }
.wave-bar:nth-child(6) { animation-delay: 0.15s; }
.wave-bar:nth-child(7) { animation-delay: 0.05s; }

@keyframes waveBar {
  0% { height: 15%; }
  100% { height: 100%; }
}

body.high-contrast .wave-bar {
  background: #ffd700;
}

/* Big Display Area */
.stt-display {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 20px;
  padding: 28px;
  min-height: 340px;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 4px solid #334155;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

body.high-contrast .stt-display {
  background: #000;
  border-color: #ffd700;
  color: #ffff00;
}

.stt-placeholder {
  margin: auto;
  text-align: center;
  color: #94a3b8;
  font-size: 22px;
  font-weight: 700;
  padding: 40px 20px;
}

body.high-contrast .stt-placeholder {
  color: #888;
}

.stt-display.font-lg {
  font-size: 28px;
  line-height: 1.5;
}

.stt-display.font-xl {
  font-size: 40px;
  line-height: 1.45;
}

.stt-display.font-giant {
  font-size: 54px;
  line-height: 1.4;
}

.stt-interim {
  color: #38bdf8;
  font-style: italic;
  font-weight: 800;
  padding: 10px 16px;
  background: rgba(56, 189, 248, 0.12);
  border-radius: 14px;
  border-right: 6px solid #38bdf8;
  display: none;
}

.stt-interim:not(:empty) {
  display: block;
}

body.high-contrast .stt-interim {
  color: #00ffff;
  background: rgba(0, 255, 255, 0.15);
  border-right-color: #00ffff;
}

.stt-messages-list {
  display: flex;
  flex-direction: column-reverse;
  gap: 16px;
}

.stt-bubble {
  background: rgba(255, 255, 255, 0.08);
  padding: 16px 22px;
  border-radius: 18px;
  border-right: 8px solid #22c55e;
  font-weight: 800;
  animation: fadeInBubble 0.25s ease-out;
}

@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

body.high-contrast .stt-bubble {
  background: #181818;
  color: #ffffff;
  border-right-color: #ffd700;
}

/* Arabic Sign Language Dictionary (قاموس لغة الإشارة) */
.sign-filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sign-filter-btn {
  padding: 12px 24px;
  border-radius: 999px;
  border: 3px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-main);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
}

.sign-filter-btn:hover {
  border-color: var(--primary);
}

.sign-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37,99,235,0.25);
}

body.high-contrast .sign-filter-btn {
  background: #111;
  color: #fff;
  border-color: #ffd700;
}

body.high-contrast .sign-filter-btn.active {
  background: #ffd700;
  color: #000;
  border-color: #fff;
}

.sign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.sign-card {
  background: var(--surface-color);
  border: 3px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28), box-shadow 0.2s;
}

.sign-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

body.high-contrast .sign-card {
  background: #111;
  border-color: #ffd700;
}

body.high-contrast .sign-card:hover {
  border-color: #fff;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.sign-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sign-badge {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 900;
}

body.high-contrast .sign-badge {
  background: #222;
  color: #ffd700;
  border: 1px solid #ffd700;
}

.sign-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-main);
}

body.high-contrast .sign-title {
  color: #ffffff;
}

.sign-visual-box {
  background: #f8fafc;
  border: 2px dashed var(--border-color);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 120px;
}

body.high-contrast .sign-visual-box {
  background: #000;
  border-color: #ffd700;
}

.sign-visual-icon {
  font-size: 52px;
  line-height: 1;
}

.sign-visual-hand {
  font-size: 22px;
  font-weight: 900;
  color: #0284c7;
}

body.high-contrast .sign-visual-hand {
  color: #00ffff;
}

.sign-desc-box {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.02);
  padding: 12px;
  border-radius: 12px;
  border-right: 4px solid var(--primary);
}

body.high-contrast .sign-desc-box {
  background: #181818;
  color: #f1f5f9;
  border-right-color: #ffd700;
}

.sign-desc-label {
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 4px;
  display: block;
}

body.high-contrast .sign-desc-label {
  color: #ffd700;
}

.btn-sign-speak {
  width: 100%;
  padding: 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--primary);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-sign-speak:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

body.high-contrast .btn-sign-speak {
  background: #000;
  color: #ffd700;
  border-color: #ffd700;
}

body.high-contrast .btn-sign-speak:hover {
  background: #ffd700;
  color: #000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .aac-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .card-icon { font-size: 52px; }
  .card-label { font-size: 19px; }
  .tab-btn { font-size: 15px; padding: 10px 16px; }
  .letters-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .header-container { justify-content: center; text-align: center; }
  .brand { flex-direction: column; }
  .controls { width: 100%; justify-content: center; }
  .aac-grid { grid-template-columns: 1fr; }
}
