/* TheMetin2 website styles. Dark, warm, gold accents. Mobile first. */

@font-face {
  font-family: "Cinzel";
  src: url("../fonts/Cinzel-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #120f0c;
  --bg-2: #1a1511;
  --surface: #211a14;
  --surface-2: #2a2119;
  --line: #3b2f23;
  --line-strong: #5a4630;
  --text: #ece3d4;
  --muted: #b3a48e;
  --gold: #d8ad55;
  --gold-hi: #f1d38b;
  --gold-lo: #9c7330;
  --red: #c4513d;
  --green: #6fbf73;
  --focus: #f1d38b;
  --radius: 10px;
  --wrap: 1120px;
  --font-display: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-body);
  overflow-x: hidden;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; }

a { color: var(--gold-hi); text-underline-offset: 3px; }
a:hover { color: #fff1c9; }

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

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 .3em;
  word-break: break-all;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 780px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .78rem; margin: .6rem 0 0; }
.center { text-align: center; }
.gold { color: var(--gold-hi); }
.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: #1a1209; padding: 6px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(18, 15, 12, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 62px; gap: 12px; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark-mark { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 0 6px rgba(216, 173, 85, .35)); }
.wordmark-text {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: .04em;
  background: linear-gradient(180deg, #fbe7b0 0%, #d8ad55 55%, #9c7330 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wm-the { font-size: .72em; margin-right: .08em; }

.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px; background: transparent; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer;
}
.nav-toggle .bar { display: block; height: 2px; background: var(--gold-hi); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }

.site-nav {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  flex-direction: column; padding: 8px 16px 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.site-nav.open { display: flex; }
.no-js .site-nav { display: flex; position: static; }
.no-js .nav-toggle { display: none; }
.site-nav a, .site-nav .linklike {
  color: var(--text); text-decoration: none; padding: 10px 4px; border-bottom: 1px solid var(--line);
  font-size: 1rem; text-align: left;
}
.site-nav a[aria-current="page"] { color: var(--gold-hi); }
.site-nav a:hover, .site-nav .linklike:hover { color: var(--gold-hi); }
.site-nav .btn { margin-top: 12px; text-align: center; border-bottom: 0; padding: 10px 16px; }
.nav-sep { display: none; }
.nav-logout { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav, .site-nav.open {
    display: flex; position: static; flex-direction: row; align-items: center; gap: 4px;
    padding: 0; background: transparent; border: 0;
  }
  .site-nav a, .site-nav .linklike { border: 0; padding: 8px 10px; font-size: .95rem; width: auto; border-radius: 6px; }
  .site-nav a[aria-current="page"] { background: var(--surface); }
  .site-nav .btn { margin: 0 0 0 6px; padding: 8px 14px; }
  .nav-sep { display: block; width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
}

.notice-bar {
  background: linear-gradient(90deg, #3a2310, #4a2c12, #3a2310);
  border-bottom: 1px solid var(--line-strong);
  color: #f3dfb4; font-size: .88rem; padding: 7px 0; text-align: center;
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 8px; border: 1px solid transparent;
  font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 20px; height: 20px; flex: none; }
.btn-gold {
  color: #1d1308;
  background: linear-gradient(180deg, #f3d48b 0%, #d6a74c 55%, #b5852f 100%);
  border-color: #e8c272;
  box-shadow: 0 2px 0 #6b4a17, 0 6px 18px rgba(216, 173, 85, .18);
}
.btn-gold:hover { color: #1d1308; box-shadow: 0 2px 0 #6b4a17, 0 8px 26px rgba(216, 173, 85, .32); }
.btn-ghost { color: var(--gold-hi); background: rgba(216, 173, 85, .06); border-color: var(--line-strong); }
.btn-ghost:hover { color: #fff1c9; background: rgba(216, 173, 85, .14); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn-large { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------ flashes */

.flashes { margin-top: 16px; }
.flash { margin: 0 0 10px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); }
.flash-error { border-color: #7a3328; background: #2b1612; color: #ffd7cf; }
.flash-success { border-color: #3d6a3f; background: #15231a; color: #d4f3d5; }
.flash-info { border-color: var(--line-strong); }

/* ------------------------------------------------------------ hero */

.hero {
  position: relative;
  background: #120f0c url("../img/hero.svg") center bottom / cover no-repeat;
  border-bottom: 1px solid var(--line);
  padding: 40px 0 36px;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(18, 15, 12, .85) 0%, rgba(18, 15, 12, .45) 60%, rgba(18, 15, 12, .2) 100%);
}
.hero-grid { position: relative; z-index: 1; display: grid; gap: 28px; }
.eyebrow {
  margin: 0 0 10px; color: var(--gold); font-size: .8rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.hero-title {
  font-family: var(--font-display); font-size: clamp(1.9rem, 7vw, 3.4rem); letter-spacing: .01em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .6);
}
.hero-title .gold {
  background: linear-gradient(180deg, #fbe7b0 0%, #d8ad55 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: 1.08rem; max-width: 36em; color: #e2d6c2; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-actions .btn { flex: 1 1 200px; }

@media (min-width: 900px) {
  .hero { padding: 84px 0 76px; }
  .hero-grid { grid-template-columns: 1.5fr 1fr; align-items: center; gap: 48px; }
  .hero-actions .btn { flex: 0 0 auto; }
}

/* ------------------------------------------------------------ cards */

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.card-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold-hi); letter-spacing: .02em; }

.status-card { background: rgba(26, 21, 17, .9); }
.status-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.status-head .card-title { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-on { color: var(--green); background: rgba(111, 191, 115, .12); border: 1px solid rgba(111, 191, 115, .35); }
.pill-on .dot { box-shadow: 0 0 0 0 rgba(111, 191, 115, .6); animation: pulse 2.4s ease-out 3; }
.pill-off { color: #e9826f; background: rgba(196, 81, 61, .12); border: 1px solid rgba(196, 81, 61, .4); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111, 191, 115, .6); } 100% { box-shadow: 0 0 0 9px rgba(111, 191, 115, 0); } }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.status-list li:last-child { border-bottom: 0; }
.status-list .ok { color: var(--green); }
.status-list .bad { color: #e9826f; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ sections */

.section { padding: 40px 0; }
.section-alt { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-family: var(--font-display); font-size: clamp(1.35rem, 4.5vw, 1.9rem); color: var(--gold-hi); }
.small-title { font-size: 1.25rem; margin-top: 8px; }
.section-lead { color: var(--muted); max-width: 46em; margin-top: -4px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.more { text-decoration: none; }

.page-head { padding: 32px 0 8px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.page-title { font-family: var(--font-display); font-size: clamp(1.6rem, 6vw, 2.3rem); color: var(--gold-hi); }

@media (min-width: 900px) {
  .section { padding: 64px 0; }
  .page-head { padding: 48px 0 16px; }
}

/* features */
.features { display: grid; gap: 16px; margin-top: 22px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature {
  padding: 20px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(216, 173, 85, .05), transparent 60%), var(--bg-2);
}
.feature h3 { font-size: 1.08rem; color: var(--text); }
.feature p { margin: 0; color: var(--muted); }
.feature-icon { width: 34px; height: 34px; color: var(--gold); margin-bottom: 10px; }

.callout {
  margin-top: 24px; padding: 20px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); border-left: 4px solid var(--gold);
  background: rgba(216, 173, 85, .06);
}
.callout h3 { color: var(--gold-hi); font-size: 1.1rem; }
.callout p { margin: 0; }

.cta { display: flex; flex-direction: column; gap: 16px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-actions .btn { flex: 1 1 140px; }
@media (min-width: 760px) {
  .cta { flex-direction: row; align-items: center; justify-content: space-between; }
  .cta-actions .btn { flex: 0 0 auto; }
}

/* news */
.news-grid { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 760px) { .news-grid { grid-template-columns: repeat(3, 1fr); } }
.news-list { display: grid; gap: 18px; }
.news-item { padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow-wrap: anywhere; }
.news-item p { margin: 0 0 .6em; color: #d9cdb9; }
.news-img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: cover; border-radius: 6px; margin-bottom: 12px; }
.news-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.tag { padding: 1px 9px; border-radius: 999px; background: rgba(216, 173, 85, .14); color: var(--gold-hi); font-weight: 600; }
.news-title { font-size: 1.12rem; }

/* ------------------------------------------------------------ ranking */

.tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 16px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tab.active, .tab:hover { color: var(--gold-hi); border-bottom-color: var(--gold); }
.js .tab-panel { display: none; }
.js .tab-panel.active { display: block; }
.tab-panel + .tab-panel { margin-top: 32px; }
.js .tab-panel + .tab-panel { margin-top: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); flex: 1 1 140px; }
.filters .btn { flex: 0 0 auto; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.rank-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.rank-table th, .rank-table td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.rank-table thead th { background: var(--surface-2); color: var(--gold-hi); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; }
.rank-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
.rank-table tbody tr:hover { background: rgba(216, 173, 85, .06); }
.rank-table tbody tr:last-child td { border-bottom: 0; }
.rank-table .name { font-weight: 600; overflow-wrap: anywhere; }
.rank-table .sub { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.rank-table tr.top1 td:first-child { color: #f6d77d; font-weight: 700; }
.rank-table tr.top2 td:first-child { color: #d9dde3; font-weight: 700; }
.rank-table tr.top3 td:first-child { color: #d49a63; font-weight: 700; }
.empire { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.empire-shinsoo { background: rgba(196, 81, 61, .18); color: #f0a291; }
.empire-chunjo { background: rgba(214, 180, 76, .18); color: #f1d38b; }
.empire-jinno { background: rgba(84, 132, 205, .2); color: #a9c6f2; }
.empire-none { color: var(--muted); }
.hide-sm { display: none; }
@media (min-width: 700px) {
  .hide-sm { display: table-cell; }
  .show-sm { display: none !important; }
}

/* ------------------------------------------------------------ forms */

.form-wrap { max-width: 520px; }
.form-card { padding: 24px 18px; }
@media (min-width: 520px) { .form-card { padding: 32px; } }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: #15110d; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font: 1rem/1.3 var(--font-body);
}
input:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(216, 173, 85, .2); }
input[aria-invalid="true"] { border-color: #b4503f; }
.hint { margin: 6px 0 0; font-size: .84rem; color: var(--muted); }
.field-error { margin: 6px 0 0; font-size: .88rem; color: #ffb3a5; }
.field.check { display: flex; gap: 10px; align-items: flex-start; }
.field.check input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--gold); flex: none; }
.field.check label { font-weight: 400; margin: 0; }
.cf-turnstile { margin: 0 0 16px; min-height: 65px; }
.stack { display: grid; gap: 10px; margin-top: 18px; }

.two-col { display: grid; gap: 24px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.forms-row { margin-top: 32px; }
@media (min-width: 900px) { .forms-row { grid-template-columns: 1fr 1fr; } }

/* account */
.char-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.char-name { font-family: var(--font-display); color: var(--gold-hi); font-size: 1.15rem; }
.char-stats, .reqs { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.char-stats dt, .reqs dt { color: var(--muted); }
.char-stats dd, .reqs dd { margin: 0; }

/* download */
.download-card { margin-bottom: 28px; }
.download-card .btn { margin: 8px 0 12px; }
.steps { padding-left: 1.4em; margin: 0 0 16px; }
.steps li { margin-bottom: 12px; padding-left: 4px; }
.steps li::marker { color: var(--gold); font-weight: 700; }

/* prose */
.prose h2 { font-family: var(--font-display); color: var(--gold-hi); font-size: 1.25rem; margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .5em; }
.prose li::marker { color: var(--gold); }

/* errors */
.error-page { padding: 72px 0; }
.error-code { font-family: var(--font-display); font-size: 4.5rem; line-height: 1; margin: 0 0 10px; color: var(--gold); opacity: .8; }

/* ------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--line); background: #0e0b09; padding: 28px 0; margin-top: 24px; }
.footer-row { display: grid; gap: 18px; }
.footer-brand { font-family: var(--font-display); color: var(--gold); margin: 0 0 4px; font-size: 1.1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--gold-hi); }
@media (min-width: 760px) { .footer-row { grid-template-columns: 2fr 1fr; align-items: center; } .footer-links { justify-content: flex-end; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
