:root {
  --paper: #f3e9d2;
  --paper-2: #eadcbc;
  --paper-3: #fbf6e8;
  --ink: #1d1a17;
  --ink-soft: #453d33;
  --line: #c9b78d;
  --vermilion: #a3261b;
  --vermilion-dark: #7d1b13;
  --jade: #2a5a4d;
  --jade-soft: #dbe8e1;
  --gold: #7a5b12;
  --danger-bg: #f7dcd7;
  --ok-bg: #dcebd9;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 18px rgba(60, 40, 10, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", "Cambria", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.7rem);
  margin: 0 0 0.6em;
}

h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.85rem);
  margin: 1.6em 0 0.5em;
}

h3 {
  font-size: 1.2rem;
  margin: 1.2em 0 0.4em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--vermilion-dark);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--vermilion);
}

:focus-visible {
  outline: 3px solid var(--jade);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6em 1em;
  z-index: 50;
}

.skip:focus {
  left: 0;
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

main.wrap {
  flex: 1;
  padding-block: 2rem 3.5rem;
}

.site-header {
  background: var(--ink);
  color: var(--paper);
  position: relative;
}

.bar {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 0.7rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--paper);
  text-decoration: none;
  flex: none;
}

.brand:hover {
  color: #fff;
}

.seal {
  width: 44px;
  height: 44px;
  display: inline-flex;
  flex: none;
}

.seal svg {
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

.brand-text small {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d9c9a0;
}

.menu-button {
  display: none;
  margin-left: auto;
  background: transparent;
  color: var(--paper);
  border: 1px solid #8f8164;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 0.15rem;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--paper);
  text-decoration: none;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  display: inline-block;
}

.site-nav a:hover {
  background: rgba(243, 233, 210, 0.14);
  color: #fff;
}

.site-nav a[aria-current="page"] {
  background: rgba(243, 233, 210, 0.2);
  box-shadow: 0 -2px 0 #d8a24a inset;
}

.account-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 1rem;
  border-left: 1px solid #5a5043;
}

.inline {
  display: inline;
  margin: 0;
}

.linklike {
  background: none;
  border: 0;
  padding: 0.5rem 0.7rem;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.ribbon svg {
  display: block;
  width: 100%;
  height: 34px;
}

.hero {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  color: var(--ink);
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-inner {
  position: relative;
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
  padding-block: 3.2rem 9rem;
  max-width: 1120px;
}

.hero h1 {
  font-size: clamp(2.2rem, 1.2rem + 4vw, 3.9rem);
  margin: 0 0 0.3em;
  max-width: 14ch;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hero .lead {
  font-size: 1.2rem;
  max-width: 34rem;
  color: var(--ink);
  background: rgba(243, 233, 210, 0.7);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  display: inline-block;
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn {
  display: inline-block;
  background: var(--vermilion);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1.3rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--vermilion-dark);
  transition: transform 0.08s ease, background 0.15s;
}

.btn:hover {
  background: var(--vermilion-dark);
  color: #fff;
}

.btn:active {
  transform: translateY(1px);
}

.btn-small {
  padding: 0.35rem 0.9rem;
  font-size: 0.95rem;
}

.btn-ghost {
  background: var(--paper-3);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--line);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: #fff;
  color: var(--ink);
}

.btn-danger {
  background: #8a1c14;
}

.panel {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(122, 91, 18, 0.22);
  border-radius: 6px;
  pointer-events: none;
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel h2:first-child,
.panel h3:first-child {
  margin-top: 0;
}

.narrow {
  max-width: 520px;
  margin-inline: auto;
}

.center {
  text-align: center;
}

.error-code {
  font-family: var(--serif);
  font-size: 5rem;
  line-height: 1;
  margin: 0;
  color: var(--vermilion);
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.stat {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.stat dt {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat dd {
  margin: 0.15rem 0 0;
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1.1;
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  vertical-align: middle;
}

.badge-on {
  background: var(--jade-soft);
  color: #17382f;
  border: 1px solid #98b8aa;
}

.badge-off {
  background: var(--danger-bg);
  color: #6a140d;
  border: 1px solid #d9a39b;
}

.badge-staff {
  background: #f1e2b4;
  color: #4e3a08;
  border: 1px solid #cdb26a;
}

.flash {
  padding: 0.8rem 0;
  font-weight: 600;
}

.flash-ok {
  background: var(--ok-bg);
  color: #173d1a;
  border-bottom: 1px solid #9bc19b;
}

.flash-error {
  background: var(--danger-bg);
  color: #6a140d;
  border-bottom: 1px solid #d9a39b;
}

form .field {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fffdf6;
  border: 1.5px solid #8f7f58;
  border-radius: 7px;
  padding: 0.6rem 0.75rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--jade);
  outline: 3px solid rgba(42, 90, 77, 0.3);
}

textarea {
  resize: vertical;
  min-height: 8rem;
}

.field.has-error input,
.field.has-error textarea {
  border-color: var(--vermilion);
}

.hint {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.error {
  margin: 0.3rem 0 0;
  color: #8a1c14;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-error {
  background: var(--danger-bg);
  border: 1px solid #d9a39b;
  color: #6a140d;
  padding: 0.7rem 0.9rem;
  border-radius: 7px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.captcha {
  font-family: var(--serif);
  font-size: 1.3rem;
  background: var(--paper-2);
  padding: 0.1rem 0.6rem;
  border-radius: 6px;
  border: 1px dashed var(--gold);
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.checks {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checks label {
  margin: 0;
  font-weight: 500;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

caption {
  text-align: left;
  font-family: var(--serif);
  font-size: 1.15rem;
  padding-bottom: 0.5rem;
  color: var(--ink-soft);
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #dccfa9;
  vertical-align: top;
}

thead th {
  background: var(--paper-2);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: rgba(234, 220, 188, 0.35);
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-1 td:first-child,
.rank-2 td:first-child,
.rank-3 td:first-child {
  font-weight: 800;
  color: var(--vermilion-dark);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}

.tabs a {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-3);
  color: var(--ink);
  text-decoration: none;
}

.tabs a:hover {
  background: #fff;
}

.tabs a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-item {
  padding: 1rem 0;
  border-bottom: 1px dashed var(--line);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item h3 {
  margin: 0 0 0.2rem;
}

.meta {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.pin {
  color: var(--vermilion-dark);
  font-weight: 700;
}

.prose {
  max-width: 46rem;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.2rem 0 1rem 3rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  background: var(--vermilion);
  color: #fff;
  border-radius: 50%;
  font-family: var(--serif);
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--jade);
}

.card h3 {
  margin-top: 0;
}

.series-kim { border-top-color: #8a7d5a; }
.series-moc { border-top-color: #3e7a3a; }
.series-thuy { border-top-color: #2b5f8e; }
.series-hoa { border-top-color: #b4401f; }
.series-tho { border-top-color: #7a5b12; }

.chip {
  display: inline-block;
  font-size: 0.82rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  margin-right: 0.3rem;
}

.divider {
  display: block;
  width: min(360px, 80%);
  margin: 1.2rem auto;
}

.hash {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-soft);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(251, 246, 232, 0.6);
}

.empty strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--line);
}

.timeline time {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--vermilion-dark);
  font-variant-numeric: tabular-nums;
}

.today {
  background: var(--jade-soft);
}

.message {
  border-left: 4px solid var(--line);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  background: rgba(251, 246, 232, 0.7);
}

.message.staff {
  border-left-color: var(--vermilion);
  background: #f8ecd0;
}

.message header {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}

.site-footer {
  background: var(--ink);
  color: #e6dcc3;
  margin-top: auto;
}

.site-footer a {
  color: #f0e2bd;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  padding-block: 2rem 1.2rem;
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.3rem;
}

.footer-brand .seal {
  width: 34px;
  height: 34px;
}

.legal {
  border-top: 1px solid #4a4236;
  font-size: 0.9rem;
  color: #cfc4a8;
  padding-block: 1rem;
}

.legal p {
  margin: 0;
}

.progress {
  width: 100%;
  height: 0.8rem;
  accent-color: var(--vermilion);
}

@media (max-width: 860px) {
  .grid-2,
  .grid-3,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .js .menu-button {
    display: inline-block;
  }

  .js .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 30;
    background: var(--ink);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0 1rem;
    border-top: 1px solid #4a4236;
    box-shadow: 0 14px 20px rgba(0, 0, 0, 0.35);
  }

  .js .site-header.nav-open .site-nav {
    display: flex;
  }

  .site-nav {
    margin-left: 0;
    width: 100%;
  }

  .site-nav ul {
    flex-direction: column;
  }

  .site-nav a {
    display: block;
    padding: 0.8rem 1rem;
  }

  .account-links {
    border-left: 0;
    border-top: 1px solid #4a4236;
    padding: 0.6rem 0.4rem 0;
    flex-wrap: wrap;
  }

  .bar {
    flex-wrap: wrap;
  }

  .hero {
    min-height: 480px;
  }

  .hero-inner {
    padding-block: 2rem 11rem;
  }

  .hero-art {
    object-position: 70% 100%;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1rem;
  }

  .panel {
    padding: 1.1rem 1rem;
  }

  .brand-text small {
    display: none;
  }

  th,
  td {
    padding: 0.45rem 0.5rem;
  }

  .timeline li {
    grid-template-columns: 4.4rem 1fr;
  }

  .footer-grid ul {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip {
    display: none;
  }
}

.visually {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: var(--paper-2);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}

form + .meta,
form + p.meta {
  margin-top: 1rem;
}

@media (max-width: 640px) {
  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack th,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 0.7rem;
    padding: 0.3rem 0.5rem;
    background: rgba(255, 253, 246, 0.7);
  }

  table.stack tbody tr:nth-child(even) {
    background: rgba(255, 253, 246, 0.7);
  }

  table.stack th,
  table.stack td {
    border-bottom: 0;
    padding: 0.2rem 0;
    text-align: left;
  }

  table.stack th[scope="row"] {
    font-family: var(--serif);
    font-size: 1.1rem;
  }

  table.stack td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 7rem;
    font-weight: 600;
    color: var(--ink-soft);
  }

  table.stack td.num {
    text-align: left;
  }
}

.stat dd.host {
  font-size: 1.1rem;
  line-height: 1.3;
  word-break: break-all;
}

@media (max-width: 640px) {
  table.stack td.hash {
    font-size: 0.78rem;
  }

  table.stack td.hash[data-label]::before {
    display: block;
    font-family: var(--sans);
    font-size: 1rem;
  }
}
