:root {
  --bg: #101716;
  --surface: #182220;
  --surface-2: #202c2a;
  --line: #34423f;
  --text: #f4f7f3;
  --muted: #a5b4b0;
  --mint: #78ddb8;
  --gold: #f3ce63;
  --coral: #ff806d;
  --blue: #70b7f5;
  --danger: #ff7777;
  --content: 1120px;
}

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

html { color-scheme: dark; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
}

a { color: inherit; }
button, input { font: inherit; letter-spacing: 0; }

.hero {
  position: relative;
  display: flex;
  min-height: 320px;
  max-height: 420px;
  align-items: flex-end;
  overflow: hidden;
  background: url("palworld-hero.jpg") center 42% / cover no-repeat;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 15, .56);
}

.hero-inner {
  position: relative;
  width: min(var(--content), calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 44px;
  line-height: 1.12;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .72);
}

.hero-copy {
  max-width: 650px;
  margin: 12px 0 0;
  color: #e5ece9;
  font-size: 16px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .72);
}

.nav-band {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 23, 22, .96);
}

.nav {
  display: flex;
  width: min(var(--content), calc(100% - 40px));
  min-height: 58px;
  margin: 0 auto;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
}

.nav a {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav a[aria-current="page"] { color: var(--mint); border-bottom-color: var(--mint); }
.nav svg { width: 17px; height: 17px; flex: none; }

.status-band { border-bottom: 1px solid var(--line); background: #141d1c; }
.status-row {
  display: flex;
  width: min(var(--content), calc(100% - 40px));
  min-height: 46px;
  margin: 0 auto;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
}

.status-item { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--mint); box-shadow: 0 0 9px rgba(120, 221, 184, .72); }
.status-dot.offline { background: var(--danger); }

.wrap { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; }
main { padding: 34px 0 70px; }

.section {
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.section:first-child { padding-top: 0; border-top: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section h2 { margin: 0; font-size: 23px; line-height: 1.3; }
.section-lead { margin: 5px 0 0; color: var(--muted); font-size: 14px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.status-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.capture-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { margin-top: 3px; font-size: 25px; font-weight: 850; line-height: 1.2; overflow-wrap: anywhere; }
.metric-value.mint { color: var(--mint); }
.metric-value.gold { color: var(--gold); }
.metric-value.blue { color: var(--blue); }
.metric-value.coral { color: var(--coral); }

.steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.step {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  counter-increment: steps;
}
.step:first-child { border-top: 0; }
.step::before {
  content: counter(steps);
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--mint);
  border-radius: 50%;
  color: var(--mint);
  font-weight: 850;
}
.step h3 { margin: 0 0 5px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); }

.join-guide-media { margin: 0 0 22px; }
.join-guide-media a { display: block; }
.join-guide-media img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.join-guide-media figcaption { margin-top: 8px; color: var(--muted); font-size: 12px; }

code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0c1211;
  color: var(--gold);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.notice {
  display: flex;
  gap: 12px;
  padding: 15px 16px;
  border-left: 3px solid var(--gold);
  background: rgba(243, 206, 99, .08);
  color: #e9e1bf;
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice.warning { border-left-color: var(--coral); background: rgba(255, 128, 109, .08); color: #f2cbc4; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.segmented { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #0d1413; }
.segmented button {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }

.search {
  width: min(360px, 100%);
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #0d1413;
  color: var(--text);
}
.search:focus { border-color: var(--mint); }

.table-wrap { border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--surface); font-size: 14px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #121b19; color: var(--muted); font-size: 12px; white-space: nowrap; }
td { overflow-wrap: anywhere; }
th:nth-child(1) { width: 24%; }
th:nth-child(2) { width: 29%; }
th:nth-child(3) { width: 12%; }
th:nth-child(4) { width: 15%; }
th:nth-child(5) { width: 20%; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-name { font-weight: 800; }

.ranking-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ranking-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 58px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.ranking-row:first-child { border-top: 0; }
.rank { color: var(--muted); font-weight: 850; font-variant-numeric: tabular-nums; }
.ranking-row:nth-child(1) .rank { color: var(--gold); }
.ranking-row:nth-child(2) .rank { color: #c9d4d1; }
.ranking-row:nth-child(3) .rank { color: var(--coral); }
.ranking-value { color: var(--mint); font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }

.participant-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.participant-row { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.participant-row svg { width: 18px; height: 18px; color: var(--mint); }
.participant-name { display: inline-flex; min-width: 0; align-items: center; gap: 10px; font-weight: 800; overflow-wrap: anywhere; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.editable { border-color: rgba(120, 221, 184, .55); color: var(--mint); }
.badge.online { border-color: rgba(120, 221, 184, .55); color: var(--mint); }

.empty { padding: 34px 20px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); text-align: center; }
.empty.compact { padding: 20px; }
.error { padding: 18px; border: 1px solid rgba(255, 119, 119, .5); border-radius: 6px; color: #ffc5c5; background: rgba(255, 119, 119, .07); }
.muted { color: var(--muted); }

.capture-player-list { display: grid; gap: 24px; }
.capture-player { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.capture-player-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #121b19; }
.capture-player-heading h3 { margin: 0; font-size: 18px; }
.pal-capture-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; }
.pal-capture-card { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 96px; padding: 10px 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pal-capture-card:nth-child(3n) { border-right: 0; }
.pal-capture-visual { position: relative; display: grid; width: 72px; height: 72px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #111918; color: var(--muted); }
.pal-capture-visual svg { width: 25px; height: 25px; }
.pal-capture-visual.has-image svg { display: none; }
.pal-capture-icon { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.pal-capture-details { display: grid; min-width: 0; gap: 2px; }
.pal-capture-number { color: var(--gold); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pal-capture-names { display: grid; min-width: 0; line-height: 1.35; }
.pal-capture-names strong { overflow-wrap: anywhere; }
.pal-capture-names small { color: var(--muted); overflow-wrap: anywhere; }

footer { padding: 24px 0 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

@media (max-width: 820px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 36px; }
  .toolbar { align-items: stretch; }
  .segmented, .search { width: 100%; }
  .pal-capture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pal-capture-card:nth-child(3n) { border-right: 1px solid var(--line); }
  .pal-capture-card:nth-child(2n) { border-right: 0; }
  .table-wrap { border: 0; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
  tbody tr:hover { background: var(--surface); }
  tbody td { display: grid; grid-template-columns: minmax(92px, 30%) minmax(0, 1fr); gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
  tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 750; }
  tbody tr:last-child td { border-bottom: 1px solid var(--line); }
  tbody tr td:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  .hero { min-height: 280px; }
  .hero-inner, .nav, .status-row, .wrap { width: min(100% - 28px, var(--content)); }
  .nav { width: 100%; gap: 0; overflow: visible; }
  .nav a { flex: 1; min-width: 0; justify-content: center; gap: 4px; padding: 0 6px; font-size: 12px; }
  .nav a svg { display: none; }
  .hero h1 { font-size: 31px; }
  .hero-copy { font-size: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 13px; }
  .metric-value { font-size: 21px; }
  .section-heading { display: block; }
  .step { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .step::before { width: 36px; height: 36px; }
  .ranking-row { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 9px 11px; }
  .pal-capture-grid { grid-template-columns: 1fr; }
  .pal-capture-card, .pal-capture-card:nth-child(2n), .pal-capture-card:nth-child(3n) { border-right: 0; }
  .capture-player-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
}
