:root {
  --font: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  --ink: #2b2f4a;
  --gold: #e9c45a;
  --gold-dark: #b8862a;
  --marble: #fbf8f1;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1b1d27;
  font-family: var(--font);
  color: var(--ink);
}

html.obs,
html.obs body {
  background: transparent;
}

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: 0 0;
}

#world {
  position: absolute;
  inset: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------- selection ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#select {
  background: linear-gradient(180deg, rgba(20, 30, 60, 0.35), rgba(20, 30, 60, 0.55));
  padding-top: 40px;
  gap: 26px;
}

.title {
  text-align: center;
}

.title h1 {
  margin: 0;
  font-size: 96px;
  font-weight: 900;
  color: #fff3c4;
  letter-spacing: 2px;
  -webkit-text-stroke: 3px #9a6a12;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #9a6a12, 0 14px 30px rgba(0, 0, 0, 0.35);
}

.title p {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.cards {
  display: grid;
  grid-template-columns: repeat(9, 196px);
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 14px;
  border: 5px solid transparent;
  border-radius: 24px;
  background: rgba(251, 248, 241, 0.86);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  opacity: 0.78;
}

.card img {
  width: 172px;
  height: 172px;
  object-fit: contain;
}

.card .name {
  font-size: 32px;
  font-weight: 900;
}

.card .god {
  font-size: 18px;
  font-weight: 600;
  color: #7a7f99;
}

.card .skill {
  margin-top: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: var(--c);
}

.card .check {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  line-height: 44px;
  opacity: 0;
  transform: scale(0.4);
  transition: 0.15s;
}

.card.on {
  opacity: 1;
  background: #fff;
  border-color: var(--c);
  transform: translateY(-8px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(255, 255, 255, 0.6);
}

.card.on .check {
  opacity: 1;
  transform: scale(1);
}

.options {
  display: grid;
  grid-template-columns: auto auto;
  gap: 14px 40px;
  padding: 22px 34px;
  border-radius: 28px;
  background: rgba(251, 248, 241, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.opt {
  display: flex;
  align-items: center;
  gap: 16px;
}

.opt > span {
  width: 120px;
  font-size: 24px;
  font-weight: 800;
}

.seg {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: #ece5d4;
}

.seg button {
  padding: 8px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 21px;
  font-weight: 700;
  color: #6b6150;
}

.seg button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

#sel-count {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.actions button {
  padding: 16px 44px;
  border: 0;
  border-radius: 40px;
  font-size: 34px;
  font-weight: 900;
  background: #fff;
  box-shadow: 0 6px 0 #c9bfa6, 0 12px 24px rgba(0, 0, 0, 0.25);
}

.actions button.primary {
  background: linear-gradient(180deg, #ffe48a, #f2bf3a);
  color: #6b4206;
  box-shadow: 0 6px 0 var(--gold-dark), 0 12px 24px rgba(0, 0, 0, 0.25);
}

.actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------- HUD ---------- */

#progress {
  position: absolute;
  top: 22px;
  left: 370px;
  width: 1180px;
  height: 74px;
}

#progress .bar {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#progress .flag {
  position: absolute;
  top: 24px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: var(--ink);
}

#progress .flag.start {
  left: -70px;
}

#progress .flag.goal {
  right: -70px;
  background: var(--gold-dark);
}

.pface {
  position: absolute;
  top: 6px;
  left: -31px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 4px solid var(--c);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.pface img,
.rrow img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#remain {
  position: absolute;
  top: 100px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

#ranks {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 316px;
}

.rrow {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 316px;
  height: 56px;
  padding: 0 12px 0 6px;
  border-radius: 28px;
  background: rgba(251, 248, 241, 0.92);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.rrow .rk {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
  line-height: 40px;
}

.rrow img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--c);
}

.rrow .nm {
  flex: 1;
  font-size: 24px;
  font-weight: 900;
}

#ranks.compact .rrow {
  height: 44px;
}

#ranks.compact .rrow .rk {
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 32px;
}

#ranks.compact .rrow img {
  width: 36px;
  height: 36px;
}

#ranks.compact .rrow .nm {
  font-size: 21px;
}

.chip {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.chip:empty {
  display: none;
}

.chip.bad {
  background: #e65a5a;
}

.chip.good {
  background: #2fb36a;
}

.chip.done {
  background: var(--ink);
}

#cutin {
  position: absolute;
  top: 150px;
  right: 0;
  display: flex;
  align-items: center;
  width: 640px;
  height: 190px;
  padding-left: 10px;
  border-radius: 95px 0 0 95px;
  background: linear-gradient(90deg, var(--c, #888) 0%, rgba(255, 255, 255, 0.95) 55%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translateX(110%);
}

#cutin.show {
  animation: cutin 1.7s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

@keyframes cutin {
  0% {
    transform: translateX(110%);
  }
  14% {
    transform: translateX(0);
  }
  82% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(110%);
  }
}

#cutin img {
  width: 176px;
  height: 176px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.ci-text {
  padding-left: 18px;
}

.ci-name {
  font-size: 30px;
  font-weight: 800;
}

.ci-skill {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  -webkit-text-stroke: 7px var(--c);
  paint-order: stroke fill;
}

.ci-desc {
  font-size: 22px;
  font-weight: 700;
  color: #5d6077;
}

#caption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  max-width: 1400px;
  padding: 12px 40px;
  border-radius: 40px;
  background: rgba(20, 22, 40, 0.74);
  color: #fff;
  font-size: 38px;
  font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
}

#caption.show {
  animation: caption 0.35s ease-out forwards;
}

@keyframes caption {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

#countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 240px;
  font-weight: 900;
  color: #fff7d0;
  -webkit-text-stroke: 10px #9a6a12;
  paint-order: stroke fill;
  text-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

#countdown.show {
  animation: pop 0.8s ease-out forwards;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.2);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
}

/* ---------- result ---------- */

#result {
  justify-content: center;
  gap: 26px;
  background: rgba(20, 24, 45, 0.55);
}

.res-box {
  display: flex;
  align-items: flex-end;
  gap: 60px;
}

.podium {
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

.pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 250px;
}

.pod img {
  width: 230px;
  height: 230px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
}

.pod.p1 img {
  width: 300px;
  height: 300px;
}

.pod-name {
  margin: 6px 0 10px;
  padding: 4px 18px;
  border-radius: 20px;
  background: var(--c);
  color: #fff;
  font-size: 32px;
  font-weight: 900;
}

.pod-step {
  width: 100%;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, #fffaf0, #e9dfc7);
  font-size: 64px;
  font-weight: 900;
  text-align: center;
  color: #a07a2a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.pod.p1 .pod-step {
  height: 170px;
  line-height: 170px;
  background: linear-gradient(180deg, #fff2b8, #f0c44a);
}

.pod.p2 .pod-step {
  height: 120px;
  line-height: 120px;
}

.pod.p3 .pod-step {
  height: 90px;
  line-height: 90px;
}

.ranking {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 20px;
  border-radius: 24px;
  background: rgba(251, 248, 241, 0.94);
  list-style: none;
  min-width: 470px;
}

.ranking li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 800;
}

.ranking .rk {
  width: 46px;
  font-size: 30px;
  font-weight: 900;
  text-align: center;
  color: #a07a2a;
}

.ranking img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--c);
  object-fit: cover;
}

.ranking .nm {
  flex: 1;
}

.ranking .tm {
  font-size: 22px;
  color: #7a7f99;
}

.ranking li.last {
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 14px;
  background: #ffe1e1;
  color: #b23a3a;
}

.verdict {
  padding: 14px 48px;
  border-radius: 40px;
  background: #fff;
  font-size: 44px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.verdict b {
  font-weight: 900;
  color: #b8862a;
}

.verdict.loser b,
.verdict.both b:last-child {
  color: #d04545;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  background: #1b1d27;
}
