/* Latin Grammar Studio — Premium Modern CSS */

:root {
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-hover: #1b2640;
  --bg-panel: #0f172a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(226, 177, 68, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --gold-primary: #e2b144;
  --gold-light: #fcd34d;
  --gold-dark: #b45309;
  
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Typography Headings */
h1, h2, h3, .brand-title {
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

.latin-term, .font-serif {
  font-family: 'Cinzel', serif;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* HEADER */
.studio-header {
  height: 72px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(226, 177, 68, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.header-brand h1 span {
  color: var(--gold-light);
}

.syllabus-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-pill.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.stat-pill.progress-pill {
  background: linear-gradient(135deg, rgba(226, 177, 68, 0.15), rgba(56, 189, 248, 0.15));
  border-color: var(--border-highlight);
  color: var(--gold-light);
  font-weight: 600;
}

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

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--gold-primary);
  color: #0b0f19;
}
.btn-primary:hover {
  background: var(--gold-light);
  box-shadow: 0 0 15px rgba(226, 177, 68, 0.4);
}

.btn-trainer {
  background: linear-gradient(135deg, #e2b144, #f59e0b);
  color: #0b0f19;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(226, 177, 68, 0.25);
}
.btn-trainer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(226, 177, 68, 0.4);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-learning {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}
.btn-learning:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-mastered {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}
.btn-mastered:hover {
  background: rgba(16, 185, 129, 0.25);
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.badge-accidence {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-syntax {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-mastered {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

/* MAIN VIEWPORT WRAPPER */
.app-viewport-wrapper {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - 72px);
}

/* 3-COLUMN STUDIO LAYOUT */
.studio-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Column Base Styling */
.column {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
  background: var(--bg-panel);
}

.column:last-child {
  border-right: none;
}

.col-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  min-height: 64px;
}

.col-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.col-title .icon {
  font-size: 1.2rem;
}

.col-title h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

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

/* COLUMN 1: SPEC NAVIGATION */
.spec-nav-col {
  background: #0d1322;
}

.spec-search-box {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.spec-search-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.spec-search-box input:focus {
  border-color: var(--gold-primary);
}

.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-tab {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-tab.active {
  background: rgba(226, 177, 68, 0.15);
  border-color: var(--border-highlight);
  color: var(--gold-light);
}

.spec-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  padding: 10px 8px 4px 8px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spec-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.spec-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

.spec-item.active {
  background: rgba(226, 177, 68, 0.1);
  border-color: var(--border-highlight);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.spec-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.spec-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.spec-item.active .spec-code {
  color: var(--gold-light);
}

.spec-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.spec-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.spec-cards-count {
  display: flex;
  align-items: center;
  gap: 4px;
}


/* COLUMN 2: DETAILED SPECIFICATION BLUEPRINT & PARADIGMS */
.spec-detail-col {
  background: #0e1424;
}

.spec-code-badge {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(226, 177, 68, 0.2);
  color: var(--gold-light);
  border: 1px solid var(--border-highlight);
  padding: 4px 10px;
}

.spec-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.spec-banner {
  background: linear-gradient(135deg, rgba(19, 27, 46, 0.9), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.spec-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold-primary);
}

.spec-banner-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.spec-banner h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.spec-banner p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Formula Box */
.formula-box {
  background: rgba(226, 177, 68, 0.08);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.formula-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  margin-bottom: 6px;
}

.formula-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #fef08a;
  line-height: 1.4;
  word-break: break-word;
}

/* Paradigm / Declension Table */
.paradigm-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.paradigm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.paradigm-table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  color: var(--gold-light);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.paradigm-table td {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  white-space: nowrap;
}

.paradigm-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.paradigm-table td:first-child {
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.15);
}

/* Syllabus Points List */
.spec-points-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.spec-points-card ul {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.spec-points-card li {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.spec-points-card li::before {
  content: "•";
  color: var(--accent-cyan);
  font-weight: bold;
}

/* Examiner Pitfalls Box */
.pitfalls-box {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.pitfalls-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fb7185;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pitfalls-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #fecdd3;
}


/* COLUMN 3: FLASHCARDS STREAM */
.flashcards-col {
  background: #0b101d;
}

.cards-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Flashcard Component (Stream View) */
.flashcard-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.flashcard-item:hover {
  border-color: rgba(226, 177, 68, 0.3);
  box-shadow: var(--shadow-md);
}

.flashcard-item.is-mastered {
  border-left: 4px solid var(--accent-emerald);
}

.flashcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flashcard-prompt {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Card Reveal Section */
.flashcard-reveal-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--gold-light);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.flashcard-reveal-btn:hover {
  background: rgba(226, 177, 68, 0.1);
  border-color: var(--gold-primary);
}

.flashcard-answer-box {
  display: none;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border-left: 3px solid var(--accent-cyan);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-def-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-line;
}

.card-example-pill {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: #bae6fd;
}

.card-example-pill strong {
  color: #38bdf8;
}

.card-tip-pill {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #fecdd3;
}

.card-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag-pill {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}


/* SIMULATED IPHONE 15 VIEWPORT */
.iphone-shell-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #060911;
}

.iphone-frame {
  width: 400px;
  height: 820px;
  max-height: 94vh;
  background: #000;
  border-radius: 54px;
  padding: 12px;
  box-shadow: 0 0 0 4px #2a2e39, 0 25px 60px rgba(0, 0, 0, 0.9);
  position: relative;
  display: flex;
  flex-direction: column;
}

.iphone-screen {
  width: 100%;
  height: 100%;
  background: #0d1322;
  border-radius: 44px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.iphone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
}

.dynamic-island {
  width: 110px;
  height: 28px;
  background: #000;
  border-radius: 20px;
}

.ios-status-bar {
  height: 44px;
  padding: 12px 24px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 10;
}

.mobile-app-header {
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-logo {
  font-size: 1.4rem;
}

.mobile-brand h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-light);
}

.mobile-brand p {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.mobile-header-badge {
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.mobile-screen-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mobile-tab-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px;
}

.mobile-tab-view.active {
  display: flex;
}

.mobile-search-bar input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.mobile-spec-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mobile Card Viewport */
.mobile-card-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.mobile-card-counter {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.mobile-card-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.mobile-card-controls button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
}

/* iOS Bottom Tab Bar */
.ios-bottom-nav {
  height: 64px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: 14px;
}

.ios-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 12px;
  transition: color 0.15s ease;
}

.ios-nav-btn .nav-icon {
  font-size: 1.2rem;
}

.ios-nav-btn .nav-label {
  font-size: 0.65rem;
  font-weight: 600;
}

.ios-nav-btn.active {
  color: var(--gold-light);
}

.ios-home-bar {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 4px;
  background: #ffffff;
  border-radius: 4px;
  opacity: 0.6;
}


/* FULLSCREEN 3D FLASHCARD TRAINER MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.trainer-modal-card {
  width: 680px;
  max-width: 95vw;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.trainer-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.trainer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trainer-counter {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.btn-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.trainer-progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  width: 100%;
}

.trainer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--accent-emerald));
  width: 0%;
  transition: width 0.25s ease;
}

/* 3D Flashcard Structure */
.trainer-card-area {
  padding: 30px;
  perspective: 1200px;
  min-height: 380px;
  cursor: pointer;
  display: flex;
}

.flashcard-3d {
  width: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 320px;
}

.flashcard-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-color);
  background: linear-gradient(145deg, #18223a, #111827);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.card-face-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.card-prompt-label {
  color: var(--gold-light);
}

.card-answer-label {
  color: var(--accent-cyan);
}

.card-hint {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.card-prompt-text {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin: auto 0;
}

.card-face-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #101c33, #0d1527);
  border-color: rgba(56, 189, 248, 0.3);
  overflow-y: auto;
}

.card-front-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 12px;
}

.trainer-actions {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.keyboard-hints {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.action-btn-group {
  display: flex;
  gap: 12px;
}

.action-btn-group button {
  flex: 1;
  padding: 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-flip-cta {
  background: rgba(226, 177, 68, 0.15);
  border: 1px solid var(--border-highlight);
  color: var(--gold-light);
}

/* EXPORT MODAL */
.modal-box {
  width: 540px;
  max-width: 92vw;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.export-options {
  display: flex;
  gap: 8px;
}

.export-textarea {
  width: 100%;
  height: 200px;
  background: #090e1a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: #cbd5e1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  resize: vertical;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* RESPONSIVE LAYOUT FOR IPAD & TABLETS */
@media (max-width: 1200px) and (min-width: 768px) {
  .studio-container {
    grid-template-columns: 280px 1fr;
    height: calc(100vh - 72px);
  }
  .spec-detail-col {
    overflow-y: auto;
  }
}

/* MOBILE PHONES (under 768px) */
@media (max-width: 767px) {
  .studio-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
  }
  .column {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    height: auto;
  }
  .app-viewport-wrapper {
    height: auto;
  }
}


/* VISUAL PATTERN MAP & INTERACTIVE CASE INSPECTOR */
.pattern-map-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(226, 177, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pattern-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pattern-map-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.pattern-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.pattern-card:hover {
  border-color: var(--gold-primary);
  background: rgba(226, 177, 68, 0.08);
  transform: translateY(-1px);
}

.pattern-card.active-pattern {
  border-color: var(--gold-primary);
  background: rgba(226, 177, 68, 0.15);
  box-shadow: 0 0 12px rgba(226, 177, 68, 0.2);
}

.pattern-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pattern-rule {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.pattern-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* CASE INSPECTOR CONTROLS */
.case-inspector-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.case-btn {
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.case-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.case-btn.active-case {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #38bdf8;
}

.paradigm-table tr.highlighted-row td {
  background: rgba(56, 189, 248, 0.18) !important;
  color: #fff !important;
  font-weight: 700;
}

.paradigm-table tr.dimmed-row {
  opacity: 0.35;
}

/* COLOR CODED CASE BADGES */
.case-tag-nom { color: #facc15; }
.case-tag-acc { color: #38bdf8; }
.case-tag-gen { color: #c084fc; }
.case-tag-dat { color: #fb923c; }
.case-tag-abl { color: #34d399; }

/* SPEED DRILL MODAL */
.drill-card-area {
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.drill-word-display {
  font-family: 'Cinzel', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px rgba(226, 177, 68, 0.3);
}

.drill-sub-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.drill-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 480px;
}

.drill-opt-btn {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drill-opt-btn:hover {
  background: rgba(226, 177, 68, 0.15);
  border-color: var(--gold-primary);
}

.drill-opt-btn.correct {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: var(--accent-emerald) !important;
  color: #34d399 !important;
}

.drill-opt-btn.wrong {
  background: rgba(244, 63, 94, 0.3) !important;
  border-color: var(--accent-rose) !important;
  color: #fda4af !important;
}


/* ENHANCED PARADIGM TABLE TYPOGRAPHY & INLINE TRANSLATIONS */
.paradigm-table th {
  background: rgba(15, 23, 42, 0.9);
  padding: 12px 14px;
  color: var(--gold-light);
  font-weight: 700;
  border-bottom: 2px solid rgba(226, 177, 68, 0.4);
  white-space: nowrap;
  font-size: 0.82rem;
}

.paradigm-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.cell-latin-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cell-latin-word {
  font-family: 'Cinzel', serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.cell-latin-word .ending {
  color: var(--gold-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cell-latin-word.neuter-match {
  color: #34d399;
}

.cell-trans {
  font-family: 'Inter', sans-serif;
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.3;
}

.case-func-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.case-func-sub {
  font-size: 0.72rem;
  color: var(--gold-light);
  font-weight: 600;
}

/* MASTER PATTERN DECODER */
.pattern-catalog {
  background: linear-gradient(135deg, rgba(24, 34, 58, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(226, 177, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.pattern-catalog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.pattern-catalog-title h3 {
  font-size: 1.05rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pattern-cards-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.pattern-tile {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pattern-tile:hover {
  background: rgba(226, 177, 68, 0.1);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

.pattern-tile.active-tile {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.tile-icon-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tile-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.tile-rule {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #fef08a;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 6px;
  border-radius: 4px;
}

.tile-explanation {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* MASCULINE COMPARISON & BADGE STYLES */
.badge-same {
  display: inline-block;
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-diff {
  display: inline-block;
  background: rgba(244, 63, 94, 0.25);
  color: #fda4af;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.masc-compare-banner {
  background: linear-gradient(135deg, rgba(226, 177, 68, 0.15), rgba(56, 189, 248, 0.15));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.masc-compare-banner h5 {
  font-size: 0.85rem;
  color: var(--gold-light);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.masc-compare-banner p {
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.4;
}

/* Masculine Twin Hero Blueprint Card */
.masc-hero-card {
  background: linear-gradient(135deg, rgba(226, 177, 68, 0.12) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(226, 177, 68, 0.45);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 18px 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.masc-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(226, 177, 68, 0.2);
}

.masc-hero-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.masc-icon {
  font-size: 1.8rem;
  background: rgba(226, 177, 68, 0.15);
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(226, 177, 68, 0.3);
}

.masc-hero-title h4 {
  font-size: 1.1rem;
  color: var(--gold-light);
  font-weight: 700;
  margin: 0;
}

.masc-subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 2px;
}

.compare-toggle-btn {
  background: rgba(226, 177, 68, 0.2);
  border: 1px solid var(--gold-primary);
  color: var(--gold-light);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.compare-toggle-btn:hover {
  background: rgba(226, 177, 68, 0.35);
  transform: translateY(-1px);
}

.compare-toggle-btn.active {
  background: var(--gold-primary);
  color: #0b0f19;
  box-shadow: 0 0 12px rgba(226, 177, 68, 0.5);
}

.masc-hero-body {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.masc-hero-diffs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.diff-card-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: 8px;
  padding: 12px 14px;
}

.diff-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.diff-badge.diff-num {
  color: #fca5a5;
  display: flex;
  align-items: center;
  gap: 4px;
}

.diff-badge.match-num {
  color: #6ee7b7;
}

.diff-pair {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  background: rgba(2, 6, 23, 0.5);
  border-radius: 6px;
  padding: 8px;
}

.diff-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.diff-latin {
  font-size: 1.05rem;
  font-family: 'Cinzel', serif;
  color: #fff;
}

.diff-latin strong {
  color: var(--gold-light);
  text-decoration: underline;
}

.diff-note {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}

.diff-vs {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f43f5e;
}

.masc-hero-matches {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
}

.match-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.match-chip {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
  font-size: 0.74rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.match-chip strong {
  color: #34d399;
}

.masc-hero-trap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #fef08a;
  line-height: 1.4;
}

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

/* Badges for Masculine Comparison */
.badge-masc-std {
  display: inline-block;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 4px;
}

.badge-masc-diff {
  display: inline-block;
  background: rgba(244, 63, 94, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(244, 63, 94, 0.45);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 4px;
}

.badge-masc-diff-voc {
  display: inline-block;
  background: rgba(245, 158, 11, 0.25);
  color: #fde047;
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 4px;
}

.badge-masc-match {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 4px;
}

/* Table Header Styles for Masculine Columns */
.th-col-masc-std {
  background: rgba(56, 189, 248, 0.08) !important;
  border-bottom: 2px solid rgba(56, 189, 248, 0.6) !important;
}

.th-col-masc-var {
  background: rgba(226, 177, 68, 0.08) !important;
  border-bottom: 2px solid var(--gold-primary) !important;
}

.badge-header-std {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 0.62rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-header-gold {
  background: rgba(226, 177, 68, 0.25);
  color: var(--gold-light);
  font-size: 0.62rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.th-top-tag {
  margin-bottom: 4px;
}

.th-main-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.th-sub-note {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: normal;
  margin-top: 2px;
}

/* Row flags */
.masc-row-flag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
}

.masc-row-flag.flag-diff {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.masc-row-flag.flag-same {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Row and column highlight states */
.row-masc-diff {
  background: rgba(239, 68, 68, 0.04);
}

.paradigm-table td.cell-masc-std {
  background: rgba(56, 189, 248, 0.02);
}

.paradigm-table td.cell-masc-var {
  background: rgba(226, 177, 68, 0.02);
}

.paradigm-table td.masc-col-active {
  background: rgba(226, 177, 68, 0.08) !important;
  border-left: 1px solid rgba(226, 177, 68, 0.25);
  border-right: 1px solid rgba(226, 177, 68, 0.25);
}

.paradigm-table td.masc-diff-spotlight {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
}

.paradigm-table td.masc-match-spotlight {
  background: rgba(16, 185, 129, 0.08) !important;
  border-left: 1px dashed rgba(16, 185, 129, 0.3);
  border-right: 1px dashed rgba(16, 185, 129, 0.3);
}

.paradigm-table td.col-dimmed {
  opacity: 0.2;
}

/* ==========================================================================
   AUTHENTIC IPADOS APP ARCHITECTURE (NO SIMULATOR)
   ========================================================================== */
.ipad-navbar {
  height: 64px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn.active {
  background: rgba(226, 177, 68, 0.18);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.navbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* NATIVE IPADOS 2-PANE APP LAYOUT */
.ipad-app-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  width: 100%;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  overflow: hidden;
  transition: grid-template-columns 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ipad-app-layout.sidebar-collapsed {
  grid-template-columns: 0px 1fr;
}

.ipad-sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: opacity 0.2s ease;
  padding-left: env(safe-area-inset-left);
}

.ipad-app-layout.sidebar-collapsed .ipad-sidebar {
  opacity: 0;
  pointer-events: none;
}

.ipad-main-stage {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.ipad-main-stage .spec-detail-body {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
}

@media (max-width: 820px) {
  .ipad-app-layout {
    grid-template-columns: 280px 1fr;
  }
  .navbar-center {
    display: none;
  }
}

/* ==========================================================================
   2nd Declension Masculine Variants Card & Progression Table
   ========================================================================== */
.decl2-variant-card {
  background: linear-gradient(145deg, rgba(26, 32, 53, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(226, 177, 68, 0.4);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 16px 0 24px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.variant-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.variant-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.variant-badge {
  background: rgba(226, 177, 68, 0.18);
  color: var(--gold-light);
  border: 1px solid rgba(226, 177, 68, 0.5);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.variant-card-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.variant-lead-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 14px 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variant-lead-row {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.variant-lead-row strong {
  color: #ffffff;
}

.variant-lead-row em {
  color: var(--gold-light);
  font-style: italic;
}

/* 3 Column Grid for puer, ager, vir */
.variant-columns-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

@media (max-width: 860px) {
  .variant-columns-grid {
    grid-template-columns: 1fr;
  }
}

.variant-col-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.variant-col-card:hover {
  border-color: rgba(226, 177, 68, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.model-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  width: fit-content;
  letter-spacing: 0.04em;
}

.model-badge.keep-e {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.model-badge.drop-e {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.model-badge.in-ir {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.model-vocab {
  font-size: 0.98rem;
  color: #ffffff;
}

.model-vocab strong {
  color: var(--gold-light);
}

.model-vocab .gender {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.model-stem {
  font-size: 0.8rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid var(--gold-primary);
}

.model-stem code {
  color: #fde047;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

.model-progression {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.prog-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #cbd5e1;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.prog-row:last-child {
  border-bottom: none;
}

.prog-row span:first-child {
  color: #94a3b8;
  font-size: 0.72rem;
  width: 65px;
  flex-shrink: 0;
}

.prog-row strong {
  color: #ffffff;
}

.prog-note {
  font-size: 0.7rem;
  color: #64748b;
  margin-left: auto;
}

.ocr-examples {
  font-size: 0.75rem;
  color: #94a3b8;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ocr-examples strong {
  color: var(--gold-light);
}

/* Progression Table */
.progression-table-wrapper {
  margin-top: 16px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 177, 68, 0.25);
  animation: fadeIn 0.2s ease-in-out;
}

.progression-table-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 10px;
}

.progression-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.progression-table th {
  background: rgba(226, 177, 68, 0.12);
  color: var(--gold-light);
  text-align: left;
  padding: 9px 12px;
  font-weight: 700;
  border-bottom: 2px solid rgba(226, 177, 68, 0.3);
  font-size: 0.8rem;
}

.progression-table td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

.progression-table .section-row td {
  background: rgba(226, 177, 68, 0.08);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-top: 1px solid rgba(226, 177, 68, 0.2);
  border-bottom: 1px solid rgba(226, 177, 68, 0.2);
}

.progression-table tbody tr:nth-child(even):not(.section-row) {
  background: rgba(255, 255, 255, 0.015);
}

.progression-table tbody tr:hover:not(.section-row) {
  background: rgba(226, 177, 68, 0.05);
}

.progression-table td strong {
  color: #ffffff;
}

.ending-gold {
  color: var(--gold-light);
  font-weight: 700;
}

.nom-diff {
  color: #fbbf24;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px dashed rgba(251, 191, 36, 0.4);
}

.progression-table td em {
  font-size: 0.72rem;
  color: #94a3b8;
}
