@font-face {
  font-family: "Cafe24Ssurround";
  src: url("assets/font/Cafe24Ssurround.woff") format("woff");
  font-display: swap;
}

@font-face {
  font-family: "OmniGothic035";
  src: url("assets/font/210-OmniGothic-035.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "OmniGothic045";
  src: url("assets/font/210-OmniGothic-045.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "OmniGothic050";
  src: url("assets/font/210-OmniGothic-050.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Jua";
  src: url("assets/font/Jua-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --frame-width: 844px;
  --frame-height: 1766px;
  --app-width: 100vw;
  --app-height: 100vh;
  --stage-padding-x: 12px;
  --stage-padding-y: calc(28px + env(safe-area-inset-bottom, 0px));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: var(--app-height);
}

body {
  font-family: "Jua", sans-serif;
  background: #edf3ff;
  overflow: hidden;
}

#app {
  width: 100%;
  height: var(--app-height);
  padding-block: 10px calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  box-sizing: border-box;
  overflow: hidden;
}

.viewport {
  width: min(calc(var(--app-width) - var(--stage-padding-x)), calc((var(--app-height) - var(--stage-padding-y)) * 844 / 1766));
  height: min(calc(var(--app-height) - var(--stage-padding-y)), calc((var(--app-width) - var(--stage-padding-x)) * 1766 / 844));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.stage {
  position: relative;
  width: var(--frame-width);
  height: var(--frame-height);
  transform-origin: top left;
  overflow: hidden;
}

.screen-image {
  position: absolute;
  inset: 0;
  width: 844px;
  height: 1766px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.play-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.asset-sprite {
  position: absolute;
  pointer-events: none;
}

.play-item-cover {
  position: absolute;
  border-radius: 18px;
  background: #ffffff;
  pointer-events: none;
}

.play-item-update {
  object-fit: contain;
}

.hit {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.cell-hit {
  border-radius: 20px;
}

.cell-highlight {
  position: absolute;
  border-radius: 20px;
  pointer-events: none;
}

.cell-highlight.pattern {
  background: rgba(255, 204, 66, 0.48);
  box-shadow:
    inset 0 0 0 3px rgba(255, 161, 0, 0.38),
    0 0 24px rgba(255, 191, 40, 0.45);
}

.cell-highlight.correct {
  background: rgba(84, 227, 255, 0.38);
  box-shadow:
    inset 0 0 0 3px rgba(24, 176, 247, 0.3),
    0 0 20px rgba(69, 218, 255, 0.42);
}

.cell-highlight.wrong {
  background: rgba(255, 84, 116, 0.34);
  box-shadow:
    inset 0 0 0 3px rgba(255, 54, 92, 0.24),
    0 0 20px rgba(255, 74, 109, 0.32);
}

.cover-pill {
  position: absolute;
  background: #a9bdf2;
  border-radius: 999px;
}

.menu-root {
  position: absolute;
  inset: 0;
}

.menu-surface {
  position: absolute;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.9) 0, rgba(255, 255, 255, 0.32) 28%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(233, 238, 255, 0.82) 2.9%, rgba(255, 255, 255, 0) 72.6%),
    repeating-linear-gradient(63deg, rgba(198, 210, 236, 0.2) 0 5px, transparent 5px 96px),
    repeating-linear-gradient(-27deg, rgba(198, 210, 236, 0.12) 0 5px, transparent 5px 96px),
    #ffffff;
}

.menu-glow {
  position: absolute;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(121, 177, 255, 0.28), rgba(189, 219, 255, 0.12) 42%, rgba(255, 255, 255, 0) 72%);
  filter: blur(18px);
  opacity: 0.9;
}

.menu-card {
  position: absolute;
  border: 6px solid #ffffff;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 40px rgba(99, 139, 224, 0.2);
  backdrop-filter: blur(2px);
}

.menu-subtitle {
  position: absolute;
  font-family: "OmniGothic035", sans-serif;
  font-size: 24px;
  line-height: 33.6px;
  color: #b4b7cf;
  text-align: center;
}

.menu-divider {
  position: absolute;
  background: linear-gradient(180deg, rgba(214, 217, 234, 0), rgba(214, 217, 234, 1) 18%, rgba(214, 217, 234, 1) 82%, rgba(214, 217, 234, 0));
}

.menu-brain {
  position: absolute;
  pointer-events: none;
  overflow: visible;
}

.menu-brain-layer,
.menu-brain-front {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.menu-brain-layer {
  inset: 0;
  width: 100%;
  height: 100%;
}

.menu-brain-overlay {
  opacity: 0.9;
}

.menu-brain-front {
  top: -81.29%;
  right: -76.05%;
  bottom: -81.29%;
  left: -76.05%;
  width: auto;
  height: auto;
}

.menu-title-person {
  position: absolute;
  pointer-events: none;
  overflow: hidden;
}

.menu-title-person-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.menu-title-person-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% top;
  transform: scale(1.58);
  transform-origin: 58% top;
  filter: drop-shadow(-2px 0 0 #2a338f) drop-shadow(2px 0 0 #2a338f) drop-shadow(0 -2px 0 #2a338f) drop-shadow(0 2px 0 #2a338f);
  user-select: none;
  -webkit-user-drag: none;
}

.menu-title-person-spark {
  position: absolute;
  pointer-events: none;
}

.menu-button-label {
  position: absolute;
  font-family: "Cafe24Ssurround", sans-serif;
  font-size: 45px;
  line-height: 47px;
  color: #0e5958;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.hud-text,
.progress-text,
.modal-text,
.ranking-text {
  position: absolute;
  font-family: "Cafe24Ssurround", sans-serif;
  color: #ffffff;
  letter-spacing: 0;
}

.hud-text.score {
  color: #ffffff;
  font-size: 22px;
  line-height: 47px;
  text-shadow: none;
}

.hud-text.timer {
  color: #ffffff;
  font-size: 22px;
  line-height: 47px;
  text-shadow: none;
}

.hud-text.level {
  font-family: "OmniGothic045", sans-serif;
  color: #1e4e86;
  font-size: 38px;
  line-height: 47px;
  text-shadow: none;
}

.progress-track {
  position: absolute;
  left: 247px;
  top: 1535px;
  width: 350px;
  height: 15px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(199, 184, 244, 0.58);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd13b, #ffc200);
}

.progress-text {
  left: 402px;
  top: 1564px;
  transform: translateX(-50%);
  font-size: 27px;
  color: #4a3369;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.modal-patch {
  position: absolute;
  border-radius: 18px;
  background: rgba(247, 250, 255, 0.92);
}

.play-progress-patch {
  border-radius: 28px;
  background: #edf3ff;
}

.result-stat {
  position: absolute;
  width: 90px;
  text-align: right;
  line-height: 47px;
  text-shadow: none;
}

.result-stat.popup {
  font-family: "OmniGothic050", sans-serif;
  font-size: 32px;
  color: #2d3138;
}

.result-stat.register {
  font-family: "OmniGothic045", sans-serif;
  font-size: 32px;
  color: #2a67b8;
}

.result-note {
  position: absolute;
  left: 102px;
  width: 640px;
  font-family: "OmniGothic035", sans-serif;
  text-align: center;
  font-size: 28px;
  color: #56657d;
  line-height: 1.3;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.86);
}

.button-label {
  position: absolute;
  font-family: "Cafe24Ssurround", sans-serif;
  font-size: 38px;
  color: #ffffff;
  text-shadow:
    -2px 0 rgba(83, 76, 127, 0.68),
    2px 0 rgba(83, 76, 127, 0.68),
    0 -2px rgba(83, 76, 127, 0.68),
    0 2px rgba(83, 76, 127, 0.68);
  pointer-events: none;
}

.button-label.alt-green {
  color: #0f8363;
  text-shadow:
    -1px 0 rgba(255, 255, 255, 0.8),
    1px 0 rgba(255, 255, 255, 0.8),
    0 -1px rgba(255, 255, 255, 0.8),
    0 1px rgba(255, 255, 255, 0.8);
}

.register-input {
  position: absolute;
  left: 169px;
  top: 1007px;
  width: 505px;
  height: 62px;
  border: 0;
  background: transparent;
  font-family: "OmniGothic035", sans-serif;
  font-size: 32px;
  line-height: 47px;
  color: #31516f;
  text-align: center;
  outline: none;
}

.register-input::placeholder {
  color: transparent;
}

.ranking-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 24, 41, 0.56);
}

.ranking-scroll-track,
.ranking-scroll-thumb {
  position: absolute;
  border-radius: 999px;
}

.ranking-scroll-track {
  z-index: 3;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(205, 207, 215, 0.94), rgba(186, 189, 198, 0.94));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.75),
    inset 0 -1px 1px rgba(110, 116, 130, 0.22);
  opacity: 0.85;
}

.ranking-scroll-thumb {
  z-index: 4;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(173, 176, 186, 0.95), rgba(150, 154, 166, 0.95));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.52),
    0 1px 2px rgba(68, 73, 84, 0.18);
  opacity: 0.92;
  touch-action: none;
  cursor: grab;
}

.ranking-scroll-track.active {
  background: linear-gradient(180deg, rgba(235, 173, 122, 0.95), rgba(211, 142, 94, 0.95));
  box-shadow:
    inset 0 1px 1px rgba(255, 232, 205, 0.52),
    inset 0 -1px 1px rgba(170, 105, 64, 0.24);
  opacity: 1;
}

.ranking-scroll-thumb.active {
  background: linear-gradient(180deg, rgba(244, 159, 88, 0.98), rgba(227, 118, 43, 0.98));
  box-shadow:
    inset 0 1px 1px rgba(255, 232, 206, 0.4),
    0 1px 2px rgba(101, 49, 20, 0.24);
  opacity: 1;
}

.ranking-list-viewport {
  position: absolute;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  z-index: 1;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
}

.ranking-list-viewport::-webkit-scrollbar {
  display: none;
}

.ranking-list-content {
  width: 504px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ranking-list-content.is-static {
  height: 100%;
  justify-content: space-between;
}

.ranking-list-content.is-scrollable {
  padding-bottom: 14px;
}

.ranking-list-viewport.is-thumb-dragging,
.ranking-list-viewport.is-thumb-dragging * {
  user-select: none;
}

.ranking-list-viewport.is-thumb-dragging + .ranking-scroll-thumb,
.ranking-scroll-thumb:active {
  cursor: grabbing;
}

.ranking-row {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: start;
  overflow: hidden;
}

.ranking-text {
  color: #fff7ef;
  text-shadow:
    -2px 0 rgba(138, 76, 44, 0.66),
    2px 0 rgba(138, 76, 44, 0.66),
    0 -2px rgba(138, 76, 44, 0.66),
    0 2px rgba(138, 76, 44, 0.66),
    -1px -1px rgba(138, 76, 44, 0.66),
    1px -1px rgba(138, 76, 44, 0.66),
    -1px 1px rgba(138, 76, 44, 0.66),
    1px 1px rgba(138, 76, 44, 0.66);
}

.ranking-name {
  position: absolute;
  left: 103px;
  font-size: 28px;
  line-height: 1.05;
}

.ranking-badge-number {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  text-align: center;
  color: #ffffff;
}

.ranking-value {
  position: absolute;
  left: 432px;
  width: 48px;
  text-align: right;
  font-size: 23px;
  line-height: 1;
}

.ranking-empty {
  position: absolute;
  left: 150px;
  top: 880px;
  width: 544px;
  text-align: center;
  font-size: 30px;
  color: #9b704f;
}

@media (max-width: 900px) {
  :root {
    --stage-padding-x: 10px;
    --stage-padding-y: calc(38px + env(safe-area-inset-bottom, 0px));
  }

  #app {
    padding-block: 8px calc(30px + env(safe-area-inset-bottom, 0px));
  }

  .viewport {
    width: min(calc(var(--app-width) - var(--stage-padding-x)), calc((var(--app-height) - var(--stage-padding-y)) * 844 / 1766));
    height: min(calc(var(--app-height) - var(--stage-padding-y)), calc((var(--app-width) - var(--stage-padding-x)) * 1766 / 844));
  }
}

.replay-ad-overlay {
  position: absolute;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #071845;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.replay-ad-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.replay-ad-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.replay-ad-counter {
  position: absolute;
  right: 20px;
  top: 27px;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: center / contain no-repeat;
}

.replay-ad-count {
  display: block;
  color: #2f3340;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  transform: translateY(4px);
}
