* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: #f2f2f2;
  color: #222;
  font-family: Arial, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: #075a9b;
  text-decoration: none;
}

a:hover,
a:focus {
  color: #003f73;
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font: inherit;
}

textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  border: 1px solid #aaa;
  background: #fff;
  color: #222;
  padding: 8px 9px;
  border-radius: 2px;
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus {
  border-color: #4c89bd;
  outline: 1px solid #9bbfe0;
}

textarea {
  min-height: 178px;
  resize: vertical;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border: 1px solid #cfcfcf;
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #e8e8e8;
  color: #222;
  font-weight: 700;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 14px;
}

.topbar {
  background: #454545;
  color: #f4f4f4;
  font-size: 12px;
  border-bottom: 1px solid #2f2f2f;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.site-header {
  background: #e5e5e5;
  border-bottom: 1px solid #bdbdbd;
}

.header-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 14px 0;
}

.brand {
  color: #111;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
}

.tagline {
  margin: 2px 0 10px;
  color: #555;
  font-size: 12px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0;
}

.main-nav a {
  display: inline-block;
  min-width: 70px;
  border: 1px solid #aaa;
  border-bottom: 0;
  background: #f7f7f7;
  color: #222;
  padding: 7px 11px;
  text-align: center;
}

.main-nav a + a {
  margin-left: -1px;
}

.main-nav a.active {
  position: relative;
  top: 1px;
  background: #fff;
  color: #075a9b;
  font-weight: 700;
}

.breadcrumb {
  margin: 0 0 10px;
  color: #666;
  font-size: 12px;
}

.page {
  padding: 18px 0 34px;
}

.page-heading {
  border: 1px solid #cfcfcf;
  background: #fff;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.page-title {
  margin: 0 0 8px;
  color: #222;
  font-size: 24px;
  line-height: 1.25;
}

.lead {
  margin: 0 0 16px;
  color: #333;
}

.page-heading .lead {
  margin-bottom: 0;
}

.notice {
  border: 1px solid #d0bd75;
  background: #fff9dc;
  padding: 9px 11px;
  margin: 11px 0;
}

.home-layout,
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
}

.box,
.tool-box,
.content-section,
.side-box,
.ad-placeholder {
  border: 1px solid #c7c7c7;
  background: #fff;
  margin-bottom: 14px;
}

.box-header {
  background: #e9e9e9;
  border-bottom: 1px solid #c7c7c7;
  padding: 8px 11px;
  color: #222;
  font-weight: 700;
}

.box-body {
  padding: 11px;
}

.content-section {
  padding: 13px;
}

.content-section h2 {
  margin: -13px -13px 12px;
  border-bottom: 1px solid #c7c7c7;
  background: #e9e9e9;
  padding: 8px 11px;
  font-size: 17px;
}

.content-section h3 {
  margin: 15px 0 6px;
  font-size: 15px;
}

.content-section p,
.content-section ul,
.content-section ol {
  margin-top: 0;
}

.table-note {
  margin: 0 0 10px;
  color: #555;
  font-size: 13px;
}

.directory-table {
  font-size: 13px;
}

.directory-table th:nth-child(1) {
  width: 105px;
}

.directory-table th:nth-child(2) {
  width: 150px;
}

.directory-table th:nth-child(4) {
  width: 145px;
}

.directory-table th:nth-child(5) {
  width: 58px;
}

.directory-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.tool-name {
  font-weight: 700;
}

.tool-category,
.tool-keywords {
  color: #555;
  font-size: 12px;
}

.tool-open {
  text-align: center;
  white-space: nowrap;
}

.text-button {
  display: inline-block;
  border: 1px solid #9ab5cf;
  background: #f4f9ff;
  padding: 3px 7px;
  color: #075a9b;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}

.btn {
  display: inline-block;
  border: 1px solid #145c98;
  border-radius: 2px;
  background: #216ba7;
  color: #fff;
  padding: 7px 12px;
  cursor: pointer;
}

.btn:hover,
.btn:focus {
  background: #145c98;
  color: #fff;
  text-decoration: none;
}

.btn.secondary {
  border-color: #999;
  background: #f3f3f3;
  color: #222;
}

.btn.secondary:hover,
.btn.secondary:focus {
  background: #e4e4e4;
  color: #222;
}

.btn.danger {
  border-color: #9d3c3c;
  background: #b34848;
}

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

.form-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  margin-bottom: 11px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.help {
  margin-top: 4px;
  color: #666;
  font-size: 12px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #cfcfcf;
  border-left: 1px solid #cfcfcf;
}

.result-item {
  background: #fff;
  border-right: 1px solid #cfcfcf;
  border-bottom: 1px solid #cfcfcf;
  padding: 9px;
}

.result-label {
  display: block;
  color: #666;
  font-size: 12px;
}

.result-value {
  display: block;
  color: #111;
  font-size: 22px;
  font-weight: 700;
}

.tool-grid {
  display: block;
}

.tool-card {
  border-bottom: 1px solid #e2e2e2;
  padding: 9px 0;
}

.tool-card:first-child {
  padding-top: 0;
}

.tool-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.tool-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.tool-card p {
  margin: 0 0 5px;
  color: #444;
}

.tool-card .meta {
  color: #777;
  font-size: 12px;
}

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

.side-list li {
  border-bottom: 1px solid #e2e2e2;
}

.side-list li:last-child {
  border-bottom: 0;
}

.side-list a {
  display: block;
  padding: 7px 0;
}

.ad-placeholder {
  padding: 10px;
  color: #666;
  text-align: center;
}

.ad-placeholder .ad-label {
  display: block;
  margin-bottom: 6px;
  color: #777;
  font-size: 12px;
}

.ad-placeholder .ad-box {
  border: 1px dashed #999;
  background: #fafafa;
  padding: 22px 8px;
}

.output-area {
  min-height: 120px;
  white-space: pre-wrap;
}

.message {
  margin: 10px 0;
  border: 1px solid #b6cbe0;
  background: #eef6ff;
  padding: 8px 10px;
}

.message.error {
  border-color: #d0a0a0;
  background: #fff0f0;
  color: #7b2222;
}

.message.success {
  border-color: #9dc59d;
  background: #eff8ef;
  color: #275d27;
}

.diff-table {
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 13px;
}

.diff-line-equal td {
  background: #fff;
}

.diff-line-added td {
  background: #e9f6e9;
}

.diff-line-removed td {
  background: #fdecec;
}

.diff-line-changed td {
  background: #fff8d7;
}

.line-no {
  width: 56px;
  color: #777;
  text-align: right;
  user-select: none;
}

.color-preview {
  min-height: 116px;
  border: 1px solid #888;
  background: #2f80ed;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.swatch {
  border: 1px solid #aaa;
  background: #fff;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.swatch-color {
  display: block;
  height: 40px;
}

.swatch-name {
  display: block;
  padding: 5px 6px;
  color: #333;
  font-size: 12px;
}

.site-footer {
  border-top: 1px solid #bdbdbd;
  background: #e5e5e5;
  color: #444;
  font-size: 12px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.muted {
  color: #666;
}

@media (max-width: 820px) {
  .topbar-inner,
  .header-main,
  .footer-inner {
    display: block;
  }

  .topbar-inner span {
    display: block;
  }

  .header-main {
    padding-bottom: 0;
  }

  .main-nav {
    margin-top: 8px;
  }

  .main-nav a {
    min-width: 0;
    border-bottom: 1px solid #aaa;
    margin-bottom: 6px;
  }

  .main-nav a.active {
    top: 0;
  }

  .home-layout,
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .result-grid,
  .form-row,
  .form-row.three,
  .palette-grid {
    grid-template-columns: 1fr;
  }

  .directory-table,
  .directory-table thead,
  .directory-table tbody,
  .directory-table th,
  .directory-table td,
  .directory-table tr {
    display: block;
  }

  .directory-table thead {
    position: absolute;
    left: -9999px;
  }

  .directory-table tr {
    border: 1px solid #cfcfcf;
    margin-bottom: 8px;
  }

  .directory-table td {
    border: 0;
    border-bottom: 1px solid #e4e4e4;
  }

  .directory-table td::before {
    display: block;
    margin-bottom: 2px;
    color: #666;
    font-size: 12px;
    font-weight: 700;
  }

  .directory-table td:nth-child(1)::before {
    content: "분류";
  }

  .directory-table td:nth-child(2)::before {
    content: "도구";
  }

  .directory-table td:nth-child(3)::before {
    content: "설명";
  }

  .directory-table td:nth-child(4)::before {
    content: "키워드";
  }

  .directory-table td:nth-child(5)::before {
    content: "이동";
  }

  .directory-table td:last-child {
    border-bottom: 0;
    text-align: left;
  }

  .page-title {
    font-size: 22px;
  }

  .result-value {
    font-size: 20px;
  }
}

@media (min-width: 821px) and (max-width: 1040px) {
  .palette-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
