:root {
  --bg: #080d1f;
  --panel: rgba(13, 22, 48, 0.86);
  --panel-strong: rgba(8, 13, 31, 0.94);
  --line: rgba(255, 255, 255, 0.18);
  --gold: #ffd84a;
  --gold-deep: #f0a900;
  --faith: #4fe3ff;
  --grace: #60f26e;
  --danger: #ff647c;
  --ink: #f8fbff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 15%, rgba(79, 227, 255, 0.18), transparent 32%),
    linear-gradient(180deg, #080d1f 0%, #121735 52%, #071221 100%);
  color: var(--ink);
  font-family:
    "Pretendard",
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    system-ui,
    sans-serif;
  touch-action: none;
  user-select: none;
}

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

.game-shell {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  overflow: hidden;
  background: #101832;
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.5);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #101832;
}

.hud {
  position: absolute;
  z-index: 10;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 8px;
  pointer-events: none;
}

.hud-row {
  display: contents;
}

.hud-row .hud-pill:first-child {
  grid-column: 1;
}

.hud-row .level-pill {
  grid-column: 2;
}

.hud-row .hud-pill:last-child {
  grid-column: 3 / 5;
}

.hud-pill {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.level-pill {
  border-color: rgba(255, 216, 74, 0.72);
  color: #fff4b8;
}

.hud-icon {
  font-size: 17px;
}

.stage-line {
  grid-column: 1 / 3;
  grid-row: span 2;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 3px;
  padding: 0 2px;
  border: 2px solid rgba(255, 216, 74, 0.22);
  border-radius: 8px;
  background: rgba(8, 13, 31, 0.68);
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.stage-line strong {
  color: #fff7c4;
  overflow: hidden;
  font-size: 20px;
  font-weight: 1000;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-line span {
  color: rgba(248, 251, 255, 0.82);
  overflow: hidden;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-group {
  grid-column: 3 / 5;
  margin-top: 0;
}

.bar-group.compact {
  margin-top: 0;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  margin: 0 4px 2px;
  color: rgba(248, 251, 255, 0.9);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.bar-label span,
.bar-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label span {
  min-width: 0;
}

.bar-label strong {
  flex-shrink: 0;
  margin-left: 5px;
  font-size: 16px;
  font-weight: 1000;
}

.bar-frame {
  position: relative;
  height: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
}

.bar-fill {
  width: 0;
  height: 100%;
  transform-origin: left center;
  transition: width 120ms linear;
}

.faith-fill {
  background: linear-gradient(90deg, #33c7ff 0%, #62f7d6 55%, #fff47b 100%);
}

.xp-frame {
  height: 10px;
}

.xp-fill {
  background: linear-gradient(90deg, #29d75d 0%, #c8ff56 100%);
}

.equipped-skills {
  grid-column: 3 / 5;
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.skill-badge {
  display: inline-flex;
  min-width: 27px;
  height: 22px;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 5px;
  border: 1px solid rgba(255, 216, 74, 0.42);
  border-radius: 7px;
  background: rgba(8, 13, 31, 0.7);
  color: #fff7c4;
  font-size: 13px;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.skill-badge-level {
  color: #fff06a;
  font-size: 10px;
}

.skill-badge.is-awakened {
  border-color: rgba(255, 255, 255, 0.82);
  background: linear-gradient(180deg, rgba(255, 240, 106, 0.96), rgba(255, 156, 32, 0.9));
  color: #18213d;
  box-shadow: 0 0 14px rgba(255, 216, 74, 0.62);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.42);
}

.skill-badge.is-awakened .skill-badge-level {
  color: #18213d;
}

.boss-banner {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(92%, 390px);
  margin-top: 0;
  padding: 6px 9px;
  border: 2px solid rgba(255, 216, 74, 0.72);
  border-radius: 8px;
  background: rgba(66, 12, 42, 0.88);
  color: #fff3a2;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.boss-hud {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(76%, 330px);
  margin-top: 0;
  padding: 5px 7px 6px;
  border: 2px solid rgba(255, 100, 124, 0.7);
  border-radius: 8px;
  background: rgba(49, 8, 26, 0.88);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.boss-hud-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
  color: #fff3a2;
  font-size: 11px;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.boss-frame {
  height: 8px;
  border-color: rgba(255, 255, 255, 0.4);
}

.boss-fill {
  background: linear-gradient(90deg, #ff4664 0%, #ff9b40 55%, #fff06a 100%);
}

.screen {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 216, 74, 0.16), transparent 30%),
    rgba(5, 8, 20, 0.78);
  text-align: center;
}

.start-screen {
  padding-bottom: max(138px, calc(env(safe-area-inset-bottom) + 130px));
}

.start-screen h1,
.result-screen h2,
.choice-header h2 {
  margin: 0;
  color: #fff7c4;
  font-size: clamp(36px, 12vw, 62px);
  font-weight: 1000;
  line-height: 1.02;
  letter-spacing: 0;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.42),
    0 0 24px rgba(255, 216, 74, 0.42);
}

.start-screen p,
.result-screen p,
.choice-header p {
  width: min(100%, 390px);
  margin: 14px 0 0;
  color: rgba(248, 251, 255, 0.88);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.title-mark {
  position: relative;
  width: 96px;
  height: 104px;
  margin-bottom: 16px;
  cursor: pointer;
  filter:
    drop-shadow(0 0 16px rgba(255, 216, 74, 0.72))
    drop-shadow(0 0 38px rgba(255, 170, 24, 0.5));
  touch-action: manipulation;
  user-select: none;
}

.title-mark::before,
.title-mark::after {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  content: "";
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff9b8 0%, #ffd84a 48%, #f0a900 100%);
  box-shadow:
    0 0 18px rgba(255, 216, 74, 0.86),
    0 0 44px rgba(255, 170, 24, 0.58),
    0 8px 0 rgba(0, 0, 0, 0.22);
}

.title-mark::before {
  width: 26px;
  height: 90px;
}

.title-mark::after {
  width: 72px;
  height: 24px;
  top: 45%;
}

.result-icon {
  display: grid;
  width: 82px;
  height: 82px;
  margin-bottom: 18px;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: radial-gradient(circle, #fff8b2 0%, #ffd84a 44%, #26d6ff 100%);
  color: #14213f;
  font-size: 42px;
  font-weight: 1000;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.24);
}

.primary-button {
  min-width: 190px;
  min-height: 58px;
  margin-top: 28px;
  padding: 0 28px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff06a 0%, #ffc529 55%, #f09800 100%);
  color: #25304e;
  font-size: 22px;
  font-weight: 1000;
  box-shadow:
    0 7px 0 #995f00,
    0 16px 28px rgba(0, 0, 0, 0.32);
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow:
    0 3px 0 #995f00,
    0 10px 20px rgba(0, 0, 0, 0.28);
}

.start-actions,
.ranking-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.start-actions .primary-button,
.ranking-actions .primary-button {
  margin-top: 0;
}

.start-actions .secondary-button,
.ranking-actions .secondary-button {
  min-height: 58px;
  padding: 0 22px;
  font-size: 18px;
}

.event-notice {
  display: grid;
  width: min(100%, 390px);
  gap: 5px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 3px solid rgba(255, 216, 74, 0.88);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 216, 74, 0.15), rgba(255, 140, 32, 0.08)),
    rgba(8, 13, 31, 0.9);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.34),
    0 0 24px rgba(255, 216, 74, 0.22);
  color: #fff8bd;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.event-notice strong {
  color: #fff06a;
  font-size: 17px;
  font-weight: 1000;
  text-shadow: 0 0 12px rgba(255, 216, 74, 0.6);
}

.event-notice span {
  display: block;
}

.secret-stats-panel {
  display: grid;
  width: min(100%, 390px);
  gap: 6px;
  margin-top: 12px;
  padding: 11px 14px;
  border: 2px solid rgba(105, 232, 255, 0.7);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(105, 232, 255, 0.18), rgba(255, 216, 74, 0.1)),
    rgba(8, 13, 31, 0.92);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.3),
    0 0 22px rgba(105, 232, 255, 0.2);
  color: #e8fbff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.secret-stats-panel strong {
  color: #fff06a;
  font-size: 16px;
  font-weight: 1000;
}

.secret-stats-panel div {
  display: grid;
  gap: 4px;
}

.secret-stats-panel span {
  display: block;
}

.ranking-screen {
  justify-content: center;
  background:
    radial-gradient(circle at 50% 24%, rgba(79, 227, 255, 0.16), transparent 28%),
    rgba(5, 8, 20, 0.86);
  overflow-y: auto;
}

.leaderboard-panel {
  width: min(100%, 460px);
  margin-top: 18px;
  padding: 14px;
}

.ranking-actions {
  margin-top: 14px;
}

.control-hint {
  width: min(100%, 360px);
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 251, 255, 0.78);
  font-size: 13px;
  font-weight: 700;
}

.creator-credit {
  margin-top: 12px;
  color: rgba(255, 247, 196, 0.94);
  font-size: 15px;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.kakao-browser-guide {
  position: absolute;
  right: 14px;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
  left: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 14px 15px;
  border: 3px solid rgba(255, 216, 74, 0.78);
  border-radius: 8px;
  background: rgba(8, 13, 31, 0.82);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.3),
    0 0 28px rgba(255, 216, 74, 0.24);
  color: #fff7c4;
  pointer-events: none;
  text-align: left;
}

.kakao-browser-guide strong,
.kakao-browser-guide span {
  display: block;
}

.kakao-browser-guide strong {
  margin-bottom: 5px;
  color: #fff06a;
  font-size: 18px;
  font-weight: 1000;
  text-shadow: 0 0 10px rgba(255, 216, 74, 0.68);
}

.kakao-browser-guide span {
  color: rgba(248, 251, 255, 0.94);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.28;
}

.kakao-browser-guide b {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff06a;
  font-size: 44px;
  line-height: 1;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.55),
    0 0 14px rgba(255, 216, 74, 0.62);
  transform: translate(4px, 5px);
}

.choice-screen {
  justify-content: flex-start;
  padding: max(78px, calc(env(safe-area-inset-top) + 62px)) 12px 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 216, 74, 0.18), transparent 28%),
    rgba(5, 8, 20, 0.86);
}

.choice-header span {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #1fd173;
  color: #062315;
  font-size: 12px;
  font-weight: 1000;
}

.choice-header h2 {
  font-size: clamp(28px, 8vw, 42px);
}

.choice-header p {
  margin-top: 8px;
  font-size: 13px;
}

.choice-cards {
  display: grid;
  width: min(100%, 486px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  margin-top: 20px;
}

.skill-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 350px;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 8px 10px;
  overflow: hidden;
  border: 3px solid #fff4aa;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 199, 0.98) 0%, rgba(255, 222, 74, 0.98) 26%, rgba(255, 164, 20, 0.98) 100%);
  color: #27314b;
  text-align: center;
  box-shadow:
    0 7px 0 #8e5600,
    0 14px 26px rgba(0, 0, 0, 0.34);
}

.skill-card::before {
  position: absolute;
  inset: 42px 8px auto;
  height: 90px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  content: "";
}

.skill-card:active {
  transform: translateY(3px);
  box-shadow:
    0 3px 0 #9c6200,
    0 9px 16px rgba(0, 0, 0, 0.24);
}

.awakening-card {
  border-color: #ffffff;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.72), transparent 36%),
    linear-gradient(180deg, rgba(255, 252, 204, 0.98) 0%, rgba(255, 210, 57, 0.98) 34%, rgba(255, 106, 54, 0.98) 100%);
  box-shadow:
    0 7px 0 #8e3100,
    0 0 26px rgba(255, 216, 74, 0.56),
    0 14px 26px rgba(0, 0, 0, 0.34);
}

.awakening-card .card-ribbon {
  background: linear-gradient(180deg, #ffffff 0%, #fff06a 54%, #ffb12b 100%);
}

.awakening-card .card-icon-frame {
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 240, 106, 0.94) 48%, rgba(255, 107, 124, 0.9) 100%);
}

.overflow-card {
  border-color: rgba(255, 247, 196, 0.92);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.48), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 204, 0.98) 0%, rgba(255, 216, 74, 0.98) 36%, rgba(79, 227, 255, 0.92) 100%);
  box-shadow:
    0 7px 0 #276b89,
    0 0 22px rgba(255, 216, 74, 0.4),
    0 14px 26px rgba(0, 0, 0, 0.34);
}

.overflow-card .card-ribbon {
  background: linear-gradient(180deg, #fffbd0 0%, #fff06a 100%);
}

.overflow-card .card-icon-frame {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 196, 0.95) 50%, rgba(79, 227, 255, 0.9) 100%);
}

.card-ribbon {
  position: relative;
  z-index: 1;
  display: grid;
  width: calc(100% + 16px);
  min-height: 38px;
  place-items: center;
  padding: 4px 6px;
  background: linear-gradient(180deg, #fff36b 0%, #ffc400 100%);
  color: #27314b;
  font-size: 14px;
  font-weight: 1000;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.card-icon-frame {
  position: relative;
  z-index: 1;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin-top: 8px;
  border: 4px solid rgba(39, 49, 75, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.98) 0%, rgba(204, 248, 255, 0.92) 55%, rgba(86, 213, 255, 0.92) 100%);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.42),
    0 5px 0 rgba(39, 49, 75, 0.2);
}

.card-icon {
  display: block;
  font-size: 35px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.18));
}

.card-copy {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 146px;
  flex-direction: column;
  align-items: center;
}

.card-copy h3 {
  width: 100%;
  margin: 2px 0 7px;
  font-size: 21px;
  font-weight: 1000;
  line-height: 1.15;
  letter-spacing: 0;
  word-break: keep-all;
}

.card-copy p {
  margin: 0;
  color: rgba(39, 49, 75, 0.78);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.24;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.star-row {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  justify-content: center;
  gap: 1px;
  margin-top: auto;
  padding-top: 6px;
  font-size: clamp(16px, 4vw, 19px);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.star-on,
.star-next {
  color: #fff2a2;
}

.star-next {
  transform: scale(1.18);
  color: #ffffff;
}

.star-off {
  color: rgba(39, 49, 75, 0.28);
}

.card-level {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(39, 49, 75, 0.18);
  color: #222b45;
  font-size: 13px;
  font-weight: 1000;
}

.reward-card .card-icon-frame {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 242, 166, 0.94) 52%, rgba(255, 186, 65, 0.92) 100%);
}

.result-screen {
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 216, 74, 0.18), transparent 28%),
    rgba(5, 8, 20, 0.9);
  overflow-y: auto;
}

.result-grid {
  display: grid;
  width: min(100%, 360px);
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 24px 0 0;
}

.result-grid div {
  min-width: 0;
  padding: 12px 6px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: var(--panel);
}

.result-grid dt {
  color: rgba(248, 251, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
}

.result-grid dd {
  margin: 7px 0 0;
  color: #fff7c4;
  font-size: 18px;
  font-weight: 1000;
}

.victory-skills {
  width: min(100%, 360px);
  margin-top: 14px;
  padding: 12px 14px;
  border: 2px solid rgba(255, 216, 74, 0.24);
  border-radius: 8px;
  background: var(--panel);
  color: rgba(248, 251, 255, 0.86);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.victory-skills strong {
  display: block;
  margin-bottom: 5px;
  color: #fff7c4;
  font-size: 15px;
  font-weight: 1000;
}

.score-panel {
  width: min(100%, 380px);
  margin-top: 14px;
  padding: 12px;
  border: 2px solid rgba(255, 216, 74, 0.24);
  border-radius: 8px;
  background: rgba(8, 13, 31, 0.82);
}

.score-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(248, 251, 255, 0.82);
  font-size: 13px;
  font-weight: 900;
}

.score-total strong {
  color: #fff06a;
  font-size: 24px;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.score-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  margin-top: 9px;
}

.score-form input {
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fbff;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
}

.score-form input::placeholder {
  color: rgba(248, 251, 255, 0.52);
}

.secondary-button {
  min-height: 40px;
  padding: 0 12px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: linear-gradient(180deg, #8cffc1 0%, #1fd173 100%);
  color: #062315;
  font-size: 14px;
  font-weight: 1000;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.26);
}

.secondary-button:disabled {
  opacity: 0.55;
}

.score-message {
  min-height: 18px;
  margin: 7px 0 0;
  color: #fff7c4;
  font-size: 12px;
  font-weight: 800;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  text-align: left;
}

.ranking-grid div,
.monthly-ranking-details > div {
  min-width: 0;
  padding: 9px 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.ranking-grid h3,
.monthly-ranking-details h3 {
  margin: 0 0 7px;
  color: #fff7c4;
  font-size: 13px;
  font-weight: 1000;
  text-align: center;
}

.ranking-grid ol,
.monthly-ranking-details ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-grid li,
.monthly-ranking-details li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 6px;
  color: rgba(248, 251, 255, 0.84);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.ranking-rank {
  color: #fff06a;
}

.ranking-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-stage {
  color: #fff7c4;
  font-size: 11px;
  font-weight: 1000;
  white-space: nowrap;
}

.ranking-score {
  grid-column: 2 / 4;
  color: rgba(248, 251, 255, 0.66);
}

.ranking-grid li.ranking-top,
.monthly-ranking-details li.ranking-top {
  position: relative;
  margin: 1px -2px;
  padding: 5px 6px;
  border-radius: 7px;
}

.ranking-grid li.ranking-locked,
.monthly-ranking-details li.ranking-locked {
  opacity: 0.72;
  border: 1px dashed rgba(255, 216, 74, 0.28);
  border-radius: 7px;
  padding: 4px 5px;
}

.monthly-ranking-details {
  margin-top: 10px;
  text-align: left;
}

.monthly-ranking-details summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 216, 74, 0.52);
  border-radius: 8px;
  background: rgba(8, 13, 31, 0.74);
  color: #fff7c4;
  cursor: pointer;
  font-size: 14px;
  font-weight: 1000;
  list-style: none;
  text-align: center;
}

.monthly-ranking-details summary::-webkit-details-marker {
  display: none;
}

.monthly-ranking-details summary::after {
  content: "▼";
  margin-left: 8px;
  color: #fff06a;
  font-size: 11px;
}

.monthly-ranking-details[open] summary {
  margin-bottom: 8px;
}

.monthly-ranking-details[open] summary::after {
  content: "▲";
}

.leaderboard-panel .ranking-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}

.leaderboard-panel .ranking-grid div,
.leaderboard-panel .monthly-ranking-details > div {
  padding: 12px 13px;
  border-width: 2px;
}

.leaderboard-panel .ranking-grid h3,
.leaderboard-panel .monthly-ranking-details h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.leaderboard-panel .ranking-grid ol,
.leaderboard-panel .monthly-ranking-details ol {
  gap: 6px;
}

.leaderboard-panel .ranking-grid li,
.leaderboard-panel .monthly-ranking-details li {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.leaderboard-panel .ranking-score {
  grid-column: auto;
  color: rgba(248, 251, 255, 0.78);
  font-size: 14px;
}

.leaderboard-panel .ranking-grid li.ranking-top,
.leaderboard-panel .monthly-ranking-details li.ranking-top {
  margin: 2px -3px;
  padding: 7px 8px;
}

.leaderboard-panel .monthly-ranking-details summary {
  min-height: 48px;
  font-size: 16px;
}

.ranking-top-1 {
  background: linear-gradient(90deg, rgba(255, 216, 74, 0.34), rgba(255, 244, 166, 0.12));
  box-shadow:
    0 0 0 1px rgba(255, 240, 106, 0.36),
    0 0 14px rgba(255, 216, 74, 0.42);
}

.ranking-top-2 {
  background: linear-gradient(90deg, rgba(204, 230, 255, 0.28), rgba(255, 255, 255, 0.09));
  box-shadow:
    0 0 0 1px rgba(220, 238, 255, 0.32),
    0 0 12px rgba(192, 224, 255, 0.34);
}

.ranking-top-3 {
  background: linear-gradient(90deg, rgba(255, 173, 94, 0.28), rgba(255, 216, 142, 0.09));
  box-shadow:
    0 0 0 1px rgba(255, 184, 104, 0.3),
    0 0 12px rgba(255, 153, 68, 0.3);
}

.ranking-top-1 .ranking-rank,
.ranking-top-1 .ranking-name,
.ranking-top-1 .ranking-stage,
.ranking-top-1 .ranking-score {
  color: #fff6a8;
  text-shadow: 0 0 8px rgba(255, 216, 74, 0.75);
}

.ranking-top-2 .ranking-rank,
.ranking-top-2 .ranking-name,
.ranking-top-2 .ranking-stage,
.ranking-top-2 .ranking-score {
  color: #e9f6ff;
  text-shadow: 0 0 7px rgba(205, 232, 255, 0.62);
}

.ranking-top-3 .ranking-rank,
.ranking-top-3 .ranking-name,
.ranking-top-3 .ranking-stage,
.ranking-top-3 .ranking-score {
  color: #ffd5a0;
  text-shadow: 0 0 7px rgba(255, 164, 74, 0.58);
}

.sound-controls {
  position: absolute;
  z-index: 18;
  right: 12px;
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: auto;
}

.sound-button {
  display: grid;
  min-width: 54px;
  min-height: 38px;
  place-items: center;
  padding: 0 9px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(13, 22, 48, 0.86);
  color: #fff7c4;
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.sound-button.is-off {
  border-color: rgba(255, 100, 124, 0.58);
  background: rgba(49, 8, 26, 0.86);
  color: rgba(248, 251, 255, 0.7);
}

.sound-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.pause-button {
  position: absolute;
  z-index: 19;
  right: 12px;
  bottom: max(162px, calc(env(safe-area-inset-bottom) + 162px));
  display: grid;
  width: 54px;
  height: 42px;
  place-items: center;
  border: 2px solid rgba(255, 216, 74, 0.72);
  border-radius: 8px;
  background: rgba(13, 22, 48, 0.9);
  color: #fff7c4;
  font-size: 18px;
  font-weight: 1000;
  pointer-events: auto;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.pause-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.pause-screen {
  justify-content: center;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 216, 74, 0.18), transparent 28%),
    rgba(5, 8, 20, 0.72);
}

.pause-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.pause-actions .primary-button {
  margin-top: 0;
}

.pause-actions .secondary-button {
  min-height: 58px;
  padding: 0 22px;
  font-size: 18px;
}

.joystick {
  position: absolute;
  z-index: 14;
  left: 0;
  top: 0;
  width: 154px;
  height: 154px;
  display: grid;
  opacity: 0;
  place-items: center;
  pointer-events: none;
  touch-action: none;
  transform: translate(-999px, -999px);
  transition: opacity 90ms ease;
}

.joystick.is-active {
  opacity: 1;
}

.joystick-ring {
  position: relative;
  width: 138px;
  height: 138px;
  border: 4px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 26px rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.24);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: #233052;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
}

.hidden {
  display: none !important;
}

.game-shell[data-state="start"] .battle-ui,
.game-shell[data-state="ranking"] .battle-ui,
.game-shell[data-state="gameover"] .battle-ui,
.game-shell[data-state="victory"] .battle-ui {
  display: none;
}

.game-shell[data-state="levelup"] .pause-button,
.game-shell[data-state="stageIntro"] .pause-button,
.game-shell[data-state="bossReward"] .pause-button {
  display: none;
}

.game-shell[data-state="start"] .sound-controls,
.game-shell[data-state="ranking"] .sound-controls,
.game-shell[data-state="levelup"] .sound-controls,
.game-shell[data-state="bossReward"] .sound-controls,
.game-shell[data-state="gameover"] .sound-controls,
.game-shell[data-state="victory"] .sound-controls {
  display: none;
}

.game-shell[data-state="levelup"] .joystick,
.game-shell[data-state="bossReward"] .joystick,
.game-shell[data-state="paused"] .joystick {
  opacity: 0.25;
}

@media (min-width: 720px) {
  .game-shell {
    height: min(100dvh, 900px);
    margin-top: max(0px, calc((100dvh - 900px) / 2));
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
  }
}

@media (max-height: 720px) {
  .choice-screen {
    padding-top: 58px;
  }

  .result-screen {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .result-screen h2 {
    font-size: clamp(30px, 9vw, 44px);
  }

  .result-screen p {
    margin-top: 8px;
    font-size: 13px;
  }

  .result-grid {
    margin-top: 14px;
  }

  .score-panel {
    margin-top: 10px;
    padding: 9px;
  }

  .ranking-screen h2 {
    font-size: clamp(30px, 9vw, 44px);
  }

  .ranking-screen .choice-header p {
    margin-top: 8px;
    font-size: 14px;
  }

  .start-actions,
  .ranking-actions {
    margin-top: 14px;
  }

  .ranking-grid {
    gap: 6px;
  }

  .leaderboard-panel {
    padding: 11px;
  }

  .leaderboard-panel .ranking-grid {
    gap: 8px;
  }

  .leaderboard-panel .ranking-grid h3 {
    font-size: 15px;
  }

  .leaderboard-panel .ranking-grid li {
    font-size: 13px;
  }

  .choice-cards {
    gap: 6px;
    margin-top: 12px;
  }

  .skill-card {
    min-height: 310px;
    padding: 0 6px 8px;
  }

  .card-ribbon {
    min-height: 34px;
    font-size: 12px;
  }

  .card-icon-frame {
    width: 56px;
    height: 56px;
    margin-top: 6px;
  }

  .card-icon {
    font-size: 28px;
  }

  .card-copy {
    min-height: 138px;
  }

  .card-copy h3 {
    font-size: 18px;
  }

  .card-copy p {
    font-size: 14px;
    line-height: 1.18;
  }

  .card-level {
    font-size: 12px;
  }
}
