:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --text-color: #17191d;
  --muted-color: #686d76;
  --line-color: #e4e7eb;
  --soft-bg: #f7f8fa;
  --control-bg: #ffffff;
  --control-hover: #f1f3f5;
  --focus-color: #5b78ff;
  --h1-size: 36px;
  --h1-weight: 700;
  --h2-size: 30px;
  --h2-weight: 700;
  --h3-size: 22px;
  --h3-weight: 700;
  --p-size: 18px;
  --p-weight: 400;
  --p-line: 1.5;
}

@font-face {
  font-family: "Melodrama";
  src: url("fonts/melodrama/melodrama-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Melodrama";
  src: url("fonts/melodrama/melodrama-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Melodrama";
  src: url("fonts/melodrama/melodrama-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Melodrama";
  src: url("fonts/melodrama/melodrama-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Melodrama";
  src: url("fonts/melodrama/melodrama-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bonny";
  src: url("fonts/bonny/bonny-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bonny";
  src: url("fonts/bonny/bonny-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bonny";
  src: url("fonts/bonny/bonny-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bonny";
  src: url("fonts/bonny/bonny-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pilcrow Rounded";
  src: url("fonts/pilcrow-rounded/pilcrow-rounded-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pilcrow Rounded";
  src: url("fonts/pilcrow-rounded/pilcrow-rounded-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pilcrow Rounded";
  src: url("fonts/pilcrow-rounded/pilcrow-rounded-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pilcrow Rounded";
  src: url("fonts/pilcrow-rounded/pilcrow-rounded-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("fonts/supreme/supreme-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("fonts/supreme/supreme-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("fonts/supreme/supreme-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("fonts/supreme/supreme-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quilon";
  src: url("fonts/quilon/quilon-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quilon";
  src: url("fonts/quilon/quilon-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quilon";
  src: url("fonts/quilon/quilon-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quilon";
  src: url("fonts/quilon/quilon-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ranade";
  src: url("fonts/ranade/ranade-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ranade";
  src: url("fonts/ranade/ranade-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ranade";
  src: url("fonts/ranade/ranade-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ranade";
  src: url("fonts/ranade/ranade-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Excon";
  src: url("fonts/excon/excon-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Excon";
  src: url("fonts/excon/excon-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Excon";
  src: url("fonts/excon/excon-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Excon";
  src: url("fonts/excon/excon-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #2f3137;
  --text-color: #ffffff;
  --muted-color: rgba(255, 255, 255, 0.7);
  --line-color: rgba(255, 255, 255, 0.15);
  --soft-bg: rgba(255, 255, 255, 0.05);
  --control-bg: #2f3137;
  --control-hover: rgba(255, 255, 255, 0.08);
  --focus-color: #9eb0ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 180ms ease, color 180ms ease;
}

a {
  color: inherit;
}

button,
select,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  font: inherit;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  min-height: 74px;
  padding: 18px clamp(18px, 4vw, 46px);
  background: var(--page-bg);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: var(--text-color);
  font-size: clamp(21px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  text-decoration: none;
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line-color);
  border-radius: 999px;
}

.theme-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-color);
  cursor: pointer;
}

.theme-button:hover,
.theme-button:focus-visible,
.theme-button.is-active {
  background: var(--control-hover);
  color: var(--text-color);
}

.theme-button:focus-visible,
.tab-trigger:focus-visible,
.font-actions a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.global-settings {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 2px;
}

.setting-group {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 7px;
  padding: 5px;
  border-radius: 7px;
  background: var(--soft-bg);
}

.setting-row {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
}

.setting-row label {
  color: var(--muted-color);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.setting-row select {
  width: auto;
  min-width: 0;
  min-height: 28px;
  padding: 3px 22px 3px 7px;
  border: 1px solid var(--line-color);
  border-radius: 6px;
  background-color: var(--control-bg);
  color: var(--text-color);
  font-size: 13px;
  line-height: 1.2;
}

.sample-text-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.sample-text-control label {
  color: var(--muted-color);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.sample-text-control input {
  width: min(760px, 100%);
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line-color);
  border-radius: 6px;
  background-color: var(--control-bg);
  color: var(--text-color);
  font-size: 14px;
  line-height: 1.2;
}

.font-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  width: 100%;
  padding: clamp(22px, 3vw, 42px) clamp(18px, 4vw, 46px) 56px;
}

.font-column {
  min-width: 0;
}

.font-list {
  display: grid;
  gap: 10px;
}

.column-title {
  margin: 0 0 16px;
  color: var(--text-color);
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.font-tab {
  border: 1px solid var(--line-color);
  border-radius: 8px;
  overflow: hidden;
}

.tab-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 9px 16px;
  border: 0;
  background: transparent;
  color: var(--text-color);
  text-align: left;
  cursor: pointer;
}

.tab-trigger:hover {
  background: var(--soft-bg);
}

.tab-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-family);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}

.tab-meta {
  color: var(--muted-color);
  font-size: 13px;
  white-space: nowrap;
}

.font-tab.is-open .tab-trigger svg {
  transform: rotate(180deg);
}

.tab-panel {
  display: none;
  padding: 22px 18px 18px;
  border-top: 1px solid var(--line-color);
}

.font-tab.is-open .tab-panel {
  display: block;
}

.font-preview {
  font-family: var(--font-family);
}

.font-preview h1,
.font-preview h2,
.font-preview h3,
.font-preview p {
  margin: 0;
  color: var(--text-color);
  letter-spacing: 0;
}

.font-preview h1 {
  font-size: var(--h1-size);
  font-weight: var(--h1-weight);
  line-height: 1.12;
}

.font-preview h2 {
  margin-top: 18px;
  font-size: var(--h2-size);
  font-weight: var(--h2-weight);
  line-height: 1.16;
}

.font-preview h3 {
  margin-top: 16px;
  font-size: var(--h3-size);
  font-weight: var(--h3-weight);
  line-height: 1.2;
}

.font-preview p {
  margin-top: 18px;
  font-size: var(--p-size);
  font-weight: var(--p-weight);
  line-height: var(--p-line);
  overflow-wrap: anywhere;
}

.font-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.font-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-color);
  border-radius: 6px;
  color: var(--text-color);
  text-decoration: none;
}

.font-actions a:hover {
  background: var(--soft-bg);
}

@media (max-width: 1180px) {
  .font-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    position: static;
  }

  .header-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .theme-switch {
    width: 100%;
  }

  .theme-button {
    flex: 1 1 0;
  }

  .tab-trigger {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tab-meta {
    display: none;
  }

  .global-settings {
    width: 100%;
  }
}
