:root {
  --bg: #f6f6ef;
  --header: #1f2023;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #dfd8c6;
  --surface: #ffffff;
  --chip: #ffffff;
  --btn-border: #d5ccb8;
  --callout-bg: #f7f6f3;
  --callout-border: #e3e1dc;
}

* {
  box-sizing: border-box;
}

[data-theme="dark"] {
  --bg: #101218;
  --header: #1f2023;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #2f3441;
  --surface: #161922;
  --chip: #1f2430;
  --btn-border: #3d4558;
  --callout-bg: #202532;
  --callout-border: #353d4f;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header);
  border-bottom: 1px solid #2d2f34;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1 {
  margin: 0;
  font-size: 22px;
  color: #fff;
}

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

#themeToggle {
  border: 1px solid #4b5563;
  background: transparent;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.toolbar input,
.toolbar select,
.pager button,
#backBtn {
  border: 1px solid var(--btn-border);
  background: var(--chip);
  color: var(--text);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
}

.list {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  padding: 8px 12px;
}

.item {
  padding: 8px 0;
  border-bottom: 1px dotted #d4ccb8;
}

.item:last-child {
  border-bottom: none;
}

.item-head {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 6px;
}

.rank {
  text-align: right;
  color: #8f8f8f;
  font-size: 12px;
}

.title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.summary {
  margin-top: 3px;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

#firstBtn,
#lastBtn {
  background: transparent;
  border: none;
}

.detail {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 14px;
}

.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--callout-bg);
  border: 1px solid var(--callout-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 14px;
}

.callout-icon {
  font-size: 16px;
  line-height: 1.4;
}

.callout-text {
  font-size: 15px;
  line-height: 1.6;
}

.callout-text p {
  margin: 0 0 8px;
}

.callout-text p:last-child {
  margin-bottom: 0;
}

.callout-text ul {
  margin: 0;
  padding-left: 20px;
}

.callout-text li {
  margin: 4px 0;
}

.detail-thumb {
  width: 100%;
  max-width: 680px;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 4px 0 14px;
}

.detail article {
  font-size: 1em;
  line-height: 1.8em;
  word-break: break-word;
  white-space: pre-wrap;
}

.detail article li {
  font-size: 16px;
  line-height: 1.8em;
  padding-bottom: 16px;
}

.detail article li:last-child {
  padding-bottom: 0;
}

.hidden {
  display: none;
}

@media (max-width: 1199px) {
  body {
    font-size: 16px;
  }
  .toolbar {
    grid-template-columns: 1fr;
  }
  .title {
    font-size: 16px;
  }
  .summary {
    font-size: 15px;
  }
  .meta {
    font-size: 13px;
  }
  .detail article {
    font-size: 1em;
    line-height: 1.8em;
  }
}
