:root {
  --bg-warm: #fcfaf7;
  --surface-soft: #f5efe8;
  --text-main: #3f352f;
  --accent: #8A1C08;
  --radius-main: 16px;

  --bs-primary: #8A1C08;
  --bs-primary-rgb: 138, 28, 8;
  --bs-btn-bg: #8A1C08;
  --bs-btn-border-color: #8A1C08;
  --bs-btn-hover-bg: #6e1606;
  --bs-btn-hover-border-color: #6e1606;
  --bs-btn-active-bg: #551104;
  --bs-link-color: #8A1C08;
  --bs-link-hover-color: #6e1606;
}

body {
  background: var(--bg-warm);
  color: var(--text-main);
  overflow-x: hidden;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(252, 250, 247, 0.96);
  backdrop-filter: blur(6px);
}

.content-wrap {
  padding-top: 2rem;
  padding-bottom: 8rem;
  padding-left: 2rem;
  padding-right: 2rem;
  overflow-x: hidden;
}

.page-view {
  will-change: transform, opacity;
}

.page-slide-in-right {
  animation: pageSlideInRight 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.page-slide-in-left {
  animation: pageSlideInLeft 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.page-view.is-swipe-dragging {
  transition: none !important;
}

.page-view.is-swipe-snapping {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pageSlideInRight {
  from {
    opacity: 0.72;
    transform: translateX(18%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pageSlideInLeft {
  from {
    opacity: 0.72;
    transform: translateX(-18%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-slide-in-right,
  .page-slide-in-left {
    animation: none;
  }
}

.square-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-row {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #e9e1d8;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.square-card {
  cursor: pointer;
}

.square-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-main);
  overflow: hidden;
  background: var(--surface-soft);
}

.square-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.square-label {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fab-button {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  width: 3.3rem;
  height: 3.3rem;
  font-size: 1.6rem;
  line-height: 1;
  z-index: 30;
}

.nav-btn {
  border: 0;
  background: transparent;
  color: #8a7d74;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  line-height: 1;
}

.nav-btn i {
  font-size: 1.75rem;
}

.nav-btn.active {
  color: var(--accent);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: space-evenly;
  padding: 0.85rem 0.6rem 1rem;
  background: #fff;
}

.btn-primary {
  background-color: #8A1C08;
  border-color: #8A1C08;
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:focus-visible {
  background-color: #6e1606;
  border-color: #6e1606;
  color: #fff;
  box-shadow: none;
}

.btn-outline-primary {
  color: #8A1C08;
  border-color: #8A1C08;
}

.btn-outline-primary:hover {
  background-color: #8A1C08;
  border-color: #8A1C08;
  color: #fff;
}

.btn-danger,
.btn-outline-danger {
  --bs-btn-color: #8A1C08;
  --bs-btn-border-color: #8A1C08;
  --bs-btn-hover-bg: #6e1606;
  --bs-btn-hover-border-color: #6e1606;
  --bs-btn-active-bg: #551104;
}

.btn-danger {
  background-color: #8A1C08;
  border-color: #8A1C08;
  color: #fff;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
  background-color: #6e1606;
  border-color: #6e1606;
  color: #fff;
  box-shadow: none;
}

.btn-outline-danger {
  color: #8A1C08;
  border-color: #8A1C08;
  background-color: transparent;
}

.btn-outline-danger:hover {
  background-color: #8A1C08;
  border-color: #8A1C08;
  color: #fff;
}

a {
  color: #8A1C08;
}

a:hover {
  color: #6e1606;
}

.project-only-image .square-label {
  display: none;
}

.round-yarn-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.round-yarn-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  font-size: 1.25rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.category-row.is-sort-mode {
  cursor: grab;
}

.category-row.is-sort-mode:active {
  cursor: grabbing;
}

.dragging {
  opacity: 0.6;
  transform: scale(0.99);
}

.inline-form {
  background: #fff;
  border: 1px solid #e9e1d8;
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
}

.yarn-meta {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  text-align: center;
  color: #7a6b60;
  line-height: 1.35;
}

.yarn-meta-lines {
  font-size: 0.68rem;
  line-height: 1.5;
}

.meta-hook {
  color: #8A1C08;
  font-weight: 600;
}

.meta-grams {
  color: #5D634F;
}

.category-text-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-main);
  background: #fff;
  border: 1px solid #e9e1d8;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #5a4b41;
}

.selected-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  flex-shrink: 0;
  text-decoration: none;
}

.icon-btn:hover {
  color: #fff;
}

a,
.btn-link {
  text-decoration: none;
}

a:hover,
.btn-link:hover {
  color: #fff;
}
