:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-strong: #fff8e1;
  --ink: #15171a;
  --muted: #6c7480;
  --line: #dce2e8;
  --red: #ef4f45;
  --teal: #009f9a;
  --green: #2f9f62;
  --yellow: #f3bd36;
  --violet: #7357d8;
  --shadow: 0 18px 46px rgba(23, 28, 36, 0.14);
  --footer-height: 72px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  position: relative;
  background: linear-gradient(135deg, #fff9f0 0%, #eef8f7 52%, #fff5e8 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    url("/assets/logo-512.png") no-repeat right 1.8vw center / min(44vw, 460px) auto;
  opacity: 0.12;
}

#app {
  position: relative;
  z-index: 1;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

img {
  display: block;
  max-width: 100%;
}

.avatar-image {
  overflow: hidden;
  border: 1px solid rgba(21, 23, 26, 0.08);
  border-radius: 50%;
  background: #eef2f5;
  object-fit: cover;
}

.avatar-image.is-missing-avatar {
  background: #eef2f5;
}

.auth-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-panel {
  width: min(100%, 480px);
  padding: 24px;
  border: 1px solid rgba(21, 23, 26, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand-lockup,
.brand-small,
.question-meta,
.sheet-header,
.settings-profile,
.test-heading,
.player-footer,
.profile-chip,
.profile-main,
.toggle-row {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 14px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 0.95;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f5;
}

.segment {
  min-height: 42px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segment.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(21, 23, 26, 0.1);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

.field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 159, 154, 0.12);
}

.primary-action,
.secondary-action,
.danger-action,
.quick-action,
.test-account,
.answer-button {
  min-height: 50px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  color: #fff;
  background: var(--red);
  box-shadow: 0 10px 18px rgba(239, 79, 69, 0.24);
}

.quick-action {
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid rgba(243, 189, 54, 0.48);
}

.google-auth {
  display: grid;
  justify-content: center;
  min-height: 44px;
}

.google-auth-button {
  min-height: 40px;
}

.google-auth-button.is-loading {
  display: grid;
  place-items: center;
  min-height: 42px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.secondary-action {
  padding: 0 16px;
  color: #fff;
  background: var(--teal);
}

.danger-action {
  width: 100%;
  color: #fff;
  background: #9b2930;
}

.form-error {
  margin: -2px 0 0;
  color: #9b2930;
  font-weight: 800;
}

.test-zone {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.test-heading {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.test-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.test-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.test-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.test-account {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff8e1;
  border: 1px solid rgba(243, 189, 54, 0.45);
}

.test-account img {
  width: 34px;
  height: 34px;
}

.game-shell {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(var(--footer-height) + 24px + env(safe-area-inset-bottom));
}

.topbar {
  width: min(100%, 920px);
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.brand-small {
  gap: 9px;
  font-weight: 950;
  font-size: 1.02rem;
}

.brand-small img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.friends-button {
  position: relative;
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #eef7f7;
  box-shadow: inset 0 0 0 1px rgba(0, 159, 154, 0.2);
}

.friends-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.friends-counter {
  position: absolute;
  right: -3px;
  top: -3px;
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 950;
  box-shadow: 0 4px 12px rgba(239, 79, 69, 0.28);
}

.friends-status-dot {
  position: absolute;
  left: 5px;
  bottom: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #19b66f;
  box-shadow: 0 0 0 2px #fff;
}

.friends-button.is-offline {
  background: #f5f0f0;
  box-shadow: inset 0 0 0 1px rgba(155, 41, 48, 0.16);
}

.friends-button.is-offline .friends-status-dot {
  background: #9b2930;
}

.help-button {
  min-height: 32px;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  font-weight: 900;
  background-color: var(--yellow);
}

.question-stage {
  position: relative;
  width: min(100%, 920px);
  min-height: calc(100svh - var(--footer-height) - 92px);
  margin: 0 auto;
  display: grid;
  align-content: center;
  align-items: center;
  transform: translateY(-28px);
}

.mode-switch {
  position: relative;
  z-index: 0;
  justify-self: center;
  width: min(100%, 360px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  height: 34px;
  margin-bottom: -16px;
  padding: 3px 5px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: rgba(238, 242, 245, 0.96);
  box-shadow: 0 -10px 22px rgba(21, 23, 26, 0.08);
  transform: translateY(2px);
}

.mode-button {
  min-height: 24px;
  height: 24px;
  border-radius: 7px 7px 0 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: inset 0 -1px 0 rgba(21, 23, 26, 0.06);
}

.mode-button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 -4px 14px rgba(21, 23, 26, 0.08);
}

.mode-button:disabled,
.mode-button.is-disabled-mode {
  color: #9aa3ad;
  background: rgba(230, 235, 240, 0.86);
  box-shadow: inset 0 -1px 0 rgba(21, 23, 26, 0.04);
  cursor: not-allowed;
  opacity: 0.78;
}

.mode-button.is-active:disabled {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 -4px 14px rgba(21, 23, 26, 0.08);
  opacity: 1;
}

.question-panel,
.loading-panel {
  position: relative;
  z-index: 1;
  border: 2px solid rgba(21, 23, 26, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  margin-top: 10px;
  margin-bottom: 10px;
}

.question-panel {
  position: relative;
  padding: clamp(18px, 4vw, 34px);
}

.question-panel.is-timed::before {
  content: "";
  position: absolute;
  inset: -2px;
  padding: 5px;
  border-radius: 10px;
  background:
    conic-gradient(from -90deg,
      hsl(var(--question-ring-hue, 120) 95% 55%) calc(var(--question-ring-progress, 1) * 1turn),
      rgba(21, 23, 26, 0.08) 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 18px hsla(var(--question-ring-hue, 120), 95%, 55%, 0.32);
  pointer-events: none;
}

.question-meta {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.round-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-size: 0.72rem;
  font-weight: 950;
}

.question-change-label {
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #9b2930;
  background: #ffe4df;
  border: 1px solid rgba(239, 79, 69, 0.28);
  font-size: 0.42rem;
  font-weight: 950;
  text-transform: uppercase;
}

.round-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.round-powerup {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.98);
  border: 1px solid rgba(21, 23, 26, 0.1);
  box-shadow: 0 8px 18px rgba(21, 23, 26, 0.08);
}

.round-powerup-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

#questionText {
  min-height: 2.5em;
  margin-bottom: 22px;
  font-size: clamp(1.12rem, 3.25vw, 1.84rem);
  font-weight: 650;
  line-height: 1.16;
  transition: filter 180ms ease, color 180ms ease, text-shadow 180ms ease;
}

.question-panel.is-question-blurred #questionText {
  filter: blur(10px);
  color: transparent;
  text-shadow: 0 0 16px rgba(21, 23, 26, 0.42);
  user-select: none;
}

.question-viewers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 22px auto 0;
  padding: 5px 10px 5px 7px;
  border: 1px solid rgba(22, 167, 158, 0.24);
  border-radius: 999px;
  background: rgba(232, 244, 255, 0.78);
  color: #355861;
  font-size: 0.82rem;
  font-weight: 800;
}

.question-viewers[hidden] {
  display: none;
}

.question-viewers img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-button {
  min-height: 82px;
  padding: 14px;
  color: var(--ink);
  background: #f7f9fb;
  border: 2px solid var(--line);
  font-size: 0.94rem;
  text-align: left;
  line-height: 1.2;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.answer-button:active {
  transform: scale(0.98);
}

.answer-button:hover,
.answer-button:focus-visible {
  border-color: var(--red);
  background: #fff4f1;
  outline: none;
}

.answer-button.is-hidden-answer {
  color: #9aa3ad;
  background: #edf1f4;
  border-color: #d7dee5;
  filter: grayscale(1);
}

.answer-button.is-hidden-answer .answer-letter {
  background: #b9c2cc;
}

.question-panel.is-changing-question .answer-button {
  filter: grayscale(1);
  opacity: 0.48;
}

.question-panel.is-changing-question .answer-button:disabled {
  cursor: default;
}

.question-panel.is-changing-question .answer-button:hover,
.question-panel.is-changing-question .answer-button:focus-visible {
  border-color: var(--line);
  background: #f7f9fb;
  transform: none;
}

.question-change-card {
  grid-column: 1 / -1;
  min-height: 122px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  padding: 18px;
  border: 2px dashed rgba(21, 23, 26, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f6fa 100%);
  text-align: center;
}

.question-change-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(21, 23, 26, 0.14);
  border-top-color: var(--teal);
  border-radius: 999px;
  animation: question-change-spin 0.8s linear infinite;
}

.question-change-copy {
  display: grid;
  gap: 4px;
}

.question-change-title {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
}

.question-change-subtitle {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

@keyframes question-change-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.answer-letter {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 9px;
  border-radius: 6px;
  color: #fff;
  background: var(--violet);
  font-size: 0.85rem;
}

.answer-text {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: pretty;
}

.loading-panel {
  min-height: 360px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 14px 18px;
  text-align: center;
}

.loading-title {
  margin: 0;
  font-size: clamp(1rem, 3vw, 1.2rem);
}

.last-result {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.last-result-card {
  width: min(100%, 500px);
  min-height: 158px;
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fcfdff 0%, #f4f8fb 100%);
  text-align: left;
}

.last-result-card.is-correct {
  border-color: rgba(47, 159, 98, 0.45);
  background: #edf9f2;
}

.last-result-card.is-wrong {
  border-color: rgba(239, 79, 69, 0.42);
  background: #fff4f1;
}

.correct-answer-card {
  width: min(100%, 500px);
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid rgba(47, 159, 98, 0.22);
  border-radius: 8px;
  background: #f4fbf7;
  text-align: center;
}

.correct-answer-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.correct-answer-text {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.3;
}

.last-chat-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.last-chat-row.is-player {
  justify-content: flex-end;
}

.last-chat-row.is-brain {
  justify-content: flex-start;
}

.last-chat-bubble-wrap {
  min-width: 0;
  max-width: min(78%, 320px);
  display: grid;
  gap: 6px;
}

.last-chat-row.is-player .last-chat-bubble-wrap {
  justify-items: end;
}

.last-chat-bubble-wrap-brain {
  justify-items: start;
}

.last-chat-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-chat-bubble {
  margin: 0;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: clamp(0.92rem, 3vw, 1.04rem);
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 22px rgba(21, 23, 26, 0.08);
}

.last-chat-bubble-player {
  color: #173046;
  background: #e8f4ff;
  border-bottom-right-radius: 6px;
  text-align: right;
}

.last-chat-bubble-brain {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid rgba(21, 23, 26, 0.08);
  border-bottom-left-radius: 6px;
}

.last-result-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}

.last-result-mood {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 auto;
  padding: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(21, 23, 26, 0.08);
}

.last-result-card.is-correct .last-chat-bubble-brain {
  color: #1c7947;
  background: #e7f8ee;
  border-color: rgba(47, 159, 98, 0.32);
}

.last-result-card.is-wrong .last-chat-bubble-brain {
  color: #9b2930;
  background: #fff1ee;
  border-color: rgba(239, 79, 69, 0.3);
}

.chest-board {
  width: min(100%, 460px);
  display: grid;
  gap: 8px;
}

.chest-board-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.chest-board-title {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chest-board-count {
  color: var(--ink);
  font-size: 0.92rem;
}

.chest-rack {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.chest-button {
  position: relative;
  z-index: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 2px solid rgba(111, 76, 48, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  overflow: visible;
  will-change: transform;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.chest-button:hover,
.chest-button:focus-visible {
  border-color: rgba(175, 107, 30, 0.45);
  background: rgba(255, 248, 225, 0.96);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(175, 107, 30, 0.14);
}

.chest-button:disabled {
  cursor: default;
  opacity: 1;
  transform: none;
}

.chest-button.is-window-closed {
  border-color: rgba(111, 76, 48, 0.08);
  background: rgba(238, 242, 245, 0.96);
}

.chest-button.is-window-closed .chest-image {
  filter: grayscale(1) saturate(0.35);
  opacity: 0.58;
}

.chest-button.is-break-locked {
  border-color: rgba(111, 76, 48, 0.09);
  background: rgba(232, 236, 240, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.chest-button.is-break-locked .chest-image {
  filter: grayscale(1) saturate(0.22);
  opacity: 0.44;
}

.chest-button.is-opened {
  border-color: rgba(243, 189, 54, 0.38);
  background: rgba(255, 248, 225, 0.96);
  z-index: 3;
}

.chest-button.is-lucky-open {
  border-color: rgba(115, 87, 216, 0.48);
  box-shadow: 0 0 0 3px rgba(243, 189, 54, 0.18), 0 16px 30px rgba(115, 87, 216, 0.18);
  z-index: 12;
}

.chest-button.is-dropping {
  z-index: 2;
}

.chest-button.is-dropping .chest-image {
  animation: chest-drop 620ms cubic-bezier(0.2, 0.78, 0.2, 1);
}

.chest-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chest-clover {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 58%;
  width: 92px;
  height: 92px;
  transform: translateX(-50%) translateY(36px) scale(0.34) rotate(-14deg);
  transform-origin: 50% 85%;
  pointer-events: none;
  opacity: 0;
  background-image: url("/assets/lucky-clover.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 8px 12px rgba(21, 23, 26, 0.24)) drop-shadow(0 0 14px rgba(243, 189, 54, 0.32));
  animation:
    clover-pop 920ms cubic-bezier(0.18, 0.86, 0.24, 1.12) forwards,
    clover-sway 980ms ease-in-out 940ms infinite alternate;
}

.chest-clover::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 54px;
  height: 20px;
  transform: translateX(-50%) scale(0.65);
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(243, 189, 54, 0.46) 0%, rgba(243, 189, 54, 0.16) 58%, transparent 100%);
  opacity: 0;
  animation: clover-glow 920ms ease-out forwards;
}

.chest-clover::after {
  content: "";
  position: absolute;
  inset: -6px;
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 244, 177, 0.98) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 10%, rgba(255, 255, 255, 0.96) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 24%, rgba(255, 244, 177, 0.96) 0 2px, transparent 3px),
    radial-gradient(circle at 84% 68%, rgba(255, 255, 255, 0.94) 0 2px, transparent 3px),
    radial-gradient(circle at 28% 82%, rgba(255, 244, 177, 0.94) 0 2px, transparent 3px);
  opacity: 0;
  animation:
    clover-sparkle-enter 240ms ease 540ms forwards,
    clover-sparkle 820ms ease-in-out 660ms infinite alternate;
}

.chest-leprechaun {
  --leprechaun-frame-width: 72px;
  --leprechaun-frame-height: 116px;
  position: absolute;
  z-index: 14;
  left: 50%;
  bottom: 76%;
  width: var(--leprechaun-frame-width);
  height: var(--leprechaun-frame-height);
  transform: translateX(-50%) translateY(8px) scale(0.62);
  transform-origin: 50% 100%;
  pointer-events: none;
  opacity: 0;
  background-image: url("/assets/leprechaun-frame-1.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center bottom;
  will-change: transform, background-image;
  filter: drop-shadow(0 10px 12px rgba(21, 23, 26, 0.22)) drop-shadow(0 0 10px rgba(243, 189, 54, 0.3));
  animation:
    leprechaun-pop 940ms cubic-bezier(0.18, 0.86, 0.24, 1.12) forwards,
    leprechaun-frames 1400ms steps(1, end) infinite;
}

.chest-leprechaun::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 5%;
  height: 18px;
  background:
    radial-gradient(circle at 12% 54%, rgba(255, 244, 177, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 50%, rgba(243, 189, 54, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 24%, rgba(255, 255, 255, 0.86) 0 2px, transparent 3px);
  animation: leprechaun-sparkle 520ms ease-in-out infinite alternate;
}

.chest-hint {
  min-height: 1.3em;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
}

.progress-track {
  --chest-threshold: 100%;
  --progress-percent: 0%;
  position: relative;
  width: min(100%, 390px);
  height: 46px;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 999px;
  background: #eef3f7;
  border: 1px solid rgba(21, 23, 26, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84), 0 12px 26px rgba(21, 23, 26, 0.08);
}

.progress-zones {
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  overflow: hidden;
}

.progress-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 0 10px 5px;
  overflow: hidden;
  transition: opacity 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.progress-zone span {
  overflow: hidden;
  font-size: 0.62rem;
  font-weight: 950;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.progress-zone img {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  object-fit: contain;
  opacity: 0.88;
}

.progress-zone-chest {
  left: 0;
  width: var(--chest-threshold);
  align-items: center;
  color: #60450b;
  background: linear-gradient(90deg, rgba(255, 243, 187, 0.98), rgba(243, 189, 54, 0.94));
}

.progress-zone-wait {
  left: var(--chest-threshold);
  right: 0;
  color: #765539;
  background: linear-gradient(90deg, rgba(244, 232, 216, 0.98), rgba(232, 218, 207, 0.98));
}

.progress-fill {
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: var(--progress-percent);
  max-width: calc(100% - 8px);
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.26) 34%, rgba(255, 255, 255, 0.12)),
    linear-gradient(90deg, rgba(47, 159, 98, 0.14), rgba(239, 79, 69, 0.2));
  box-shadow: inset -2px 0 0 rgba(255, 255, 255, 0.78);
  pointer-events: none;
  transition: width 120ms linear;
}

.progress-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 4;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(21, 23, 26, 0.08);
}

.progress-threshold {
  position: absolute;
  z-index: 5;
  left: var(--chest-threshold);
  top: 50%;
  width: 0;
  height: 62px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.progress-threshold::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(111, 76, 48, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.progress-threshold-icon {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(111, 76, 48, 0.18));
  max-width: none;
}

.progress-threshold-time {
  position: absolute;
  left: 50%;
  bottom: -4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 248, 225, 0.96);
  transform: translateX(-50%);
  color: #6f4c30;
  font-size: 0.62rem;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(21, 23, 26, 0.08);
}

.progress-track.is-chest-window-closed .progress-zone-chest {
  opacity: 0.42;
  filter: grayscale(0.2) saturate(0.42);
}

.progress-track.is-chest-window-closed .progress-zone-wait {
  box-shadow: inset 0 0 0 999px rgba(239, 79, 69, 0.08);
}

.progress-track.is-chest-window-closed .progress-threshold-icon,
.progress-track.is-chest-window-closed .progress-threshold-time,
.progress-track.is-chest-window-closed .progress-threshold::before {
  opacity: 0.32;
}

.countdown-label {
  color: var(--muted);
  font-weight: 900;
}

.player-footer {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: var(--footer-height);
  padding: 7px max(12px, env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  opacity: 1;
  transform: translateX(0);
  transition: transform 360ms cubic-bezier(0.2, 0.78, 0.2, 1), opacity 220ms ease;
  will-change: transform;
}

.game-shell.is-chest-banner-active .player-footer {
  opacity: 0;
  transform: translateX(calc(-100% - 24px));
}

.profile-chip {
  width: min(44vw, 270px);
  min-height: 48px;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 8px;
  color: var(--ink);
  background: #f2f5f7;
  font-weight: 950;
  overflow: visible;
}

.profile-main {
  min-width: 0;
  flex: 1 1 auto;
  gap: 10px;
  color: inherit;
  background: transparent;
  text-align: left;
  overflow: hidden;
}

.profile-main > .avatar-image {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.profile-main > span {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-key-count {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 78px;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.9);
  border: 1px solid rgba(243, 189, 54, 0.42);
  color: var(--ink);
  overflow: visible;
}

.profile-key-plus {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 0 2px;
  border-radius: 8px;
  color: #7b4c00;
  background: linear-gradient(135deg, #fff5bd 0%, #ffd85f 100%);
  border: 1px solid rgba(180, 124, 13, 0.42);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(243, 189, 54, 0.26);
}

.profile-key-plus:active {
  transform: scale(0.94);
}

.profile-key-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transform-origin: 50% 50%;
}

.profile-key-item-lucky {
  padding-left: 5px;
  border-left: 1px solid rgba(243, 189, 54, 0.38);
}

.profile-key-item.is-key-pulse {
  animation: key-item-pulse 560ms cubic-bezier(0.2, 0.78, 0.2, 1);
}

.profile-key-item.is-lucky-pulse {
  animation: lucky-key-item-pulse 560ms cubic-bezier(0.18, 0.84, 0.22, 1);
}

.profile-key-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  object-fit: contain;
}

.profile-lucky-key-icon {
  filter: drop-shadow(0 0 6px rgba(243, 189, 54, 0.54));
}

.profile-key-count strong {
  font-size: 0.9rem;
  line-height: 1;
}

.profile-key-count.can-exchange {
  border-color: rgba(243, 189, 54, 0.9);
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.95), transparent 24%),
    linear-gradient(135deg, #fff5bd 0%, #ffe27a 52%, #fff8d5 100%);
  box-shadow: 0 0 0 2px rgba(243, 189, 54, 0.22), 0 0 22px rgba(243, 189, 54, 0.54);
  animation: key-glow 1100ms ease-in-out infinite alternate;
}

.profile-key-count.can-exchange::before,
.profile-key-count.can-exchange::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
}

.profile-key-count.can-exchange::before {
  inset: -8px;
  background:
    radial-gradient(circle at 12% 22%, rgba(255, 255, 255, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 14%, rgba(255, 226, 122, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 92% 76%, rgba(255, 255, 255, 0.86) 0 2px, transparent 3px),
    radial-gradient(circle at 24% 88%, rgba(255, 226, 122, 0.82) 0 2px, transparent 3px);
  animation: key-sparkle 1250ms steps(2, end) infinite;
}

.profile-key-count.can-exchange::after {
  inset: -3px;
  border: 1px solid rgba(243, 189, 54, 0.5);
  opacity: 0.8;
}

.score-strip {
  height: 48px;
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.score-strip div {
  min-width: 0;
  padding: 0 10px;
  text-align: center;
}

.score-strip>*+* {
  border-left: 1px solid var(--line);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-strip strong {
  font-size: 1rem;
}

.score-strip-button {
  min-width: 0;
  height: 100%;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  padding: 4px 6px;
  color: var(--ink);
  background: #f8fafc;
  text-align: center;
  font-weight: 950;
}

.score-strip-button img {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.score-strip-button span {
  font-size: 0.66rem;
  text-transform: uppercase;
}

.score-strip-button:hover,
.score-strip-button:focus-visible {
  background: #eef2f5;
  outline: none;
}

.overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(21, 23, 26, 0.46);
}

.sheet {
  width: min(100%, 540px);
  max-height: min(760px, calc(100svh - 36px));
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.sheet-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--ink);
  background: #eef2f5;
  font-size: 1.8rem;
  line-height: 1;
}

.ranking-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.friends-sheet {
  display: grid;
  gap: 16px;
}

.friend-share-block {
  display: grid;
  gap: 12px;
}

.friend-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.compact-action {
  min-height: 48px;
  padding: 0 16px;
}

.friends-list {
  display: grid;
  gap: 10px;
}

.friend-empty {
  margin: 0;
  padding: 18px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 800;
}

.friend-item,
.friend-profile {
  display: flex;
  align-items: center;
}

.friend-item {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.friend-profile {
  min-width: 0;
  gap: 10px;
}

.friend-profile img {
  width: 44px;
  height: 44px;
}

.friend-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.friend-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-status {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.friend-remove {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: #9b2930;
  font-weight: 900;
}

.ranking-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f5;
}

.ranking-tab {
  min-height: 40px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.ranking-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(21, 23, 26, 0.1);
}

.ranking-item {
  min-height: 64px;
  display: grid;
  grid-template-columns: 38px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.ranking-item.is-self {
  border-color: rgba(239, 79, 69, 0.45);
  background: #fff4f1;
}

.rank-number {
  font-weight: 950;
  color: var(--muted);
}

.ranking-item img {
  width: 42px;
  height: 42px;
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 950;
}

.rank-score {
  font-weight: 950;
}

.settings-sheet {
  display: grid;
  gap: 16px;
}

.ai-content-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.manual-sheet {
  display: grid;
  gap: 16px;
}

.quick-start-sheet {
  display: grid;
  gap: 16px;
}

.lucky-key-sheet {
  display: grid;
  gap: 16px;
}

.lucky-key-preview {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(243, 189, 54, 0.38);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8db 0%, #fffdf3 100%);
}

.lucky-key-preview img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(243, 189, 54, 0.28));
}

.lucky-key-preview strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.08rem;
}

.lucky-key-preview p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.lucky-key-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.manual-intro {
  margin: -4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.manual-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.manual-hero-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf7 0%, #f8fafc 100%);
}

.manual-hero-media {
  display: flex;
  align-items: center;
  min-height: 52px;
}

.manual-hero-media img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(21, 23, 26, 0.12));
}

.manual-hero-media img + img {
  margin-left: -8px;
}

.manual-hero-card strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.manual-hero-card span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.manual-list {
  display: grid;
  gap: 12px;
}

.manual-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.manual-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: #eef2f5;
  font-size: 2rem;
  font-weight: 950;
}

.manual-icon-accent {
  color: #fff;
  background: var(--violet);
}

.manual-icon-image {
  padding: 6px;
}

.manual-icon-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.manual-copy {
  min-width: 0;
}

.manual-copy h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.manual-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.manual-copy p + p {
  margin-top: 5px;
}

.manual-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.manual-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(21, 23, 26, 0.08);
  background: #fff;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.manual-chip img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.manual-mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.manual-mode-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.manual-mode-pill.is-global {
  color: #0f766e;
  background: #e8fffb;
  border-color: rgba(13, 148, 136, 0.22);
}

.manual-mode-pill.is-friends {
  color: #6d28d9;
  background: #f2ebff;
  border-color: rgba(124, 58, 237, 0.18);
}

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

.manual-power {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.manual-power img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.manual-power-copy {
  min-width: 0;
}

.manual-power-copy strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.84rem;
}

.manual-power-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.34;
}

.manual-outcomes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.manual-outcome {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.manual-outcome img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.manual-outcome span {
  font-size: 0.82rem;
  font-weight: 900;
}

.quick-start-intro {
  margin: -4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-start-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.quick-start-card img,
.quick-start-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.quick-start-icon {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2f5;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 950;
}

.quick-start-card strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.quick-start-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.quick-start-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-profile {
  gap: 12px;
  align-items: end;
}

.settings-profile img {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}

.compact-field {
  flex: 1;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.avatar-option {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.avatar-option.is-selected {
  border-color: var(--red);
  background: #fff4f1;
}

.avatar-option.is-reward {
  border-color: rgba(243, 189, 54, 0.42);
  background: #fff8e1;
}

.avatar-option.is-locked {
  border-color: var(--line);
  background: #eef2f5;
}

.avatar-option.is-locked img {
  filter: grayscale(0.85) brightness(0.72);
  opacity: 0.58;
}

.avatar-option img {
  width: 76%;
  height: 76%;
}

.avatar-lock {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(21, 23, 26, 0.78);
  box-shadow: 0 5px 12px rgba(21, 23, 26, 0.18);
}

.avatar-lock::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 10px;
  height: 8px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.avatar-lock::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 11px;
  width: 12px;
  height: 9px;
  border-radius: 2px;
  background: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.stat-tile {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 9px;
  border-radius: 8px;
  background: #f2f5f7;
  text-align: center;
}

.stat-tile span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.stat-tile strong {
  font-size: 1.24rem;
}

.toggle-list {
  display: grid;
  gap: 8px;
}

.toggle-row {
  justify-content: space-between;
  min-height: 54px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 900;
}

.toggle-row input {
  width: 48px;
  height: 28px;
  accent-color: var(--teal);
}

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--footer-height) + 18px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 420px);
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(21, 23, 26, 0.92);
  text-align: center;
  font-weight: 850;
  box-shadow: var(--shadow);
}

.chest-result-banner {
  position: fixed;
  z-index: 45;
  right: 0;
  bottom: calc(6px + env(safe-area-inset-bottom));
  width: 100%;
  height: 132px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(100%);
  transition: transform 340ms cubic-bezier(0.2, 0.78, 0.2, 1), opacity 220ms ease;
  filter: drop-shadow(0 16px 28px rgba(21, 23, 26, 0.2));
}

.chest-result-banner.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.chest-result-banner::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 19px 28px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.62), transparent 28%),
    linear-gradient(135deg, #fff2bc 0%, #f8d98a 46%, #fff5cf 100%);
}

.chest-result-banner.is-reward::before {
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.62), transparent 28%),
    linear-gradient(135deg, #fff1a8 0%, #f5c85f 48%, #fff4c5 100%);
}

.chest-result-banner.is-penalty::before {
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.52), transparent 28%),
    linear-gradient(135deg, #ffe3bc 0%, #eeb476 48%, #fff0ce 100%);
}

.chest-result-banner.is-empty::before {
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.58), transparent 28%),
    linear-gradient(135deg, #fff0bd 0%, #edd18a 48%, #fff5d2 100%);
}

.chest-result-frame {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.chest-result-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 54px;
}

.chest-result-icon {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: contain;
}

.chest-result-text {
  min-width: 0;
  color: var(--ink);
  font-size: clamp(1rem, 4vw, 1.28rem);
  font-weight: 950;
  line-height: 1.05;
  text-align: left;
  overflow-wrap: anywhere;
}

.chest-result-banner.is-reward .chest-result-text {
  color: #7b4c00;
}

.chest-result-banner.is-penalty .chest-result-text {
  color: #9b2930;
}

.chest-result-banner.is-empty .chest-result-text {
  color: #355861;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes chest-drop {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }

  70% {
    opacity: 1;
    transform: translateY(4px) scale(1.02);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes key-glow {
  from {
    filter: brightness(1);
  }

  to {
    filter: brightness(1.08);
  }
}

@keyframes key-item-pulse {
  0% {
    transform: scale(1);
  }

  38% {
    transform: scale(1.28);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes lucky-key-item-pulse {
  0% {
    transform: scale(1);
    filter: none;
  }

  34% {
    transform: scale(1.34);
    filter: drop-shadow(0 0 10px rgba(243, 189, 54, 0.68));
  }

  100% {
    transform: scale(1);
    filter: none;
  }
}

@keyframes key-sparkle {
  0%,
  100% {
    opacity: 0.35;
    transform: rotate(0deg) scale(0.96);
  }

  50% {
    opacity: 1;
    transform: rotate(6deg) scale(1.03);
  }
}

@keyframes clover-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(42px) scale(0.2) rotate(-16deg);
  }

  28% {
    opacity: 1;
    transform: translateX(-50%) translateY(2px) scale(0.9) rotate(10deg);
  }

  62% {
    opacity: 1;
    transform: translateX(-50%) translateY(-20px) scale(1.08) rotate(-6deg);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px) scale(1) rotate(4deg);
  }
}

@keyframes clover-sway {
  from {
    transform: translateX(-50%) translateY(-12px) scale(1) rotate(4deg);
  }

  to {
    transform: translateX(-50%) translateY(-16px) scale(1.04) rotate(-4deg);
  }
}

@keyframes clover-glow {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.45);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes clover-sparkle-enter {
  from {
    opacity: 0;
    transform: scale(0.84);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes clover-sparkle {
  from {
    opacity: 0.45;
    transform: translateY(2px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(-3px) scale(1.04);
  }
}

@keyframes leprechaun-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(14px) scale(0.42) rotate(-8deg);
  }

  24% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1.04) rotate(5deg);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes leprechaun-frames {
  0%,
  12.49% {
    background-image: url("/assets/leprechaun-frame-1.png");
  }

  12.5%,
  24.99% {
    background-image: url("/assets/leprechaun-frame-2.png");
  }

  25%,
  37.49% {
    background-image: url("/assets/leprechaun-frame-3.png");
  }

  37.5%,
  49.99% {
    background-image: url("/assets/leprechaun-frame-4.png");
  }

  50%,
  62.49% {
    background-image: url("/assets/leprechaun-frame-5.png");
  }

  62.5%,
  74.99% {
    background-image: url("/assets/leprechaun-frame-6.png");
  }

  75%,
  87.49% {
    background-image: url("/assets/leprechaun-frame-7.png");
  }

  87.5%,
  100% {
    background-image: url("/assets/leprechaun-frame-8.png");
  }
}

@keyframes leprechaun-sparkle {
  from {
    opacity: 0.35;
    transform: translateY(2px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(-2px) scale(1.05);
  }
}

@media (max-width: 680px) {
  :root {
    --footer-height: 82px;
  }

  .auth-panel {
    padding: 18px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .test-account-grid {
    grid-template-columns: 1fr;
  }

  .question-stage {
    align-content: start;
    align-items: start;
    padding-top: 8px;
    transform: translateY(-10px);
  }

  .topbar {
    align-items: start;
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .answer-grid {
    display: grid;
  }

  .answer-button {
    min-height: 66px;
  }

  .quick-start-grid {
    grid-template-columns: 1fr;
  }

  .chest-result-banner {
    bottom: calc(6px + env(safe-area-inset-bottom));
    width: 100%;
    height: 112px;
  }

  .chest-result-banner::before {
    inset: 17px 24px;
  }

  .chest-result-content {
    gap: 8px;
    padding: 23px 44px;
  }

  .chest-result-icon {
    width: 42px;
    height: 42px;
  }

  .chest-result-text {
    font-size: 0.98rem;
  }

  .player-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .mode-switch {
    width: min(100%, 320px);
  }

  .profile-chip {
    width: 100%;
  }

  .score-strip {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: 44px;
  }

  .score-strip div {
    padding: 0 6px;
  }

  .metric-label {
    font-size: 0.64rem;
  }

  .score-strip strong {
    font-size: 0.92rem;
  }

  .overlay {
    padding: 10px;
  }

  .sheet {
    max-height: calc(100svh - 20px);
  }

  .settings-profile {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .settings-profile .secondary-action {
    grid-column: 1 / -1;
  }

  .avatar-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .friend-link-row {
    grid-template-columns: 1fr;
  }

  .manual-hero {
    grid-template-columns: 1fr;
  }

  .manual-item {
    grid-template-columns: 1fr;
  }

  .lucky-key-preview {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .lucky-key-preview img {
    width: 64px;
    height: 64px;
  }

  .lucky-key-actions {
    grid-template-columns: 1fr;
  }

  .manual-icon {
    width: 56px;
    height: 56px;
  }

  .manual-outcomes {
    grid-template-columns: 1fr;
  }

  .manual-power-grid {
    grid-template-columns: 1fr;
  }

  .chest-rack {
    gap: 8px;
  }

  .chest-button {
    padding: 3px;
  }

  .chest-clover {
    bottom: 60%;
    width: 78px;
    height: 78px;
  }

  .chest-leprechaun {
    --leprechaun-frame-width: 58px;
    --leprechaun-frame-height: 94px;
    bottom: 66%;
  }
}

@media (min-width: 860px) {
  .overlay {
    place-items: center;
  }
}
