:root {
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-alt: #f8faf6;
  --ink: #122119;
  --muted: #4b5d52;
  --accent: #0f766e;
  --accent-strong: #064e3b;
  --gold: #d97706;
  --gold-soft: #fef3c7;
  --border: #d4dfd7;
  --deck-bg: #102119;
  --deck-card: #172e23;
  --deck-ink: #f4f7f5;
  --deck-muted: #b5c9bd;
  --focus: #2563eb;
  --radius: 14px;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  overflow-x: clip;
}

a {
  color: var(--accent-strong);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

.unofficial-ribbon {
  background: #0d1d16;
  color: #d9e7df;
  font-size: 0.8rem;
  padding: 0.36rem 0.75rem;
  text-align: center;
}

.unofficial-ribbon a {
  color: #fbbf24;
  font-weight: 700;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.header-inner {
  width: min(1320px, calc(100% - 1.5rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.02rem;
  text-decoration: none;
  white-space: nowrap;
}

.brand-link img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: block;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: #e2f1ea;
  color: var(--accent-strong);
}

.ad-slot {
  width: min(1320px, calc(100% - 1.5rem));
  max-width: 100%;
  overflow-x: clip;
  margin: 0.85rem auto 0;
  text-align: center;
}

.ad-slot[data-active="false"] {
  display: none;
}

.ad-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* Main Responsive Two-Column Tool Shell */
.workspace-shell {
  width: min(1320px, calc(100% - 1.5rem));
  margin: 1rem auto 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 1.1rem;
  align-items: start;
}

.main-deck {
  min-width: 0;
}

.tool-panel {
  background: var(--deck-bg);
  color: var(--deck-ink);
  border-radius: 16px;
  border: 1px solid #244535;
  padding: clamp(0.95rem, 2.2vw, 1.45rem);
  box-shadow: 0 14px 36px rgba(10, 29, 20, 0.14);
  margin-bottom: 1.1rem;
}

.tool-panel h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.3rem, 2.5vw, 1.85rem);
  line-height: 1.2;
  color: #ffffff;
}

.tool-subtitle {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--deck-muted);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #d6e7dd;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #35614b;
  background: #0b1711;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 600;
}

.kpi-strip {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}

.kpi-box {
  background: var(--deck-card);
  border: 1px solid #2a513e;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.kpi-label {
  display: block;
  font-size: 0.74rem;
  color: var(--deck-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 850;
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
}

.sub-deck {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid #264837;
}

.sub-deck h2 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  color: #ffffff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #35614b;
  background: var(--deck-card);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}

.btn:hover {
  background: #1f3c2e;
}

.btn--primary {
  background: #d97706;
  border-color: #f59e0b;
  color: #111827;
}

.btn--primary:hover {
  background: #f59e0b;
}

.btn--danger {
  border-color: #7f1d1d;
  background: #450a0a;
  color: #fecaca;
}

.compare-result {
  margin-top: 0.65rem;
  padding: 0.6rem 0.8rem;
  border-radius: 9px;
  background: #0d1c15;
  border: 1px solid #2b5440;
  font-size: 0.88rem;
  color: #e2efe7;
}

.roster-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.roster-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.72rem;
  border-radius: 8px;
  background: #13251c;
  border: 1px solid #274a39;
  font-size: 0.84rem;
}

.roster-row.is-weakest {
  border-color: #f59e0b;
}

/* Admin Abuse Countdown Widget */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.countdown-cell {
  background: var(--deck-card);
  border: 1px solid #2d5542;
  border-radius: 10px;
  padding: 0.6rem 0.4rem;
  text-align: center;
}

.countdown-num {
  display: block;
  font-size: 1.45rem;
  font-weight: 850;
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
}

.countdown-unit {
  font-size: 0.72rem;
  color: var(--deck-muted);
  text-transform: uppercase;
}

/* Timing Trainer Canvas */
.trainer-canvas-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #08130e;
  border: 1px solid #2c523f;
  margin: 0.75rem 0;
}

.trainer-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

/* Sidebar */
.side-rail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.rail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem;
}

.rail-title {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.quick-list {
  display: grid;
  gap: 0.6rem;
}

.quick-card {
  display: block;
  padding: 0.68rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  text-decoration: none;
}

.quick-card:hover,
.quick-card[aria-current="page"] {
  border-color: var(--accent);
  background: #e6f4ee;
}

.quick-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.quick-card-title {
  font-weight: 750;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  color: #ffffff;
  white-space: nowrap;
}

.quick-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Editorial & Article Sections */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(1.1rem, 2.5vw, 1.9rem);
  margin-bottom: 1.1rem;
}

.content-card h1,
.content-card h2,
.content-card h3 {
  line-height: 1.25;
  color: var(--ink);
  margin-top: 0;
}

.content-card h2 {
  font-size: 1.28rem;
  margin-top: 1.45rem;
  margin-bottom: 0.6rem;
}

.content-card h2:first-child {
  margin-top: 0;
}

.content-card h3 {
  font-size: 1.04rem;
  margin-top: 1.1rem;
  margin-bottom: 0.35rem;
}

.content-card p {
  margin: 0 0 0.85rem;
  color: #203329;
}

.content-card ul,
.content-card ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}

.content-card li {
  margin-bottom: 0.4rem;
}

.notice-box {
  padding: 0.88rem 1rem;
  border-radius: 10px;
  border-left: 4px solid var(--gold);
  background: var(--gold-soft);
  color: #422006;
  margin: 0.9rem 0;
  font-size: 0.92rem;
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0.8rem 0 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.66rem 0.8rem;
  border-top: 1px solid var(--border);
}

thead th {
  border-top: 0;
  background: #ebf3ed;
  font-weight: 750;
}

.faq-list {
  display: grid;
  gap: 0.6rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem 0.95rem;
  background: var(--surface-alt);
}

.faq-item summary {
  font-weight: 750;
  cursor: pointer;
}

.faq-item p {
  margin: 0.55rem 0 0;
  font-size: 0.92rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.65rem 0 2.25rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-inner {
  width: min(1320px, calc(100% - 1.5rem));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.footer-links a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 120;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.toast[hidden] {
  display: none;
}

@media (max-width: 980px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
  }

  .main-nav.is-open {
    display: flex;
  }
}

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