/* ---------- Hero Auth Gate (Benchmarked to Research Report Cover) ---------- */
.hero-gate {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 32px;
  align-items: center;
  min-height: calc(100vh - 130px);
}
@media (max-width: 980px) { .hero-gate { grid-template-columns: 1fr; } }

.hero-left h1 {
  font-size: clamp(34px, 4.4vw, 54px);
  margin: .15em 0 .25em;
}
.hero-left h1 .accent { color: var(--seal); }

.stats-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
}
@media (max-width: 780px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--sh);
}
.stat .v {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--seal);
  font-variant-numeric: tabular-nums;
}
.stat .l { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }

.hero-showcase {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 18px;
  box-shadow: var(--sh);
}
.hero-glyph {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  cursor: pointer;
}
.hero-glyph .frame {
  position: absolute;
  inset: -4px;
  border: 2px solid var(--seal);
  border-radius: 14px;
  opacity: .28;
}
.hero-glyph svg { width: 100%; height: 100%; overflow: visible; }
.hero-cap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
}
.hero-cap b {
  display: block;
  font-family: var(--nom);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow: var(--sh-lg);
}
.auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.auth-tabs button { flex: 1; }
.demo-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* ---------- Projects & Editions ---------- */
.project-card { border-left: 4px solid var(--seal); }
.edition-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 12px;
}
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.page-thumb {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.page-thumb:hover { transform: translateY(-2px); border-color: var(--seal); box-shadow: var(--sh); }
.page-thumb img {
  width: 100%;
  height: 155px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--paper2);
}

/* ---------- Dual-Pane Philological Workbench ---------- */
.wb-split {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) { .wb-split { grid-template-columns: 1fr; } }

.wb-left { position: sticky; top: 74px; }
@media (max-width: 1100px) { .wb-left { position: static; } }

.preprocess-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  margin: 8px 0 10px;
}
.preprocess-bar input[type="range"] { width: 88px; vertical-align: middle; }

.canvas-stage {
  position: relative;
  width: 100%;
  height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #2b241d;
  display: grid;
  place-items: center;
}
#pageCanvas { cursor: grab; max-width: none; }

.col-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.col-pill {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper);
  font-size: 12.5px;
  font-weight: 600;
}
.col-pill.on { background: var(--seal); color: #fff; border-color: var(--seal); }
.col-pill.st-verified { border-color: var(--yy); }
.col-pill.st-needs_review { border-color: var(--jy); }

.ocr-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.dual-box {
  background: var(--gh-soft);
  border: 1px solid #bfdadb;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.raw-readout {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 19px;
  min-height: 36px;
}

.char-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.char-tile {
  min-width: 66px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  text-align: center;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.char-tile:hover { border-color: var(--ink2); transform: translateY(-2px); }
.char-tile.ext { background: var(--seal-soft); border-color: #df9f95; }
.char-tile.on { border: 2px solid var(--seal); }
.char-tile .glyph { font-size: 28px; line-height: 1.15; }
.char-tile .ids-mini { font-size: 11px; color: var(--m); font-weight: 600; }
.char-tile .meta { font-size: 10.5px; color: var(--muted); }

/* ---------- Mi-Grid Glyph Decomposer (from Research Report) ---------- */
.decomp {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .decomp { grid-template-columns: 1fr; } }

.stage {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--sh);
}
.stage .gbox {
  position: relative;
  aspect-ratio: 1;
  background:
    linear-gradient(var(--line), var(--line)) center/1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) center/100% 1px no-repeat,
    linear-gradient(45deg, transparent calc(50% - .5px), rgba(224, 214, 194, .65) 50%, transparent calc(50% + .5px)),
    linear-gradient(-45deg, transparent calc(50% - .5px), rgba(224, 214, 194, .65) 50%, transparent calc(50% + .5px));
  border: 2px solid #d9c9a8;
  border-radius: 10px;
}
.stage .gbox svg {
  position: absolute;
  inset: 6%;
  width: 88%;
  height: 88%;
  overflow: visible;
}
.stage .readout { text-align: center; margin-top: 10px; }
.stage .qn { font-size: 28px; font-weight: 700; font-family: var(--serif); }
.stage .ctrl { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

.formula { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.comp {
  flex: 1;
  min-width: 130px;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 2px solid var(--line);
  position: relative;
}
.comp .cc { font-family: var(--nom); font-size: 46px; line-height: 1.05; }
.comp .role {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border-radius: 6px;
  padding: 1px 7px;
}
.comp .why { font-size: 12.5px; color: var(--muted); line-height: 1.4; margin-top: 4px; }
.fop { align-self: center; font-size: 24px; color: var(--muted); font-family: var(--serif); }

.soundshift { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 14px; flex-wrap: wrap; }
.soundshift .from, .soundshift .to {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 8px;
  background: var(--paper2);
}
.soundshift .to { background: var(--seal-soft); color: var(--s); }

/* ---------- Gallery, Kieu Couplet & Workshop ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.gcell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 4px 4px;
  text-align: center;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.gcell:hover { transform: translateY(-2px); border-color: var(--ink2); }
.gcell.on { border: 2px solid var(--seal); padding: 5px 3px 3px; }
.gcell svg { width: 52px; height: 52px; display: block; margin: 0 auto; }
.gcell .q { font-size: 12.5px; color: var(--ink2); }
.gcell .z { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kieu-panel {
  background: #fbf8f1;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
}
.kline { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.kch {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border-radius: 10px;
  padding: 5px 4px;
  border: 1px solid transparent;
  width: 72px;
}
.kch:hover { background: var(--card); border-color: var(--line); }
.kch svg { width: 52px; height: 52px; }
.kch .q { font-size: 14px; font-weight: 600; color: var(--ink2); }
.kch .ty { font-size: 11px; color: var(--muted); }
.kbar { display: flex; height: 28px; border-radius: 7px; overflow: hidden; gap: 2px; margin: 10px 0 6px; }
.kbar div {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
}

.workshop {
  display: grid;
  grid-template-columns: 1fr 290px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) { .workshop { grid-template-columns: 1fr; } }
.pool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-family: var(--nom);
  font-size: 24px;
  line-height: 1;
  width: 48px;
  height: 54px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
}
.chip small { font-family: var(--sans); font-size: 10px; color: var(--muted); }
.chip.dim { opacity: .25; }
.chip.ok { box-shadow: 0 0 0 2px rgba(46, 138, 95, .55); }
.pool.m .chip.on { background: var(--m); color: #fff; border-color: var(--m); }
.pool.s .chip.on { background: var(--s); color: #fff; border-color: var(--s); }
.chip.on small { color: #fff; }
.anvil {
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.anvil svg { width: 150px; height: 150px; }
.anvil .slots { display: flex; align-items: center; gap: 8px; font-family: var(--nom); font-size: 32px; }
.anvil .slot { width: 52px; height: 52px; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; }
.anvil .slot.m { border-color: var(--m); color: var(--m); border-style: solid; }
.anvil .slot.s { border-color: var(--s); color: var(--s); border-style: solid; }

/* ---------- Block CER Alignment & Charts ---------- */
.align { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.align div {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  padding: 4px 7px;
  min-width: 44px;
  border: 1px solid var(--line);
  background: var(--card);
}
.align b { font-family: var(--nom); font-size: 24px; font-weight: 400; line-height: 1.2; }
.align small { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.align .eq { border-color: #bfe0cd; background: var(--yy-soft); }
.align .sub { border-color: var(--jy); background: var(--jy-soft); }
.align .del { border-color: var(--s); background: var(--seal-soft); }
.align .ins { border-color: var(--k); background: var(--k-soft); }

.cerv { font-family: var(--serif); font-size: 46px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--seal); }
.doubt-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--paper);
  margin-bottom: 12px;
}

/* ---------- Multi-Provider Grid (Admin Center) ---------- */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.prov-card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .12s, border-color .12s, background .12s;
  text-align: left;
}
.prov-card:hover { border-color: var(--ink2); transform: translateY(-1px); }
.prov-card.on { border-color: var(--seal); background: var(--card); box-shadow: 0 0 0 2px rgba(179, 38, 30, .14); }
.prov-card .ptitle { font-weight: 700; font-size: 13.5px; color: var(--ink); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.prov-card .ptier { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.prov-editor {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
}

