/* ==========================================================================
   Phonograms Pyramid - Clean Educational Flashcard Stylesheet
   ========================================================================== */

/* 1. Typography & Custom Font Configuration */
@font-face {
  font-family: 'Primer';
  src: url('fonts/primer.otf') format('opentype'),
       url('fonts/primer.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Primer';
  src: url('fonts/primer-bold.otf') format('opentype'),
       url('fonts/primer-bold.ttf') format('truetype');
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-phonogram: 'Primer', 'Andika', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-dark: #0f172a;
  --border-subtle: #cbd5e1;
  --btn-primary-bg: #0f172a;
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: #f1f5f9;
  --btn-secondary-text: #1e293b;
  --btn-secondary-border: #94a3b8;
  --accent-active: #3b82f6;
  --font-scale: 1;
  --tile-size-mobile: calc(64px * var(--font-scale));
  --tile-size-desktop: calc(76px * var(--font-scale));
  --tile-font-mobile: calc(1.85rem * var(--font-scale));
  --tile-font-desktop: calc(2.35rem * var(--font-scale));
  --tile-gap: 8px;
  --shadow-subtle: 0 1px 3px 0 rgba(15, 23, 42, 0.08);
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Top Panoramic Brand Banner */
.brand-banner-wrap {
  width: 100%;
  max-width: 100%;
  max-height: 100px;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  line-height: 0;
}

.brand-banner-img {
  width: 100%;
  max-width: 100%;
  height: clamp(50px, 9vw, 100px);
  max-height: 100px;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Base Layout Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

/* Header Area */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 20px;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 20px;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.brand-org-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.brand-org-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.header-size-control {
  min-height: 44px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 10px;
  box-shadow: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Offline Banner */
.offline-banner {
  display: none;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  align-items: center;
  gap: 8px;
}

.offline-banner.visible {
  display: flex;
}

/* Mode Switcher Tabs - Underline Brand Styling */
.mode-tabs {
  display: flex;
  background: transparent;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 24px;
  gap: 24px;
  padding: 0 2px;
}

.tab-btn {
  flex: 0 0 auto;
  min-height: 42px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 4px 12px;
  margin-bottom: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: transparent;
  color: #1e3a8a;
  border-bottom-color: #2563eb;
  box-shadow: none;
}

/* Panel Card Container */
.config-card {
  background: var(--bg-card);
  border: 2px solid var(--border-dark);
  border-radius: 0px; /* Flashcard strict square corners */
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 3px 3px 0px rgba(15, 23, 42, 0.1);
}

.card-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-hint {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 16px;
}

/* Word Bank Form Elements */
.bank-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .bank-controls {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.select-input, .text-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text-main);
  background: #ffffff;
  border: 2px solid var(--border-dark);
  border-radius: 0px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select-input:focus, .text-input:focus {
  border-color: var(--accent-active);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Custom Builder Discrete Tile Inputs */
.builder-tiles-wrapper {
  margin: 16px 0 20px;
}

.builder-tiles-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tile-gap);
  align-items: flex-start;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.builder-tile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tile-box-input {
  width: var(--tile-size-mobile);
  height: var(--tile-size-mobile);
  background: #ffffff;
  border: 2.5px solid var(--border-dark);
  border-radius: 0px !important; /* Strict square flashcard aesthetic */
  text-align: center;
  font-family: var(--font-phonogram);
  font-size: calc(1.5rem * var(--font-scale));
  font-weight: 700;
  color: var(--text-main);
  padding: 0 2px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

@media (min-width: 640px) {
  .tile-box-input {
    width: var(--tile-size-desktop);
    height: var(--tile-size-desktop);
    font-size: calc(1.85rem * var(--font-scale));
  }
}

.tile-box-input:focus {
  border-color: #2563eb;
  background-color: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.tile-box-index {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Silent "e" Input Toggle Checkbox - only shown under the last box if it contains an 'e' */
.tile-box-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.tile-silent-e-label {
  display: none; /* Strictly hidden by default unless it is the final box and has 'e' */
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  cursor: pointer;
  user-select: none;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.15s ease-in-out;
  line-height: 1;
  font-weight: 600;
}

.tile-silent-e-label:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

.tile-silent-e-check {
  cursor: pointer;
  accent-color: #dc2626;
  width: 12px;
  height: 12px;
  margin: 0;
}

.tile-silent-e-text {
  font-size: 0.7rem;
  white-space: nowrap;
}

/* Builder Box Controls (+ / -) */
.builder-slot-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-slot-mod {
  min-height: 44px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1.5px solid var(--border-dark);
  border-radius: 0px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-slot-mod:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-slot-mod:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Main Action Buttons Bar */
.action-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary {
  min-height: 48px;
  padding: 12px 24px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 2px solid var(--border-dark);
  border-radius: 0px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 2px 2px 0px rgba(15, 23, 42, 0.15);
  transition: background 0.15s, transform 0.05s;
}

.btn-primary:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px rgba(15, 23, 42, 0.15);
}

.btn-secondary {
  min-height: 48px;
  padding: 12px 20px;
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 2px solid var(--border-dark);
  border-radius: 0px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   Cumulative Reading Pyramid Section (Core Reading View)
   ========================================================================== */
.pyramid-view-container {
  display: none;
  flex-direction: column;
  width: 100%;
}

.pyramid-view-container.active {
  display: flex;
}

/* Control Bar Above Pyramid */
.pyramid-top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border-dark);
  border-radius: 0px;
  padding: 12px 18px;
  margin-bottom: 20px;
  gap: 12px;
}

.word-info-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.active-word-label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.active-category-pill {
  font-size: 0.775rem;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

.top-bar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-full-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.toggle-full-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--btn-primary-bg);
}

/* Step Progress Indicator */
.step-progress-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.progress-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #cbd5e1;
  transition: background-color 0.2s, transform 0.2s;
}

.progress-dot.active {
  background: var(--text-main);
  transform: scale(1.2);
}

.progress-dot.completed {
  background: #475569;
}

/* Main Pyramid Scrolling Canvas */
.pyramid-scroll-canvas {
  background: #ffffff;
  border: 2.5px solid var(--border-dark);
  border-radius: 0px; /* Flashcard aesthetic */
  padding: 24px 20px;
  min-height: 260px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
  scroll-behavior: smooth;
  margin-bottom: 20px;
  box-shadow: 4px 4px 0px rgba(15, 23, 42, 0.08);
}

/* Left-aligned Pyramid Tiers */
.pyramid-canvas-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start; /* STRICT LEFT ALIGNMENT for constant reading baseline */
  width: 100%;
}

/* Individual Tier Row */
.pyramid-tier-row {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* STRICT LEFT ALIGNMENT */
  gap: var(--tile-gap);
  width: 100%;
  padding: 6px 8px;
  border-left: 4px solid transparent;
  transition: all 0.2s ease-in-out;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  visibility: hidden;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.pyramid-tier-row.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  height: auto;
  overflow: visible;
}

/* Currently active decoding tier */
.pyramid-tier-row.current-active {
  border-left-color: var(--accent-active);
  background-color: #f8fafc;
}

.tier-number-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  flex-shrink: 0;
  user-select: none;
}

/* Phonogram Flashcard Tile Box */
.phonogram-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: var(--tile-size-mobile);
  height: var(--tile-size-mobile);
  padding: 0 calc(10px * var(--font-scale));
  background: #ffffff;
  border: 2.5px solid var(--border-dark);
  border-radius: 0px !important; /* Square-cornered box */
  user-select: none;
  flex-shrink: 0;
  box-shadow: 2px 2px 0px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s, border-color 0.15s, background-color 0.15s;
}

@media (min-width: 640px) {
  .phonogram-tile {
    min-width: var(--tile-size-desktop);
    height: var(--tile-size-desktop);
    padding: 0 calc(14px * var(--font-scale));
  }
}

/* Individual Phonogram Unit Text Span */
.phonogram-text,
.phonogram-unit {
  font-family: var(--font-phonogram);
  font-size: var(--tile-font-mobile);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: normal;
  display: inline-block;
  position: relative;
  line-height: 1;
  text-decoration: none !important;
}

@media (min-width: 640px) {
  .phonogram-text,
  .phonogram-unit {
    font-size: var(--tile-font-desktop);
  }
}

/* Multi-Letter Phonogram Underlining Rule:
   Distinct underline directly beneath the phonogram ONLY.
   Single letters remain strictly non-underlined.
   When two multi-letter phonograms sit adjacent (e.g., 'ck' + 'ed' in 'lacked'),
   each phonogram maintains its OWN distinct underline with a crisp gap between them (two underlines, not one). */
.phonogram-unit.is-multiletter::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: calc(-5px * var(--font-scale));
  height: calc(3.5px * var(--font-scale));
  background-color: currentColor;
  border-radius: 1px;
  pointer-events: none;
}

/* Silent Final "e" Dotted Underline Rule:
   Designated silent final 'e' renders with a dotted underline directly beneath that 'e' only. */
.phonogram-unit.is-silent-e::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: calc(-5px * var(--font-scale));
  height: 0px;
  border-bottom: calc(3.5px * var(--font-scale)) dotted currentColor;
  pointer-events: none;
}

/* Combined Prior Phonograms Box Strategy:
   On any row t >= 2, all previous phonograms are combined into one single box
   (e.g., in "ship": row 3 combines "sh" and "i" into [ shi ]).
   All letters inside are red, with multi-letter units like "sh" underlined in red. */
.phonogram-tile.is-combined-previous {
  background: #ffffff;
  border: 2.5px solid var(--border-dark);
}

.phonogram-tile.is-combined-previous .phonogram-unit {
  color: #dc2626 !important; /* Educational vivid red for combined prior blend */
  text-decoration: none !important;
}

/* Silent "e" 5 Rules Badge Button on/near revealed tile */
.btn-silent-e-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1.5px solid #f87171;
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 1px 1px 0px rgba(185, 28, 28, 0.2);
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  margin-left: 4px;
}

.btn-silent-e-badge:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
  transform: translateY(-1px);
}

.btn-silent-e-badge:active {
  transform: translateY(0);
}

/* Final Completion Word Box */
.phonogram-tile.is-complete-word {
  box-shadow: 3px 3px 0px rgba(15, 23, 42, 0.15);
  border-width: 2.5px;
}

.is-completion-tier .tier-number-tag {
  color: #dc2626;
  font-weight: 800;
}

/* Single prior phonogram tile (e.g. row 2 where there's 1 prior sound) */
.phonogram-tile.is-previous .phonogram-text,
.phonogram-tile.is-previous .phonogram-unit {
  color: #dc2626 !important;
  text-decoration: none !important;
}

/* Tutor toggle support to disable red color if desired */
.disable-previous-color .phonogram-tile.is-combined-previous .phonogram-unit,
.disable-previous-color .phonogram-tile.is-previous .phonogram-text,
.disable-previous-color .phonogram-tile.is-previous .phonogram-unit {
  color: var(--text-main) !important;
  text-decoration: none !important;
}

/* In-Session Pyramid Font Size Stepper */
.font-size-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  border: 2px solid var(--border-dark);
  padding: 3px 8px;
  border-radius: 0px;
  box-shadow: 2px 2px 0px rgba(15, 23, 42, 0.1);
  user-select: none;
}

.font-size-inline {
  background: #ffffff;
}

.font-size-label {
  font-size: 0.775rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-right: 4px;
  letter-spacing: -0.01em;
}

.font-size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  background: #f1f5f9;
  border: 1.5px solid var(--border-dark);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 0px;
  transition: all 0.1s ease;
  line-height: 1;
}

.font-size-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.font-size-btn:active {
  transform: translateY(1px);
}

.font-size-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.font-size-val {
  min-width: 44px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  padding: 0 2px;
}

/* Step Navigation Bar (Fixed bottom / Generous touch targets) */
.step-navigation-bar {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 480px) {
  .step-navigation-bar {
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 8px;
  }
}

.nav-step-btn {
  min-height: 52px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 0px;
  border: 2px solid var(--border-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-step-btn.btn-prev {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
}

.nav-step-btn.btn-prev:hover:not(:disabled) {
  background: #e2e8f0;
}

.nav-step-btn.btn-prev:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: #cbd5e1;
}

.nav-step-btn.btn-next {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: 2px 2px 0px rgba(15, 23, 42, 0.2);
}

.nav-step-btn.btn-next:hover {
  background: #1e293b;
}

.nav-step-btn.btn-next.completed-state {
  background: #1e293b;
  border-color: #0f172a;
}

.nav-step-btn.btn-new {
  background: #ffffff;
  color: var(--text-main);
}

.nav-step-btn.btn-new:hover {
  background: #f1f5f9;
}

/* Keyboard Hints Bar */
.keyboard-hints {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 14px;
  user-select: none;
}

.kbd-badge {
  display: inline-block;
  padding: 2px 6px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-main);
}

/* Modal Overlay Styles (SFTP Export & iOS PWA Guide) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border: 2.5px solid var(--border-dark);
  border-radius: 0px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 8px 0px rgba(15, 23, 42, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 2px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.925rem;
  color: #334155;
  line-height: 1.6;
}

/* Wide Modal Variant & Rules Image */
.modal-dialog-wide {
  max-width: 820px;
}

.rules-image-wrapper {
  width: 100%;
  overflow-x: auto;
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  border-radius: 0px;
  padding: 8px;
  display: flex;
  justify-content: center;
}

.silent-e-rules-img {
  width: 100%;
  max-width: 780px;
  height: auto;
  display: block;
}

.modal-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 16px 0 6px;
}

.modal-body ol, .modal-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.modal-body li {
  margin-bottom: 6px;
}

.code-preview-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre;
  margin: 10px 0 16px;
  border: 1px solid #334155;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1.5px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}
