:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: #10141d;
  --panel-2: #171d29;
  --line: #f5f7fb;
  --muted: #9da8b8;
  --yellow: #ffd84d;
  --orange: #ff7a3d;
  --cyan: #4ae4ff;
  --danger: #ff4f68;
  --green: #50e38d;
  --shadow: 7px 7px 0 #000;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--line);
  background:
    radial-gradient(circle at 18% 12%, rgba(74, 228, 255, .08), transparent 28rem),
    radial-gradient(circle at 86% 38%, rgba(255, 216, 77, .07), transparent 32rem),
    var(--bg);
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }

button:focus-visible, .job-card:focus-visible {
  outline: 4px solid var(--cyan);
  outline-offset: 3px;
}

.topbar {
  min-height: 76px;
  padding: 14px clamp(16px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid var(--line);
  background: rgba(8, 10, 15, .92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 950; font-size: 1.1rem; }

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #080a0f;
  background: var(--yellow);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 #000;
  transform: rotate(-3deg);
}

.rule-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.rule-pills span {
  padding: 7px 11px;
  border: 2px solid #3b4351;
  color: #d7dee9;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.ad-slot {
  width: min(970px, calc(100% - 32px));
  height: 72px;
  margin: 22px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px dashed #3a414e;
  color: #687385;
  background: rgba(15, 18, 25, .7);
}

.ad-slot span { font-size: .65rem; letter-spacing: .18em; }
.ad-slot strong { font-size: .82rem; }

main { width: min(1420px, calc(100% - 32px)); margin: 0 auto; }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin: 38px 0 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--yellow);
  font-size: .76rem;
  font-weight: 950;
  letter-spacing: .15em;
}

h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.4rem); line-height: .98; letter-spacing: -.06em; }
.section-note { max-width: 400px; margin: 0; color: var(--muted); font-size: .95rem; text-align: right; }

.job-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 124px;
}

.job-card {
  min-height: 246px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  text-align: left;
  color: var(--line);
  background: var(--panel);
  border: 3px solid #2d3441;
  border-radius: 0;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.job-card:hover { transform: translateY(-4px); border-color: #7e8a9b; background: var(--panel-2); }
.job-card.selected-first { border-color: var(--yellow); background: #1a202b; box-shadow: 7px 7px 0 var(--yellow); transform: translate(-3px, -3px); }
.job-card.selected-second { border-color: var(--cyan); background: #1a202b; box-shadow: 7px 7px 0 var(--cyan); transform: translate(-3px, -3px); }
.job-card.selected-first::after, .job-card.selected-second::after {
  content: attr(data-pick-label);
  position: absolute;
  right: 10px;
  top: 44px;
  padding: 4px 7px;
  color: #080a0f;
  background: var(--yellow);
  border: 2px solid var(--line);
  font-size: .7rem;
  font-weight: 950;
}
.job-card.selected-second::after { background: var(--cyan); }
.job-card { position: relative; }
.job-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-number { color: #737e8e; font-size: .75rem; font-weight: 900; }
.job-badge { padding: 4px 7px; border: 1px solid currentColor; font-size: .67rem; font-weight: 900; }
.job-icon {
  width: 62px;
  height: 62px;
  margin: 14px 0 12px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  border: 3px solid var(--line);
  background: var(--job-color);
  box-shadow: 4px 4px 0 #000;
}

.job-card h2 { margin: 0 0 10px; font-size: 1.22rem; }
.job-card p { margin: 0 0 7px; color: #b8c1cf; font-size: .78rem; line-height: 1.48; }
.job-card p strong { color: var(--line); }
.job-card .ability-line { margin-top: auto; padding-top: 10px; border-top: 1px solid #2d3441; color: #e9edf3; }

.start-dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 20px;
  width: min(760px, calc(100% - 28px));
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  transform: translateX(-50%);
  border: 3px solid var(--line);
  background: rgba(12, 15, 22, .96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.chosen-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chosen-summary .chosen-icon { width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.55rem; border: 2px solid var(--line); background: #222836; }
.chosen-summary div { display: grid; min-width: 0; }
.chosen-summary small { color: var(--muted); font-size: .72rem; }
.chosen-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-summary { display: flex; align-items: center; gap: 9px; min-width: 0; }
.duel-summary .versus { color: var(--yellow); font-size: .75rem; font-weight: 950; }
.duel-pick { display: flex; align-items: center; gap: 7px; min-width: 0; }
.duel-pick .chosen-icon { flex: 0 0 auto; width: 38px; height: 38px; font-size: 1.25rem; }
.duel-pick div { display: grid; min-width: 0; }
.duel-pick strong { font-size: .82rem; }

.primary-button, .small-button {
  border: 3px solid var(--line);
  color: #090b10;
  background: var(--yellow);
  font-weight: 950;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.primary-button { min-height: 50px; padding: 10px 24px; }
.small-button { min-height: 40px; padding: 8px 13px; font-size: .82rem; }
.primary-button:hover:not(:disabled), .small-button:hover { filter: brightness(1.08); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #000; }
.primary-button:active:not(:disabled), .small-button:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }
.primary-button:disabled { cursor: not-allowed; color: #747b86; background: #292e38; border-color: #545b67; }

.game-toolbar {
  margin: 18px 0 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 3px solid var(--line);
  background: var(--panel);
}

.round-state { display: flex; align-items: center; gap: 11px; }
.round-state div { display: grid; }
.round-state small { color: var(--muted); font-size: .7rem; }
.round-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--green); box-shadow: 0 0 18px var(--green); }
.toolbar-actions { display: flex; gap: 8px; }
.toolbar-actions .small-button { background: #161b25; color: var(--line); box-shadow: none; border-width: 2px; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.arena-shell {
  position: relative;
  min-width: 0;
  border: 4px solid var(--line);
  background: #07090d;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.arena-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 42px rgba(74, 228, 255, .12), inset 0 0 90px rgba(255, 79, 104, .06);
  mix-blend-mode: screen;
}

#arena { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 620; touch-action: none; }

.battle-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.panel-block { border: 3px solid var(--line); background: var(--panel); }
.selected-info { padding: 16px; }
.battle-job { display: flex; align-items: center; gap: 12px; }
.battle-job .job-icon { flex: 0 0 auto; width: 54px; height: 54px; margin: 0; font-size: 1.7rem; }
.battle-job h2 { margin: 0 0 4px; font-size: 1.15rem; }
.battle-job p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.battle-versus { margin: 9px 0; color: var(--yellow); font-size: .72rem; font-weight: 950; text-align: center; letter-spacing: .16em; }
.panel-title { padding: 11px 12px; display: flex; justify-content: space-between; border-bottom: 2px solid #343b48; font-size: .82rem; }
.panel-title span { color: var(--yellow); font-size: .7rem; font-weight: 900; }
.standings { max-height: 292px; overflow: auto; }
.standing-row { padding: 9px 11px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; border-bottom: 1px solid #292f3a; }
.standing-row.dead { opacity: .35; filter: grayscale(1); }
.standing-row .mini-icon { width: 27px; height: 27px; display: grid; place-items: center; background: var(--fighter-color); border: 1px solid white; font-size: .9rem; }
.standing-data { min-width: 0; }
.standing-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 850; }
.hp-track { height: 5px; margin-top: 4px; background: #303744; }
.hp-fill { height: 100%; background: var(--green); }
.standing-hp { color: #b9c1cf; font-size: .7rem; }
.battle-log { height: 180px; padding: 10px; overflow: auto; color: #aeb7c5; font-size: .72rem; line-height: 1.45; }
.log-item { padding: 5px 0; border-bottom: 1px dashed #2d3440; }
.log-item b { color: var(--line); }

.result-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(5, 7, 10, .84);
  backdrop-filter: blur(8px);
}
.result-panel[hidden] { display: none; }
.result-panel p { max-width: 520px; color: #bcc5d3; }
.result-panel #result-kicker { margin: 0 0 8px; color: var(--yellow); font-size: .75rem; font-weight: 950; letter-spacing: .16em; }
.result-panel h2 { margin: 0; font-size: clamp(2.6rem, 8vw, 6rem); letter-spacing: -.06em; }
.result-actions { display: flex; gap: 12px; margin-top: 12px; }
.secondary-button { color: var(--line); background: #151b25; }

footer {
  width: min(1420px, calc(100% - 32px));
  margin: 26px auto 34px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #2b313c;
  color: #747f8f;
  font-size: .75rem;
}

@media (max-width: 1120px) {
  .job-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .game-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 860px) {
  .job-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-layout { grid-template-columns: 1fr; }
  .battle-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .selected-info { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .topbar { position: relative; min-height: 62px; padding: 10px 14px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand { font-size: .94rem; }
  .rule-pills span:not(:last-child) { display: none; }
  .ad-slot { width: calc(100% - 24px); height: 58px; margin: 14px auto; }
  main { width: calc(100% - 20px); }
  .section-heading { align-items: start; flex-direction: column; gap: 10px; margin-top: 26px; }
  .section-note { text-align: left; }
  .job-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .job-card { min-height: 230px; padding: 12px; }
  .job-card .job-icon { width: 50px; height: 50px; margin: 10px 0; font-size: 1.6rem; }
  .job-card h2 { font-size: 1.02rem; }
  .job-card p { font-size: .71rem; }
  .start-dock { bottom: 9px; gap: 8px; }
  .chosen-summary { max-width: 43%; }
  .chosen-summary > .chosen-icon { display: none; }
  .duel-summary { gap: 4px; }
  .duel-pick .chosen-icon { display: none; }
  .duel-pick small { display: none; }
  .duel-pick strong { max-width: 76px; font-size: .72rem; }
  .primary-button { padding: 9px 12px; font-size: .82rem; }
  .game-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .small-button { padding: 7px 5px; font-size: .72rem; }
  .arena-shell { border-width: 3px; }
  .battle-panel { display: flex; }
  .result-actions { width: 100%; flex-direction: column; }
  .standings { max-height: 230px; }
  footer { flex-direction: column; width: calc(100% - 24px); }
}

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