:root {
  color-scheme: dark;
  font-family: "Leelawadee UI", "Noto Sans Thai", "Segoe UI", system-ui, sans-serif;
  color: #e7edf2;
  background: #0b1724;
  font-synthesis: none;
  --bg: #0b1724;
  --surface: #111f2e;
  --surface-2: #152638;
  --surface-3: #0d1a28;
  --border: #26394b;
  --border-light: #31485b;
  --text: #e7edf2;
  --muted: #94a7b7;
  --teal: #62d5d0;
  --teal-dark: #183f45;
  --yellow: #e9c96b;
  --red: #ed8390;
  --discord: #6978e7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { overflow-x: hidden; scroll-behavior: smooth; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--teal); }

.site-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px max(20px, calc((100% - 1100px) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(11, 23, 36, 0.96);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 7px; color: var(--text); text-decoration: none; }
.brand strong { font-size: 1.08rem; letter-spacing: -0.02em; }
.brand > span:last-child { color: var(--teal); font-size: 0.72rem; font-weight: 800; }
.brand-dot {
  position: relative;
  width: 25px;
  height: 25px;
  margin-right: 3px;
  border: 2px solid var(--teal);
  border-radius: 50%;
}
.brand-dot::before { position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; content: ""; border-radius: 50%; background: var(--yellow); }
.brand-dot::after { position: absolute; bottom: 5px; left: 5px; width: 7px; height: 4px; content: ""; border-radius: 50%; background: var(--teal); transform: rotate(-25deg); }

.main-nav { display: flex; align-items: center; gap: 6px; }
.nav-button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}
.nav-button:hover { color: var(--text); background: var(--surface); }
.nav-button.active { color: var(--text); background: var(--surface-2); }
.nav-button-primary { border-color: var(--border-light); color: var(--teal); }

.hero {
  position: relative;
  width: min(1100px, calc(100% - 32px));
  min-height: 360px;
  margin: 28px auto 0;
  padding: clamp(38px, 7vw, 72px);
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: #102638;
}
.hero::before {
  position: absolute;
  top: -170px;
  right: -100px;
  width: 440px;
  height: 440px;
  content: "";
  border: 1px solid rgba(98, 213, 208, 0.16);
  border-radius: 50%;
}
.hero::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 46%;
  height: 46%;
  content: "";
  opacity: 0.42;
  background:
    linear-gradient(145deg, transparent 49%, rgba(98, 213, 208, 0.12) 50% 51%, transparent 52%) 0 0 / 36px 36px;
  mask-image: linear-gradient(135deg, transparent, black);
}
.hero-copy { position: relative; z-index: 1; max-width: 690px; }
.hero-label { margin: 0 0 16px; color: var(--teal); font-weight: 750; }
.hero h1 { margin: 0; color: var(--text); font-size: clamp(2.35rem, 6vw, 4.15rem); line-height: 1.09; letter-spacing: -0.045em; }
.hero-description { max-width: 620px; margin: 22px 0 0; color: #adc0ce; font-size: 1.02rem; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 27px; }

.discovery-section,
.detail-screen,
.submit-layout,
.page-header,
.container {
  width: min(1100px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}
.discovery-section { padding: 54px 0 80px; scroll-margin-top: 78px; }
.section-heading,
.detail-header,
.card-top,
.badges,
.button-row,
.admin-toolbar,
.dialog-heading,
.form-card-heading,
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.section-heading { align-items: end; margin-bottom: 18px; }
.section-heading h2 { margin: 0; color: var(--text); font-size: 1.65rem; }
.section-heading p { margin: 5px 0 0; color: var(--muted); line-height: 1.55; }
.status-text { color: var(--teal) !important; font-weight: 700; white-space: nowrap; }

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(190px, 0.55fr);
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
label { display: grid; gap: 7px; color: #c1cfda; font-size: 0.88rem; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-3);
}
input::placeholder, textarea::placeholder { color: #667c8e; }
textarea { min-height: 150px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid rgba(98, 213, 208, 0.7);
  outline-offset: 2px;
}

.server-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.server-card,
.detail-panel,
.form-card,
.guide-card,
.admin-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.server-card { display: grid; gap: 15px; min-height: 265px; padding: 20px; }
.server-card:hover { border-color: var(--border-light); background: #132333; }
.server-identity h2 { margin: 0; color: var(--text); font-size: 1.22rem; }
.excerpt {
  display: -webkit-box;
  min-height: 4.9em;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.62;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.badge, .date-label, .status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 750;
}
.badge { color: #a3ece9; background: var(--teal-dark); }
.date-label { color: var(--yellow); background: #393621; }
.status-badge { color: #bdcad3; background: #263747; }
.status-badge.published { color: #96ddba; background: #1c3b30; }
.status-badge.pending { color: var(--yellow); background: #393621; }
.status-badge.hidden, .status-badge.rejected { color: #f0a0aa; background: #412933; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { color: #082326; background: var(--teal); }
.button.primary:hover { background: #7cddd9; }
.button.secondary { border-color: var(--border-light); color: var(--text); background: transparent; }
.button.secondary:hover { background: var(--surface-2); }
.button.discord { color: white; background: var(--discord); }
.button.danger { color: #2b0c12; background: var(--red); }
.button.danger-outline { border-color: #6e3a43; color: #f1a0ab; background: transparent; }
.button.small { min-height: 34px; padding: 6px 9px; font-size: 0.82rem; }
.button.block { width: 100%; margin-top: auto; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.text-button { padding: 0; border: 0; background: transparent; font-weight: 700; cursor: pointer; }
.danger-text { color: var(--red); }
.empty-state { grid-column: 1 / -1; margin: 0; padding: 45px 20px; border: 1px dashed var(--border-light); border-radius: 10px; color: var(--muted); text-align: center; }

.detail-screen { padding: 40px 0 80px; }
.back-link { margin: 0 0 16px; padding: 4px 0; border: 0; color: var(--teal); background: transparent; font-weight: 700; cursor: pointer; }
.detail-panel { padding: clamp(22px, 4vw, 38px); }
.detail-header { align-items: flex-start; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.detail-header h1 { margin: 14px 0 0; color: var(--text); font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.15; letter-spacing: -0.035em; }
.announcement-section { max-width: 860px; padding: 30px 0; }
.announcement-section h2 { margin: 0 0 14px; font-size: 1.25rem; }
.announcement { margin: 0; padding: 20px; overflow-wrap: anywhere; border-left: 3px solid var(--teal); color: #c1cdd7; background: var(--surface-3); font: inherit; line-height: 1.75; white-space: pre-wrap; }
.detail-footer { padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }

.page-header { padding: 54px 0 24px; }
.page-header h1 { margin: 0; color: var(--text); font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.035em; }
.page-header p { margin: 8px 0 0; color: var(--muted); }
.submit-layout { display: grid; grid-template-columns: minmax(230px, 0.36fr) minmax(0, 1fr); align-items: start; gap: 18px; padding-bottom: 80px; }
.guide-card { padding: 22px; }
.guide-card h2 { margin: 0 0 15px; font-size: 1.15rem; }
.guide-card ul { display: grid; gap: 10px; margin: 0; padding-left: 20px; color: #bac8d2; line-height: 1.55; }
.guide-card li::marker { color: var(--teal); }
.guide-card p { margin: 20px 0 0; padding-top: 17px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.form-card { display: grid; gap: 18px; padding: clamp(20px, 3vw, 28px); }
.form-card-heading { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.form-card-heading h2 { margin: 0; font-size: 1.3rem; }
.form-card-heading span { color: var(--muted); font-size: 0.82rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-message { min-height: 1.4em; margin: 0; color: var(--muted); }
.form-message.success { color: #8cdbb4; }
.form-message.error { color: #efa0aa; }
#submission-turnstile,
#report-turnstile { width: 100%; min-width: 0; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border-light); border-radius: 12px; color: var(--text); background: var(--surface); box-shadow: 0 22px 70px rgba(0,0,0,0.45); }
dialog::backdrop { background: rgba(3, 10, 17, 0.78); }
.dialog-form { display: grid; gap: 16px; padding: 22px; }
.dialog-heading { padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.dialog-heading h2 { margin: 0; font-size: 1.3rem; }
.icon-button { width: 35px; height: 35px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); background: var(--surface-3); font-size: 1.2rem; cursor: pointer; }

.site-footer { display: flex; justify-content: space-between; gap: 24px; width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 34px; border-top: 1px solid var(--border); color: #778c9d; font-size: 0.82rem; }
.site-footer p { margin: 0; }
.site-footer strong { color: #afc0cc; }

.container { padding-top: 36px; padding-bottom: 70px; }
.admin-shell { display: grid; gap: 18px; }
.admin-card { padding: clamp(20px, 3vw, 28px); }
.admin-card h1, .admin-card h2 { margin: 0; color: var(--text); }
.admin-card > p, .admin-toolbar p { color: var(--muted); line-height: 1.6; }
#admin-login { grid-template-columns: minmax(280px, 1fr) auto; align-items: end; max-width: 850px; }
#admin-login .button-row { justify-content: flex-start; flex-wrap: nowrap; }
#admin-content { display: grid; gap: 18px; }
.admin-toolbar { align-items: end; margin-bottom: 14px; }
.admin-toolbar label { min-width: 180px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.89rem; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: #adc0cd; background: var(--surface-3); font-size: 0.78rem; }
tr:last-child td { border-bottom: 0; }
.table-announcement { min-width: 250px; max-width: 410px; color: var(--muted); white-space: pre-wrap; }

@media (max-width: 760px) {
  .server-grid { grid-template-columns: 1fr; }
  .submit-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-header { min-height: 58px; padding: 8px 14px; }
  .nav-button { min-height: 35px; padding: 6px 9px; font-size: 0.85rem; }
  .hero { width: calc(100% - 24px); margin-top: 14px; padding: 30px 22px 34px; border-radius: 10px; }
  .hero h1 { font-size: clamp(2.2rem, 12vw, 3.1rem); }
  .hero-description { font-size: 0.95rem; }
  .hero-actions { display: grid; }
  .hero-actions .button { width: 100%; }
  .discovery-section, .detail-screen, .submit-layout, .page-header, .container { width: calc(100% - 24px); }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .filters, .form-grid { grid-template-columns: 1fr; }
  .form-card, .guide-card { min-width: 0; }
  input, select, textarea { font-size: 16px; }
  .detail-header { align-items: stretch; flex-direction: column; }
  .detail-header .button { width: 100%; }
  .detail-footer { align-items: flex-start; flex-direction: column; }
  .site-footer { flex-direction: column; width: calc(100% - 24px); }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-toolbar label { width: 100%; }
  #admin-login { grid-template-columns: 1fr; }
  #admin-login .button-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
