:root {
  --bg: #f2f2f0;
  --bg-deep: #dfdfda;
  --paper: rgba(255, 255, 255, 0.9);
  --paper-strong: rgba(255, 255, 255, 0.98);
  --ink: #111111;
  --ink-soft: #3c3c39;
  --muted: #686863;
  --line: rgba(17, 17, 17, 0.12);
  --line-strong: rgba(17, 17, 17, 0.22);
  --accent: #121212;
  --accent-2: #737373;
  --shadow-sm: 0 16px 30px rgba(15, 15, 15, 0.06);
  --shadow-md: 0 28px 56px rgba(15, 15, 15, 0.09);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(0, 0, 0, 0.05), transparent 22%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.035), transparent 26%),
    linear-gradient(180deg, #fafaf8 0%, var(--bg) 46%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3), transparent 85%);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 244, 241, 0.94)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.hero::after {
  content: '';
  position: absolute;
  inset: auto -12% -24% auto;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.08), transparent 68%);
  opacity: 0.7;
  pointer-events: none;
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 100%;
  font-family: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: clamp(2rem, 4.2vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 700;
  white-space: nowrap;
}

.tab-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.tab-button {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(239, 239, 236, 0.88)),
    rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
  border-radius: 18px;
  padding: 14px 14px 16px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 86px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.tab-button::before {
  content: '';
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.15);
}

.tab-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

.tab-button.active {
  background:
    linear-gradient(160deg, rgba(14, 14, 14, 1), rgba(56, 56, 56, 0.94)),
    #111;
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(17, 17, 17, 0.5);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.14);
}

.tab-button.active::before {
  background: #f5f5f1;
}

.tab-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  color: inherit;
}

.tab-desc {
  display: block;
  font-size: 0.76rem;
  line-height: 1.45;
  color: inherit;
  opacity: 0.78;
}

.search-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.search-form input,
.search-form select,
.filter-field select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.search-form input:focus,
.search-form select:focus,
.filter-field select:focus {
  border-color: rgba(17, 17, 17, 0.4);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.06);
}

#law-select.hidden,
#search-input.hidden {
  display: none;
}

.search-form button {
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  background: linear-gradient(180deg, #1a1a1a, #050505);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.search-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18);
}

.search-form button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.filter-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.filter-field.hidden {
  display: none;
}

.filter-field span {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.filter-field select {
  border-radius: 14px;
  padding: 10px 12px;
}

.filter-field.inline-toggle {
  min-width: auto;
}

.filter-field.inline-toggle.hidden {
  display: none;
}

.filter-field.inline-toggle .inline-toggle-label {
  display: block;
}

.filter-field.inline-toggle .inline-toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  width: max-content;
}

.filter-field.inline-toggle input[type='checkbox'] {
  margin: 0;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 20px 2px 10px;
}

.result-head h2,
.result-head p {
  margin: 0;
}

.result-head h2 {
  font-family: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.result-head p {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.95rem;
}

.message {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.message.error {
  color: #b42318;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.load-more-area {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.load-more-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.load-more-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.result-group {
  margin-top: 18px;
}

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 2px;
}

.group-head h3,
.group-head span {
  margin: 0;
}

.group-head h3 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.group-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.group-card-list {
  margin-top: 0;
}

.law-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 247, 244, 0.94)),
    var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.law-card::after {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #121212, rgba(18, 18, 18, 0.18));
  opacity: 0.22;
}

.interactive-card {
  cursor: pointer;
}

.interactive-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 24px 42px rgba(15, 15, 15, 0.1);
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.status,
.law-type {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status {
  background: rgba(17, 17, 17, 0.08);
  color: var(--accent);
}

.status-현행 {
  background: rgba(185, 28, 28, 0.12);
  color: #b91c1c;
}

.status-시행예정 {
  background: rgba(17, 17, 17, 0.15);
  color: #111111;
}

.status-연혁 {
  background: rgba(120, 120, 120, 0.12);
  color: #505050;
}

.law-type {
  background: rgba(17, 17, 17, 0.04);
  color: var(--muted);
}

.card-main {
  display: grid;
  gap: 4px;
}

.law-card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.28;
  letter-spacing: -0.025em;
}

.meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.84rem;
}

.meta.secondary {
  margin-top: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
}

.info-row {
  background: rgba(17, 17, 17, 0.03);
  border: 1px solid rgba(17, 17, 17, 0.06);
  border-radius: 12px;
  padding: 10px 11px;
}

.info-row dt {
  color: var(--muted);
  font-size: 0.7rem;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.info-row dd {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.3;
  font-weight: 600;
}

.card-actions {
  margin-top: 12px;
}

.card-actions span,
.card-actions a,
.modal-actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.86rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 11, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(960px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.985);
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 30px;
  padding: 26px;
  box-shadow: 0 34px 64px rgba(0, 0, 0, 0.2);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  font-family: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.modal-eyebrow {
  margin-bottom: 8px;
}

.modal-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.close-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  cursor: pointer;
}

.detail-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(250, 250, 248, 0.94);
}

.detail-section h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.detail-section p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.82;
}

.modal-actions {
  margin-top: 18px;
}

.modal-actions.bottom {
  display: flex;
  justify-content: flex-end;
}

.preview-hero {
  margin-bottom: 18px;
}

.change-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.compare-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.compare-head h2,
.document-head h2 {
  margin: 0;
  font-family: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 700;
}

.compare-head p,
.document-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.compare-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compare-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-sm);
}

.compare-card h3 {
  margin: 0 0 14px;
  font-size: 1.08rem;
}

.compare-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compare-column {
  border-radius: 18px;
  padding: 16px;
}

.compare-column.current {
  background: rgba(242, 242, 239, 0.95);
  border: 1px solid rgba(17, 17, 17, 0.08);
}

.compare-column.upcoming {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(17, 17, 17, 0.14);
}

.compare-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.compare-column p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.82;
}

.diff-mark {
  color: #b42318;
  text-decoration-line: underline;
  text-decoration-color: #d92d20;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  font-weight: 700;
}

.preview-document {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.document-body {
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.document-section + .document-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(34, 34, 34, 0.08);
}

.document-section h3 {
  margin: 0 0 10px;
  font-size: 1.04rem;
}

.document-section p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.9;
}

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  border-radius: 22px;
  padding: 16px 18px;
}

.summary-count {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 16px;
}

.summary-card.changed {
  border-color: rgba(180, 83, 9, 0.28);
}

.summary-card.added {
  border-color: rgba(22, 101, 52, 0.22);
}

.summary-card.removed {
  border-color: rgba(153, 27, 27, 0.18);
}

.summary-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.summary-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.preview-sections .detail-section.changed,
.detail-section.changed {
  border-color: rgba(180, 83, 9, 0.22);
  background: rgba(255, 248, 243, 0.96);
}

.preview-sections .detail-section.added,
.detail-section.added {
  border-color: rgba(22, 101, 52, 0.22);
  background: rgba(245, 251, 246, 0.96);
}

.section-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.74rem;
  background: rgba(17, 17, 17, 0.07);
  color: var(--accent);
}

@media (max-width: 980px) {
  .tab-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-list,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .compare-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding: 18px 0 40px;
  }

  .hero {
    padding: 20px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: clamp(1.45rem, 7vw, 2.5rem);
    letter-spacing: -0.04em;
  }

  .search-form,
  .tab-row {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-field {
    min-width: 0;
  }

  .modal-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .modal-head {
    flex-direction: column;
  }

  .summary-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
