:root {
  color-scheme: light;
  --bg: #f8f5ef;
  --surface: #ffffff;
  --surface-tint: #f2ece0;
  --border: #e2d8c5;
  --border-strong: #c9baa1;
  --accent: #8b5e14;
  --accent-bg: #8b5e14;
  --accent-fg: #ffffff;
  --accent-soft: rgba(139, 94, 20, 0.11);
  --danger: #9e1b32;
  --text: #181512;
  --muted: #5c554e;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(24, 21, 18, 0.04);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0d0c;
  --surface: #171514;
  --surface-tint: #211e1b;
  --border: #2c2825;
  --border-strong: #463f39;
  --accent: #e5c37e;
  --accent-bg: #e5c37e;
  --accent-fg: #14110d;
  --accent-soft: rgba(229, 195, 126, 0.14);
  --danger: #e0526b;
  --text: #f5f1ea;
  --muted: #b8b0a6;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.62 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", "PingFang SC", "PingFang TC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.24;
  margin: 0;
}

p { margin: 0; }

.nk-shell {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-inline: clamp(16px, 4vw, 28px);
}

/* Header: Clean single row on desktop */
.nk-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nk-header-inner {
  min-height: 74px;
  padding-block: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nk-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.nk-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.nk-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}

.nk-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.nk-nav a:hover { color: var(--accent); }

.nk-seg-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
}

.nk-seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.nk-seg-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nk-theme-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.nk-theme-btn:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 780px) {
  .nk-header-inner { flex-wrap: wrap; }
  .nk-header-right { flex-wrap: wrap; gap: 8px; }
}

.nk-main { padding-block: clamp(24px, 4vw, 40px) 64px; }

.nk-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.nk-hero-intro { margin-bottom: 28px; }
.nk-hero-intro h1 { font-size: clamp(1.65rem, 3.4vw, 2.2rem); margin-bottom: 10px; }
.nk-hero-intro p { color: var(--muted); font-size: 0.98rem; }

.nk-pick-heading {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", "PingFang SC", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Point-form calculation bars with clear spacing between each item */
.nk-bar-item {
  display: block;
  margin-bottom: 24px;
}

.nk-bar-summary {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 8px;
}

button.nk-bar-btn {
  display: flex;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

button.nk-bar-btn:hover {
  border-color: var(--accent);
  background: var(--surface-tint);
}

.nk-bar-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text);
}

.nk-bar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.nk-bar-cadence {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 500;
}

/* Panel, Form & Reading */
.nk-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 28px);
}

.nk-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.nk-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
}
.nk-link-btn:hover { text-decoration: underline; }

.nk-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.nk-field { display: flex; flex-direction: column; gap: 6px; }
.nk-field label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.nk-field small { font-size: 0.78rem; color: var(--muted); }

.nk-input, .nk-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}
.nk-input:disabled { opacity: 0.45; }

.nk-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
  cursor: pointer;
}

.nk-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.nk-pill {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.nk-pill.is-active { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-fg); }

.nk-primary-btn {
  background: var(--accent-bg);
  color: var(--accent-fg);
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
}
.nk-primary-btn:hover { filter: brightness(1.06); }

.nk-secondary-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.nk-secondary-btn:hover { border-color: var(--accent); color: var(--accent); }

.nk-privacy-bar {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.nk-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(158, 27, 50, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.88rem;
}

.nk-reading-headline { font-size: clamp(1.35rem, 2.8vw, 1.8rem); margin-bottom: 12px; }
.nk-reading-overview { font-size: 1rem; line-height: 1.7; color: var(--text); margin-bottom: 18px; }

.nk-start-banner {
  background: var(--surface-tint);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 22px;
}
.nk-start-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.nk-start-banner p { font-size: 0.96rem; font-weight: 500; color: var(--text); }

.nk-themes-heading {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.nk-themes-list { margin: 0 0 20px 0; padding-left: 20px; }
.nk-themes-list li { font-size: 0.96rem; line-height: 1.65; color: var(--muted); }
.nk-themes-list li + li { margin-top: 10px; }
.nk-themes-list strong { color: var(--text); }

.nk-extra-box {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.nk-details {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}
.nk-details summary { cursor: pointer; font-weight: 600; }
.nk-details p { margin-top: 8px; line-height: 1.55; }

.nk-prose { max-width: 720px; }
.nk-prose h1 { font-size: clamp(1.75rem, 3.5vw, 2.3rem); margin-bottom: 12px; }
.nk-prose h2 { font-size: 1.35rem; margin-top: 26px; margin-bottom: 10px; color: var(--accent); }
.nk-prose p, .nk-prose li { color: var(--muted); font-size: 0.98rem; }
.nk-prose ul { padding-left: 20px; }
.nk-prose li + li { margin-top: 6px; }

.nk-footer {
  border-top: 1px solid var(--border);
  padding-block: 24px;
  font-size: 0.82rem;
  color: var(--muted);
}
.nk-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.nk-footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.nk-footer-links a:hover { color: var(--accent); }

@media print {
  :root, [data-theme="dark"] {
    --bg: #ffffff; --surface: #ffffff; --surface-tint: #f6f4f0;
    --border: #d6d0c4; --accent: #5c3f0c; --text: #111111; --muted: #333333;
  }
  body { background: #ffffff; color: #111111; font-size: 11pt; }
  .nk-header, .nk-footer, .nk-topbar, .nk-extra-box { display: none !important; }
  .nk-panel { border: none; box-shadow: none; padding: 0; }
}

.nk-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.nk-footer-brand img {
  height: 28px;
  width: auto;
  display: block;
}

.nk-brand img {
  height: 34px;
  width: auto;
  display: block;
}

@media (max-width: 860px) {
  .nk-header-inner { flex-wrap: wrap; row-gap: 12px; }
  .nk-header-right { flex-wrap: wrap; gap: 10px; }
}
