@font-face {
  font-family: "Khmer OS Battambang";
  src: url("fonts/KhmerOSbattambang.ttf") format("truetype");
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #1b1d1b;
  --muted: #818883;
  --surface: #f3f4f2;
  --blue: #cadff1;
  --green: #cce9d5;
}

* { box-sizing: border-box; }
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { display: none; }
body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px;
  color: var(--ink);
  font-family: system-ui, "Khmer OS Battambang", sans-serif;
  line-height: 1.65;
  background: linear-gradient(125deg, #d7e8f7 0%, #e7ece8 52%, #f5efd7 100%);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #6b9fbb;
  outline-offset: 3px;
}
.notebook {
  max-width: 860px;
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 38px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 36px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(58, 76, 80, .12);
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.head-identity { display: flex; align-items: center; gap: 22px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand img { flex: none; width: 52px; height: 52px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { color: #285d43; font-family: "Khmer OS Battambang", sans-serif; font-size: 1.16rem; font-weight: 700; line-height: 1.55; }
.brand-caption { color: #8a968e; font-family: system-ui, sans-serif; font-size: .56rem; font-weight: 700; letter-spacing: .12em; }
.eyebrow { margin: 0 0 7px; color: #858d89; font-size: .67rem; font-weight: 700; letter-spacing: .13em; }
.eyebrow span { color: #79b58d; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.45rem, 3.2vw, 2.15rem); line-height: 1.4; letter-spacing: -.03em; }
.subtitle { margin-bottom: 0; color: var(--muted); font-size: .88rem; }
.pill, .close {
  flex: none;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #313832;
}
.pill { font-size: .75rem; font-weight: 700; }
.welcome {
  position: relative;
  display: flex;
  min-height: 190px;
  overflow: hidden;
  margin: 28px 0 22px;
  padding: 24px 28px;
  border-radius: 26px;
  background: linear-gradient(115deg, #cee7d5 0%, #e5eee4 50%, #cbdff0 100%);
}
.welcome-copy { position: relative; z-index: 1; max-width: 65%; }
.welcome-icon {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  margin-bottom: 12px; border-radius: 50%; background: rgba(255,255,255,.66); color: #438d62;
}
.welcome-label { margin-bottom: 4px; color: #6d8072; font-size: .72rem; font-weight: 700; }
.welcome h2 { margin-bottom: 5px; font-size: 1.4rem; line-height: 1.5; }
.welcome-copy > p:last-child { margin-bottom: 0; color: #62726a; font-size: .84rem; }
.welcome-art {
  position: absolute; right: -15px; bottom: -96px; width: 250px; height: 250px;
  border-radius: 50%; background: linear-gradient(145deg, rgba(255,255,255,.82), rgba(255,255,255,.05));
  box-shadow: -25px -20px 70px rgba(255,255,255,.3);
}
.welcome-art span {
  position: absolute; inset: 44px; border-radius: 50%;
  background: linear-gradient(145deg, #f8f8ef, #c0d8e6);
}
.tabs {
  display: inline-flex; gap: 4px; max-width: 100%; padding: 4px;
  border-radius: 999px; background: #e6e9e6;
}
.tab {
  min-height: 42px; padding: 7px 19px; border: 0; border-radius: 999px;
  background: transparent; color: #717a73; font-size: .84rem; font-weight: 600;
}
.tab.active { background: #202722; color: white; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 32px 0 15px; }
.section-heading .eyebrow { margin-bottom: 2px; }
.section-heading h2 { margin-bottom: 0; font-size: 1.3rem; }
.count { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
input, select, textarea {
  width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 14px;
  background: #fff; color: var(--ink);
}
input, select { min-height: 48px; padding: 10px 12px; font-size: .83rem; }
select { cursor: pointer; }
.search-wrap { position: relative; }
.search-wrap span { position: absolute; top: 4px; left: 15px; color: #8a938c; font-size: 1.6rem; }
.search-wrap input { padding-left: 40px; }
input::placeholder { color: #9aa19b; }
.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  min-height: 180px; padding: 20px; border: 0; border-radius: 22px;
  background: #fff; color: var(--ink); text-align: left;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 9px 24px rgba(62, 80, 68, .09); }
.card:nth-child(4n + 1) { background: linear-gradient(145deg, #d4e5f1, #edf2ef 85%); }
.card:nth-child(4n + 2) { background: linear-gradient(145deg, #d9eedf, #f5f7f2 85%); }
.card-top { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; }
.card-category { color: #77847c; font-size: .7rem; font-weight: 600; }
.card-arrow { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.8); font-size: 1rem; }
.card h3 { margin: 14px 0 4px; font-size: 1rem; line-height: 1.5; }
.card p { margin: 0 0 16px; color: #77817b; font-size: .8rem; line-height: 1.6; }
.card-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.75); color: #53645a; font-size: .7rem; font-weight: 600; }
.saved-mark { color: #4a9b70; font-size: .8rem; }
.empty { padding: 35px 10px; color: var(--muted); text-align: center; font-size: .9rem; }
.foot { margin: 28px 0 0; color: #969d97; font-size: .72rem; text-align: center; }
.modal {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center;
  justify-content: center; padding: 16px; background: rgba(31, 41, 35, .45);
}
.modal[hidden] { display: none; }
.sheet {
  position: relative; width: 100%; max-width: 550px; max-height: 90vh; overflow: auto;
  padding: 28px; border-radius: 28px; background: #f5f6f3;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.sheet h2 { max-width: calc(100% - 48px); margin-bottom: 8px; font-size: 1.35rem; line-height: 1.5; }
.sheet > #detail > p { color: #7a847c; font-size: .9rem; }
.sheet dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.detail-item { padding: 14px; border-radius: 16px; background: #fff; }
.sheet dt { margin-bottom: 5px; color: #8a938c; font-size: .75rem; }
.sheet dd { margin: 0; font-size: .88rem; font-weight: 600; }
.sheet > #detail > .guide-notice { padding: 12px 14px; border-radius: 14px; background: #e6eee6; color: #53665a; font-size: .76rem; }
.guide section { margin: 21px 0; }
.guide h3 { margin: 0 0 7px; font-size: .95rem; }
.guide p, .guide ol { margin: 0; color: #58635a; font-size: .86rem; line-height: 1.8; }
.guide ol { padding-left: 22px; }
.guide li + li { margin-top: 6px; }
.close { position: absolute; right: 20px; top: 20px; font-size: 1.4rem; line-height: 1; }
.actions { margin: 16px 0; }
.btn { padding: 10px 18px; border: 0; border-radius: 999px; background: #222b25; color: #fff; }
.btn.primary { background: #d7ecdf; color: #286344; }
.note-label { display: block; color: #636f66; font-size: .85rem; font-weight: 600; }
textarea { display: block; min-height: 105px; margin-top: 8px; padding: 12px; resize: vertical; font-weight: 400; }
@media (max-width: 600px) {
  body { padding: 0; background: var(--surface); }
  .notebook { min-height: 100vh; padding: 26px 18px; border: 0; border-radius: 0; box-shadow: none; }
  .page-head { display: grid; grid-template-columns: minmax(0, 1fr) 46px; column-gap: 12px; row-gap: 12px; align-items: start; }
  .head-identity { grid-column: 1; grid-row: 1; align-items: center; }
  .brand { gap: 8px; }
  .brand img { width: 40px; height: 40px; }
  .brand-name { font-size: .98rem; }
  .brand-caption { font-size: .48rem; }
  .heading-copy { grid-column: 1 / -1; grid-row: 2; }
  h1 { font-size: clamp(1.3rem, 5.7vw, 1.75rem); line-height: 1.3; }
  .subtitle { font-size: .82rem; }
  #langBtn { grid-column: 2; grid-row: 1; }
  .welcome { min-height: 180px; margin-top: 22px; padding: 22px; }
  .welcome-copy { max-width: 75%; }
  .welcome-art { right: -90px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
  .list { grid-template-columns: 1fr; }
  .card { min-height: 150px; }
  .sheet { padding: 22px; }
}
