:root {
  --bg: #f6f9fc;
  --panel: #ffffff;
  --ink: #09172b;
  --muted: #60708a;
  --line: #dbe5f1;
  --blue: #2458d3;
  --teal: #12b89a;
  --gold: #e5a72f;
  --code: #0b1628;
  --soft-blue: #eaf1ff;
  --soft-teal: #e7faf5;
  --shadow: 0 18px 46px rgba(10, 27, 56, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(36, 88, 211, .12), transparent 34rem),
    linear-gradient(180deg, #f9fcff 0%, var(--bg) 38%, #eef5fb 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.72;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(219, 229, 241, .84);
  background: rgba(248, 251, 255, .9);
  backdrop-filter: blur(16px);
}

.header-inner,
.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 900;
  font-size: 22px;
  white-space: nowrap;
}

.brand img {
  width: 42px;
  height: 42px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav a {
  border-radius: 8px;
  color: #263954;
  font-weight: 800;
  padding: 8px 11px;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: var(--soft-blue);
  color: var(--blue);
  text-decoration: none;
}

.hero {
  padding: 38px 0 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 24px;
  align-items: stretch;
}

.eyebrow {
  color: var(--teal);
  font-weight: 900;
  margin: 0 0 8px;
}

h1,
h2,
h3 {
  line-height: 1.18;
  margin: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(34px, 6vw, 72px);
}

h2 {
  font-size: clamp(26px, 3vw, 38px);
}

h3 {
  font-size: 22px;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 20px;
  margin: 18px 0 0;
}

.tool-shell,
.panel,
.tool-card,
.guide-card,
.stat {
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-shell {
  padding: 22px;
}

.console {
  background: var(--code);
  border-radius: 8px;
  color: #e9f2ff;
  min-height: 100%;
  overflow: hidden;
}

.console-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: 13px 16px;
  color: #9fb2cf;
  font-size: 14px;
  font-weight: 800;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
}

.console-body {
  padding: 18px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 14px;
}

.console-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 9px 0;
}

.console-line:last-child {
  border-bottom: 0;
}

.section {
  padding: 36px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head p {
  color: var(--muted);
  margin: 0;
  max-width: 680px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tool-card,
.guide-card {
  min-height: 210px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card strong {
  color: var(--teal);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tool-card p,
.guide-card p,
.panel p {
  color: var(--muted);
  margin: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.btn {
  align-items: center;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
}

.btn.secondary {
  background: #fff;
  color: var(--blue);
}

.btn:hover {
  text-decoration: none;
  filter: brightness(.97);
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(320px, .22fr);
  gap: 22px;
  align-items: start;
  padding: 30px 0 44px;
}

.panel {
  padding: 24px;
}

.panel + .panel {
  margin-top: 18px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.label {
  color: #263954;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd8ea;
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  background: #fff;
}

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

.result {
  background: #071427;
  border-radius: 8px;
  color: #e9f2ff;
  font-family: "Cascadia Mono", "Consolas", monospace;
  margin-top: 16px;
  min-height: 74px;
  overflow-x: auto;
  padding: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.result-chip {
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.result-chip span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.result-chip b {
  display: block;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.qr-box {
  align-items: center;
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  min-height: 300px;
  padding: 18px;
}

.qr-box canvas {
  background: #fff;
  border: 12px solid #fff;
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(10, 27, 56, .12);
  height: min(248px, 72vw);
  image-rendering: pixelated;
  width: min(248px, 72vw);
}

.note {
  background: var(--soft-teal);
  border: 1px solid #c4efe5;
  border-radius: 8px;
  color: #22564c;
  padding: 14px 16px;
}

.side-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.side-list a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  font-weight: 800;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.stat b {
  display: block;
  font-size: 28px;
}

.article {
  max-width: 880px;
  padding: 34px 0 56px;
}

.article h1 {
  font-size: clamp(32px, 5vw, 56px);
}

.article h2 {
  margin-top: 34px;
}

.article p,
.article li {
  color: #31435d;
}

.article code,
code {
  background: #eaf1ff;
  border-radius: 5px;
  color: #143a82;
  padding: 2px 6px;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 28px 0 36px;
}

.footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .hero-grid,
  .tool-layout,
  .tools-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    font-size: 20px;
  }

  .nav a {
    padding: 7px 9px;
  }
}

/* Compact tool headings and resilient narrow-screen controls. */
h1, .article h1 { font-size: 36px; overflow-wrap: anywhere; }
h2 { font-size: 25px; }
.panel h1 { font-size: 30px; }
.panel h2 { margin: 20px 0 12px; font-size: 22px; }
.panel, .tool-layout > *, .form-grid > * { min-width: 0; }
.article > .panel { margin-top: 24px; }
.header-inner { flex-wrap: wrap; padding: 12px 0; gap: 10px; }
.nav { gap: 2px; }
.nav a { font-size: 14px; padding: 6px 8px; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; vertical-align: middle; accent-color: var(--blue); }
[data-checklist] .field { padding: 10px 0; border-bottom: 1px solid var(--line); }
progress { width: 100%; margin: 18px 0; accent-color: var(--teal); }
.warning { background: #fff4df; color: #713e00; border-left: 4px solid #db9619; padding: 16px; }
.flow { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.flow span { padding: 8px 12px; border-bottom: 3px solid var(--teal); background: white; }
.table-wrap { max-width: 100%; overflow-x: auto; margin: 18px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
caption { text-align: left; font-weight: bold; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.result { overflow-wrap: anywhere; }
.article { overflow-wrap: anywhere; }
.result .btn { margin: 6px 0; }
:focus-visible { outline: 3px solid #129d83; outline-offset: 3px; }
.language-control { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.language-control select { width: 138px; min-height: 38px; padding: 5px 8px; font-size: 14px; }
.language-control label { font-size: 13px; }
.header-inner .nav { flex: 1 1 520px; }
html[lang="km"] body { font-family: "Khmer UI", "Leelawadee UI", "Noto Sans Khmer", sans-serif; line-height: 1.9; }
html[lang="th"] body { font-family: "Leelawadee UI", "Noto Sans Thai", sans-serif; line-height: 1.8; }
html[dir="rtl"] body { font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
html[dir="rtl"] .wallet-banner-action { margin-left: 0; margin-inline-start: auto; }
html[dir="rtl"] .warning { border-left: 0; border-right: 4px solid #db9619; }
html[dir="rtl"] .nav { justify-content: flex-start; }
html[dir="rtl"] th, html[dir="rtl"] td, html[dir="rtl"] caption { text-align: start; }
html[dir="rtl"] input:not([type="checkbox"]), html[dir="rtl"] textarea, html[dir="rtl"] code { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .result { unicode-bidi: plaintext; text-align: start; }
.tool-card, .guide-card, .console-line, .brand, .btn { overflow-wrap: anywhere; }
.brand { white-space: normal; }
@media(max-width:640px) { .header-inner .nav {flex-basis:auto;} .language-control {margin-inline-start:0;} html[dir="rtl"] .wallet-banner-action {margin:0;} }
[hidden] { display: none !important; }
.wallet-banner { background: #e8f5f4; border-bottom: 1px solid #c9e4e0; }
.wallet-banner-link { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; color: #163d43; }
.wallet-banner-link:hover { text-decoration: none; background: #dff0ee; }
.wallet-banner-link img { flex: 0 0 44px; border-radius: 8px; object-fit: contain; }
.wallet-banner-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; min-width: 0; }
.wallet-banner-copy strong { font-size: 20px; color: #163b77; }
.wallet-banner-copy > span { font-size: 14px; }
.wallet-banner-action { margin-left: auto; color: #2058bc; font-weight: 700; white-space: nowrap; font-size: 14px; }
.wallet-banner-link small { color: #597674; font-size: 11px; white-space: nowrap; }
@media (max-width:640px) {
  .wallet-banner-link { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 5px 10px; }
  .wallet-banner-link img { width: 40px; height: 40px; grid-row: 1 / 3; }
  .wallet-banner-copy { display: grid; gap: 0; }
  .wallet-banner-copy strong { font-size: 18px; }
  .wallet-banner-copy > span { font-size: 12px; }
  .wallet-banner-action { grid-column: 2; grid-row: 2; margin: 0; font-size: 13px; white-space: normal; }
  .wallet-banner-link small { grid-column: 3; grid-row: 1; }
}
@media(max-width:640px) { h1,.article h1,.panel h1 {font-size:28px;} .panel {padding:16px;} .site-header {position:static;} .qr-box {padding:8px;} .qr-box canvas {max-width:100%;height:auto;} }
