/* ===== Design Tokens — Ruby/Rails palette ===== */
:root {
  /* Ruby red — primary brand color */
  --color-primary: #df4648;
  --color-primary-hover: #9f2740;
  --color-primary-light: #fae8e8;
  /* Dark navy — headings, strong text */
  --color-navy: #0b2446;
  /* Rails red — danger / destructive actions */
  --color-danger: #dd182c;
  --color-danger-light: #fde8ea;
  /* Gold — warnings, highlights */
  --color-warning: #f3b365;
  --color-warning-light: #fef5e7;
  /* Orange — secondary accent */
  --color-accent: #f1834a;
  --color-accent-light: #fef0e8;
  /* Sage / info tones */
  --color-info: #0b2446;
  --color-info-light: #e8edf2;
  --color-success: #2e7d4f;
  --color-success-light: #e8f5ed;
  /* Salmon — soft highlight */
  --color-salmon: #da817f;
  /* Neutrals from palette */
  --color-bg: #ecf0f3;
  --color-surface: #ffffff;
  --color-text: #0b2446;
  --color-text-muted: #4a5e78;
  --color-text-light: #abbdcb;
  --color-border: #d0dae2;
  --color-border-hover: #abbdcb;
  /* Shared */
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow: 0 1px 3px rgba(11, 36, 70, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(11, 36, 70, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(11, 36, 70, 0.1);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ===== Utilities ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

/* ===== Page Layout ===== */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero__logo {
  width: 180px;
  height: auto;
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__tagline {
  color: var(--color-text-muted);
  font-size: 1.125rem;
  margin: 0;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.hero__links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hero__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.hero__link:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.hero__link-icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 1.75;
  flex-shrink: 0;
}

.hero__link-icon--image {
  object-fit: contain;
}

/* ===== How It Works ===== */
.how-it-works {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.how-it-works__step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex: 1;
  max-width: 280px;
}

.how-it-works__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-top: 0.125rem;
}

.how-it-works__step strong {
  font-size: 0.875rem;
  display: block;
  margin-bottom: 0.125rem;
}

.how-it-works__title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.how-it-works__icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 1.9;
  color: var(--color-primary);
  flex-shrink: 0;
}

.how-it-works__step p {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}

.how-it-works__step code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--color-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

/* ===== Presets ===== */
.presets {
  margin-bottom: 1.5rem;
}

.presets__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--color-text);
}

.presets__description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
}

.presets__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.625rem;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.625rem 1rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  min-width: 0;
  min-height: 100%;
}

.preset-btn:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow);
}

.preset-btn--active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.preset-btn__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

.preset-btn__description {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

/* ===== Search Bar ===== */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 5rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-bar input::placeholder {
  color: var(--color-text-light);
}

.search-bar__count {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ===== Search Empty State ===== */
.search-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* ===== Config Bar ===== */
.config-bar {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.config-bar__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.config-bar__field label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.config-bar__field input,
.config-bar__field select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  background: var(--color-bg);
  color: var(--color-text);
  min-width: 180px;
}

.config-bar__hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  max-width: 360px;
}

.config-bar__field input:focus,
.config-bar__field select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-color: var(--color-primary);
}

/* ===== Category Nav ===== */
.category-nav {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  padding: 0.625rem 0;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav__link {
  flex-shrink: 0;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.category-nav__link:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
  box-shadow: var(--shadow);
}

.category-nav__link--active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ===== Main Layout ===== */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

/* ===== Category Sections ===== */
.category-section {
  margin-bottom: 2rem;
}

.category-section__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-section__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.category-section__description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: -0.25rem 0 0.75rem;
  line-height: 1.4;
}

.category-section__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

/* ===== Pack Cards ===== */
.pack-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.pack-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow);
}

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

.pack-card--selected .pack-card__check {
  opacity: 1;
  color: var(--color-primary);
}

.pack-card--conflicting {
  opacity: 0.45;
  pointer-events: none;
}

.pack-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}

.pack-card__name {
  font-weight: 600;
  font-size: 0.875rem;
}

.pack-card__check {
  opacity: 0;
  font-size: 1rem;
  font-weight: 700;
  transition: opacity 0.15s ease;
}

.pack-card__description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pack-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pack-card__tag {
  font-size: 0.6875rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  line-height: 1.3;
}

.pack-card__tag--dep {
  background: var(--color-info-light);
  color: var(--color-info);
}

.pack-card__tag--conflict {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* ===== Pack Card Detail & Info Button ===== */
.pack-card__info-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pack-card__info-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.pack-card__info-btn--active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.pack-card__detail {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.pack-card__detail-section {
  margin-bottom: 0.5rem;
}

.pack-card__detail-section:last-child {
  margin-bottom: 0;
}

.pack-card__detail-section strong {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.pack-card__gem-list,
.pack-card__notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pack-card__gem-list li,
.pack-card__notes-list li {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--color-text);
  padding: 0.125rem 0;
}

.pack-card__notes-list li {
  font-family: var(--font-sans);
  color: var(--color-text-muted);
}

.pack-card__gem-group {
  font-size: 0.625rem;
  background: var(--color-bg);
  color: var(--color-text-muted);
  padding: 0.0625rem 0.375rem;
  border-radius: 999px;
  margin-left: 0.25rem;
  font-family: var(--font-sans);
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: 1.5rem;
}

.sidebar__inner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 3rem);
}

.sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.sidebar__title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar__clear {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius);
  transition: color 0.15s ease;
}

.sidebar__clear:hover {
  color: var(--color-danger);
}

.sidebar__count {
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}

.sidebar__list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-height: none;
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.sidebar__list--scrollable::after {
  content: "";
  position: sticky;
  bottom: 0;
  display: block;
  height: 24px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--color-surface));
}

.sidebar__list--at-bottom::after {
  opacity: 0;
}

.sidebar__scroll-top {
  align-self: flex-start;
  margin: 0 0 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.sidebar__scroll-top:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
  box-shadow: var(--shadow);
}

.sidebar__list:empty::after {
  content: "No packs selected";
  color: var(--color-text-light);
  font-size: 0.8125rem;
  font-style: italic;
}

.sidebar__list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.5rem;
  margin: 0.25rem 0;
  font-size: 0.8125rem;
  box-shadow: inset 0 0 0 0.5px var(--color-border);
  border-radius: var(--radius);
  text-transform: capitalize;
  cursor: pointer;
}

.sidebar__list-item:hover {
  background: var(--color-bg);
  box-shadow: inset 0 0 0 1px var(--color-border-hover);
}

.sidebar__remove {
  background: none;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.25rem;
}

.sidebar__remove:hover {
  color: var(--color-danger);
}

.sidebar__group-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  padding: 0.5rem 0.5rem 0.125rem;
  list-style: none;
}

.sidebar__group-label-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
}

.sidebar__group-label-btn:hover {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.category-section--flash {
  scroll-margin-top: 5rem;
  animation: categoryFlash 700ms ease-out;
}

@keyframes categoryFlash {
  0% { box-shadow: 0 0 0 0 rgba(223, 70, 72, 0.0); }
  20% { box-shadow: 0 0 0 4px rgba(223, 70, 72, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(223, 70, 72, 0.0); }
}

.pack-card--flash {
  animation: packCardFlash 700ms ease-out;
}

@keyframes packCardFlash {
  0%   { box-shadow: 0 0 0 0 rgba(223, 70, 72, 0.0); }
  20%  { box-shadow: 0 0 0 4px rgba(223, 70, 72, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(223, 70, 72, 0.0); }
}

.sidebar__group-label:first-child {
  padding-top: 0;
}

.sidebar__feedback,
.sidebar__auto-added {
  margin-bottom: 0.75rem;
}

.sidebar__help {
  font-size: 0.75rem;
  color: var(--color-text-light);
  text-align: center;
  margin: 0.75rem 0 0;
  line-height: 1.4;
}

/* ===== Feedback ===== */
.feedback {
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.feedback--error {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.feedback--info {
  background: var(--color-info-light);
  color: var(--color-info);
  border: 1px solid var(--color-info);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn--primary {
  background: var(--color-primary);
  color: white;
}

.btn--primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.btn--secondary:hover:not(:disabled) {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow);
}

.btn--secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sidebar__actions {
  display: flex;
  gap: 0.5rem;
}

.sidebar__actions .btn {
  flex: 1;
  padding: 0.625rem;
  font-size: 0.875rem;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 36, 70, 0.6);
}

.modal__content {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 860px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.modal__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.modal__filename {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}

.modal__close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.modal__close:hover {
  color: var(--color-text);
}

.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal__code {
  margin: 0;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  background: #282c34;
  color: #abb2bf;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 0;
}

.modal__code code {
  font-family: inherit;
  font-size: inherit;
  background: none !important;
  padding: 0 !important;
}

.modal__notes {
  padding: 1rem 1.25rem;
  background: var(--color-warning-light);
  border-top: 1px solid var(--color-border);
}

.modal__notes-title {
  font-size: 0.8125rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

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

.modal__notes-list li {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  padding: 0.25rem 0;
  position: relative;
  line-height: 1.4;
}

.modal__note-prefix {
  color: var(--color-text);
  font-weight: 800;
}

.modal__note-inline-code,
.modal__note-pre code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(11, 36, 70, 0.06);
  border: 1px solid var(--color-border);
  border-radius: 0.35rem;
}

.modal__note-inline-code {
  padding: 0.1rem 0.35rem;
  white-space: nowrap;
}

.modal__note-pre {
  margin: 0.25rem 0 0;
}

.modal__note-pre code {
  display: block;
  padding: 0.5rem 0.65rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal__note-link {
  color: var(--color-primary-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal__footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
}

/* ===== Footer ===== */
.site-footer {
  width: 100%;
  margin-top: 3rem;
  padding: 1.25rem 1.5rem 2rem;
  border-top: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.site-footer__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 2rem;
}

.site-footer__brand strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.site-footer__logo {
  width: 56px;
  height: auto;
  flex-shrink: 0;
}

.site-footer__brand p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  max-width: 420px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
}

.site-footer__links a {
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--color-primary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .how-it-works { flex-direction: column; }
  .how-it-works__step { max-width: none; }
  .how-it-works__step code { white-space: normal; }
  .presets__grid { grid-template-columns: 1fr; }
  .preset-btn { min-width: 100%; }
  .config-bar { flex-direction: column; }
  .config-bar__field input,
  .config-bar__field select { min-width: 100%; }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 100;
    padding: 0;
  }

  .sidebar__inner {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    max-height: none;
  }

  .sidebar__list {
    max-height: 150px;
    flex: 0 0 auto;
  }

  .category-nav {
    position: static;
    flex-wrap: wrap;
  }

  .page { padding-bottom: 12rem; }
  .site-footer__brand { align-items: flex-start; }
  .site-footer__inner { flex-direction: column; }
  .site-footer__links { justify-content: flex-start; }
}
