:root {
  --bg: #ffffff;
  --ink: #112240;
  --muted: #4b6288;
  --card: #ffffff;
  --line: #d8e5ff;
  --line-strong: #9fbef4;
  --accent: #1d5fe3;
  --chip: #edf4ff;
  --chip-line: #cfe0ff;
  --chip-ink: #274879;
  --shadow: 0 4px 10px rgba(17, 58, 130, 0.05);
}

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

body {
  font-family: "Pretendard", "SUIT", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.page {
  width: min(1360px, 100% - 48px);
  margin: 0 auto;
  padding: 40px 0 80px;
}

.header {
  margin-top: 8px;
  margin-bottom: 26px;
}

.title {
  font-size: clamp(28px, 3.8vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  font-weight: 730;
}

.subtitle {
  max-width: 780px;
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.6;
}

.section {
  margin-top: 48px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 2px solid #e2e4e8;
  padding-top: 10px;
  margin-bottom: 18px;
}

.section-title {
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5f636b;
}

.add-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #c9d7f7;
  border-radius: 999px;
  background: #f1f6ff;
  color: #2751a5;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.add-icon-btn:hover {
  background: #e6efff;
  border-color: #aac1f3;
  transform: translateY(-1px);
}

.add-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(9, 17, 30, 0.42);
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(840px, 100%);
  max-height: 86vh;
  overflow: auto;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #d6e2fb;
  box-shadow: 0 14px 32px rgba(19, 43, 83, 0.24);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-title {
  font-size: 19px;
  letter-spacing: -0.01em;
  color: #1d3764;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #d6def0;
  background: #f8fafe;
  color: #495a76;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.add-form label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #4b6288;
  font-weight: 600;
}

.add-form input,
.add-form select {
  width: 100%;
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  background: #ffffff;
  color: #1e3359;
  font-size: 14px;
  padding: 10px 12px;
}

.add-form input:focus,
.add-form select:focus {
  outline: none;
  border-color: #79aaf5;
  box-shadow: 0 0 0 3px rgba(43, 134, 234, 0.12);
}

.add-btn {
  border: 1px solid #1d5fe3;
  background: #1d5fe3;
  color: #ffffff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.add-btn:hover {
  filter: brightness(1.05);
}

.form-status {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #4b6288;
}

.form-status.is-error {
  color: #b3261e;
}

.form-status.is-success {
  color: #0a7a34;
}

.slider-wrap {
  position: relative;
  padding: 0 16px;
}

.slider-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), #ffffff 92%);
}

.cards {
  --card-width: 360px;
  --peek: 96px;
  display: flex;
  gap: 18px;
  padding-top: 6px;
  margin-top: -6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  touch-action: pan-x;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cards.cols-3 {
  --card-width: calc((100% - 36px - var(--peek)) / 3);
}

.cards.cols-2 {
  --card-width: calc((100% - 18px - var(--peek)) / 2);
}

.cards::-webkit-scrollbar {
  display: none;
}

.slider-nav {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #d8dde6;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #8a8f98;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  z-index: 3;
}

.nav-btn:hover {
  color: #5e636d;
  background: #ffffff;
  border-color: #bfc7d6;
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.nav-prev {
  left: -34px;
}

.nav-next {
  right: -34px;
}

.nav-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #c7c9ce;
  display: inline-block;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.nav-dot.active {
  background: #2b86ea;
  transform: scale(1.08);
}

.card {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card-shell {
  position: relative;
  flex: 0 0 var(--card-width);
  display: flex;
}

.card-delete-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(22, 39, 74, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(41, 73, 120, 0.62);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.22s ease;
}

.card-delete-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(22, 39, 74, 0.24);
  color: rgba(41, 73, 120, 0.9);
}

.card-drag-btn {
  position: absolute;
  bottom: 8px;
  right: 38px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(22, 39, 74, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(41, 73, 120, 0.62);
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.22s ease;
}

.card-drag-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(22, 39, 74, 0.24);
  color: rgba(41, 73, 120, 0.9);
}

.card-shell.is-dragging .card-drag-btn {
  cursor: grabbing;
}

.card-shell.is-dragging {
  opacity: 0.75;
}

.card-shell:hover .card,
.card-shell:focus-within .card {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(17, 58, 130, 0.1);
}

.card-shell:hover .card-delete-btn,
.card-shell:focus-within .card-delete-btn {
  transform: translateY(-3px);
}

.card-shell:hover .card-drag-btn,
.card-shell:focus-within .card-drag-btn {
  transform: translateY(-3px);
}

.thumb-wrap {
  position: relative;
  height: 196px;
  background: #f6f9ff;
  overflow: hidden;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #274879;
  font-size: 13px;
  font-weight: 600;
  background: repeating-linear-gradient(
    135deg,
    rgba(237, 244, 255, 0.95),
    rgba(237, 244, 255, 0.95) 14px,
    rgba(222, 234, 255, 0.95) 14px,
    rgba(222, 234, 255, 0.95) 28px
  );
}

.card.image-error .thumb-fallback {
  display: flex;
}

.card-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 140px;
}

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.site-name {
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: #102549;
}

.card:hover .site-name,
.card:focus-visible .site-name {
  color: var(--accent);
}

.context {
  font-size: 11px;
  line-height: 1;
  border-radius: 999px;
  padding: 7px 9px;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.context-hot {
  border: 1px solid #f5b5b5;
  background: #fff1f1;
  color: #c62828;
}

.context-new {
  border: 1px solid #f1d788;
  background: #fff9e5;
  color: #9a6b00;
}

.context-user {
  border: 1px solid #b6c9f8;
  background: #f1f6ff;
  color: #2751a5;
}

.desc {
  font-size: 13px;
  line-height: 1.55;
  color: #4b6288;
  margin-bottom: 11px;
  min-height: 40px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
  margin-top: auto;
}

.tag {
  font-size: 12px;
  background: var(--chip);
  border: 1px solid var(--chip-line);
  color: var(--chip-ink);
  border-radius: 999px;
  padding: 5px 8px;
  line-height: 1.1;
}

.is-safari .site-name {
  font-size: 18px;
}

.is-safari .desc {
  font-size: 14px;
}

.is-safari .tag {
  font-size: 13px;
}

.is-safari .context {
  font-size: 12px;
}

@media (max-width: 720px) {
  .page {
    width: calc(100% - 24px);
    padding-top: 24px;
  }

  .cards {
    --peek: 24px;
    --card-width: min(84vw, 320px);
    scroll-snap-type: x proximity;
  }

  .cards.cols-3,
  .cards.cols-2 {
    --card-width: min(84vw, 320px);
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .modal-panel {
    padding: 14px;
  }

  .slider-wrap::after {
    width: 14px;
  }

  .thumb-wrap {
    height: 186px;
  }

  .nav-btn {
    width: 30px;
    height: 30px;
    font-size: 17px;
  }

  .nav-prev {
    left: -16px;
  }

  .nav-next {
    right: -16px;
  }
}
