:root {
  --ink: #141b26;
  --ink-soft: #3a4658;
  --paper: #ebe4d6;
  --paper-deep: #dfd5c2;
  --amber: #c4892a;
  --amber-deep: #8f5f12;
  --line: #c9bda8;
  --danger: #8f3a2f;
  --ok: #2f6b4f;
  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(196, 137, 42, 0.22), transparent 55%),
    radial-gradient(ellipse 45% 40% at 100% 20%, rgba(20, 27, 38, 0.08), transparent 50%),
    linear-gradient(180deg, #e8dfcf 0%, #ebe4d6 40%, #e3d9c7 100%);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--amber-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  max-width: 1080px;
  margin: 0 auto;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand:hover {
  text-decoration: none;
  color: var(--amber-deep);
}

.nav {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--ink);
  text-decoration: underline;
}

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
  min-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 8% 5% auto auto;
  width: min(420px, 55vw);
  height: min(420px, 55vw);
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, rgba(240, 213, 138, 0.55), transparent 55%),
    radial-gradient(circle at 60% 65%, rgba(196, 137, 42, 0.25), transparent 60%);
  filter: blur(2px);
  pointer-events: none;
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 500;
  line-height: 1.35;
  margin: 0 0 0.85rem;
  max-width: 22ch;
  color: var(--ink-soft);
}

.hero-lead {
  max-width: 38ch;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 1.75rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-deep), var(--amber));
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.05);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--ink-soft);
  text-decoration: none;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-wide {
  max-width: 1100px;
}

.page h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 0.5rem;
}

.page-lead {
  color: var(--ink-soft);
  margin: 0 0 1.75rem;
  line-height: 1.5;
}

.panel {
  background: rgba(250, 247, 240, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(6px);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

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

.label {
  display: block;
  font-size: 0.9rem;
  font-weight: 550;
  margin-bottom: 0.35rem;
}

.input,
.select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.input:focus,
.select:focus {
  outline: 2px solid rgba(196, 137, 42, 0.45);
  outline-offset: 1px;
}

.form-actions {
  margin-top: 0.5rem;
}

.error {
  color: var(--danger);
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
}

.muted {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.result-hidden {
  display: none;
}

.result-summary {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 1rem;
  line-height: 1.4;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* Classic 4×4 lá số: 12 cung around a 2×2 center */
.laso-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(110px, auto));
  grid-template-areas:
    'tu_tuc   phu_the  huynh_de menh'
    'tai_bach center   center   phu_mau'
    'tat_ach  center   center   phuc_duc'
    'thien_di no_boc   quan_loc dien_trach';
  gap: 0;
  border: 2px solid #5c4a2e;
  background: #f3e6c8;
  box-shadow: 0 12px 40px rgba(26, 35, 50, 0.12);
  overflow: hidden;
}

.laso-cell {
  border: 1px solid #8a7348;
  padding: 0.35rem 0.4rem 0.5rem;
  background:
    linear-gradient(180deg, rgba(255, 250, 235, 0.92), rgba(240, 226, 190, 0.88));
  min-height: 110px;
  font-size: 0.72rem;
  line-height: 1.35;
}

.laso-cell-top {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: #5c4a2e;
  margin-bottom: 0.15rem;
}

.laso-chi {
  font-weight: 700;
}

.laso-dv {
  opacity: 0.85;
}

.laso-cung-name {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: #1a2332;
  margin: 0.15rem 0 0.35rem;
  border-bottom: 1px solid rgba(92, 74, 46, 0.25);
  padding-bottom: 0.2rem;
}

.laso-stars {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.star-major {
  font-weight: 700;
  color: #8b1e1e;
}

.star-minor {
  color: #2f5d3a;
}

.star-luu {
  font-weight: 700;
  color: #1a4d8c;
}

.star-el {
  color: #8f5f12;
  font-weight: 600;
}

.laso-cell.is-dai-van {
  box-shadow: inset 0 0 0 2px #c4892a;
  background: linear-gradient(180deg, rgba(255, 244, 214, 0.98), rgba(245, 220, 160, 0.92));
}

.laso-cell.is-luu-tue {
  outline: 1px dashed #1a4d8c;
  outline-offset: -3px;
}

.laso-center {
  grid-area: center;
  border: 1px solid #8a7348;
  padding: 0.75rem 0.9rem;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(196, 137, 42, 0.12), transparent 55%),
    linear-gradient(180deg, #f7edd6, #efe0bf);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.28rem;
  font-size: 0.82rem;
}

.laso-center-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.35rem;
  color: #1a2332;
}

.laso-center-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.35rem;
  align-items: baseline;
}

.laso-center-row span {
  color: #5c4a2e;
}

.laso-center-row strong {
  font-weight: 600;
  color: #1a2332;
}

.laso-center-engine {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.72rem;
}

@media (max-width: 800px) {
  .laso-board {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: none;
  }

  .laso-center,
  .laso-cell {
    grid-area: auto !important;
  }

  .laso-center {
    order: -1;
  }

  .laso-center-row {
    grid-template-columns: 5.5rem 1fr;
  }
}

.interp {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.interp li {
  margin-bottom: 0.45rem;
}

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
}

.site-footer a {
  color: var(--ink-soft);
}
