:root {
  --ink: #25231f;
  --muted: #756f67;
  --paper: #f7f1e6;
  --panel: rgba(255, 250, 240, 0.84);
  --line: rgba(45, 42, 37, 0.16);
  --mint: #3fb89a;
  --coral: #f26b5e;
  --gold: #e6ad39;
  --blue: #486f9f;
  --shadow: 0 20px 60px rgba(47, 36, 25, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background:
    linear-gradient(rgba(255, 250, 241, 0.58), rgba(255, 250, 241, 0.5)),
    url("assets/home-background-v1.png"),
    linear-gradient(135deg, #f6eddf 0%, #e7f3ec 52%, #f8d8ce 100%);
  background-attachment: fixed;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

button {
  color: inherit;
  font: inherit;
}

.shell {
  width: calc(100vw - 40px);
  max-width: none;
  margin: 0 auto;
  padding: 24px 0 28px;
}

.topbar {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  margin-bottom: 14px;
  padding: 0 4px;
  border-bottom: 2px solid rgba(37, 35, 31, 0.16);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.top-actions {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
}

.story-entry {
  height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(242, 107, 94, 0.24);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.88), rgba(255, 230, 226, 0.68)),
    rgba(255, 250, 241, 0.72);
  cursor: pointer;
  color: #d45f72;
  box-shadow: 0 8px 18px rgba(242, 107, 94, 0.1);
  font-family: "华文彩云", "幼圆", "YouYuan", "华文琥珀", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.story-entry:hover {
  border-color: rgba(242, 107, 94, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.96), rgba(255, 218, 224, 0.8)),
    rgba(255, 250, 241, 0.92);
  color: #c94e64;
  transform: translateY(-1px) scale(1.02);
}

.game-repository-entry {
  justify-self: end;
  height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(63, 184, 154, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.88), rgba(224, 247, 239, 0.72)),
    rgba(255, 250, 241, 0.72);
  cursor: pointer;
  color: #288e73;
  box-shadow: 0 8px 18px rgba(63, 184, 154, 0.1);
  font-family: "幼圆", "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.game-repository-entry:hover {
  border-color: rgba(63, 184, 154, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.96), rgba(207, 242, 230, 0.86)),
    rgba(255, 250, 241, 0.92);
  color: #20775f;
  transform: translateY(-1px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(37, 35, 31, 0.14);
  border-radius: 50%;
  background: rgba(255, 250, 241, 0.72);
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

h2 {
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.avatar-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 8px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.58);
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.avatar-button {
  cursor: pointer;
}

.avatar-button:hover {
  border-color: rgba(37, 35, 31, 0.18);
  background: rgba(255, 250, 241, 0.88);
}

.user-menu {
  position: relative;
  justify-self: end;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  display: grid;
  min-width: max-content;
  padding: 8px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: 0 14px 34px rgba(47, 36, 25, 0.12);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.user-dropdown button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  padding: 0 14px;
  white-space: nowrap;
}

.user-dropdown button:hover {
  background: #fff0df;
}

.avatar-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, var(--coral) 0 50%, transparent 50%),
    var(--gold);
}

body.logged-out .avatar-button {
  padding-left: 12px;
}

body.logged-out .avatar-dot {
  display: none;
}

.avatar-dot.has-avatar,
.profile-avatar.has-avatar,
.player-avatar.has-avatar {
  background-color: #fee3e4;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: transparent;
}

.announcement-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 36px;
  margin-bottom: 14px;
  padding: 0 12px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.42);
  overflow: hidden;
}

.announcement-label {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  border-radius: 999px;
  background: rgba(72, 111, 159, 0.14);
}

.announcement-icon {
  width: 16px;
  height: 16px;
  fill: var(--blue);
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.announcement-window {
  height: 36px;
  min-width: 0;
  overflow: hidden;
}

.announcement-track {
  display: grid;
  transition: transform 0.38s cubic-bezier(0.22, 0.8, 0.22, 1);
}

.announcement-item {
  height: 36px;
  overflow: hidden;
}

.announcement-content {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  color: #315f83;
  font-size: 14px;
  font-weight: 700;
  line-height: 36px;
  white-space: nowrap;
}

.announcement-content.is-scrolling {
  max-width: none;
  padding-left: 100%;
  animation: announcementScroll 18s linear infinite;
}

.announcement-bar.paused .announcement-content.is-scrolling {
  animation-play-state: paused;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(560px, 1.7fr) minmax(280px, 0.84fr);
  gap: 18px;
  min-height: 650px;
  transition: grid-template-columns 0.34s cubic-bezier(0.22, 0.8, 0.22, 1);
}

.panel,
.stage-panel,
.inventory-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px);
}

.panel {
  position: relative;
  padding: 18px;
  transition:
    padding 0.34s cubic-bezier(0.22, 0.8, 0.22, 1),
    border-color 0.24s ease,
    background 0.24s ease,
    opacity 0.24s ease;
}

.claim-panel,
.status-panel {
  background: rgba(255, 250, 241, 0.18);
  border-color: rgba(37, 35, 31, 0.08);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.panel-heading,
.inventory-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.claim-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.claim-panel > :not(.collapse-toggle),
.leaderboard-panel > :not(.collapse-toggle) {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.22, 0.8, 0.22, 1),
    visibility 0s linear 0s;
}

.collapse-toggle {
  position: absolute;
  top: 50%;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 22px;
  height: 76px;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.7);
  backdrop-filter: blur(10px);
  cursor: pointer;
  color: rgba(37, 35, 31, 0.58);
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
  transition:
    background 0.16s ease,
    color 0.16s ease,
    transform 0.34s cubic-bezier(0.22, 0.8, 0.22, 1);
}

.collapse-toggle:hover {
  background: rgba(255, 250, 241, 0.95);
  color: var(--ink);
}

.left-toggle {
  right: -11px;
}

.right-toggle {
  left: -11px;
}

.panel.collapsed {
  padding: 18px;
  border-color: transparent;
  background: transparent;
  backdrop-filter: none;
}

.panel.collapsed > :not(.collapse-toggle) {
  opacity: 0;
  transform: scale(0.96);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.16s ease,
    transform 0.2s ease,
    visibility 0s linear 0.16s;
}

.panel.collapsed .collapse-toggle {
  transform: translateY(-50%);
}

.claim-panel.collapsed .collapse-toggle {
  left: -11px;
  right: auto;
  transform: translateY(-50%) translateX(1px);
}

.leaderboard-panel.collapsed .collapse-toggle {
  left: auto;
  right: -11px;
  transform: translateY(-50%) translateX(-1px);
}

.gacha-machine {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 430px;
  padding-top: 22px;
  padding-bottom: 72px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  overflow: visible;
}

.gacha-machine.cranking {
  animation: gachaShake 0.72s ease-in-out;
}

.gacha-dome {
  position: relative;
  width: min(92%, 236px);
  height: 188px;
  margin-top: 0;
  border: 2px solid rgba(37, 35, 31, 0.84);
  border-bottom: 0;
  border-radius: 132px 132px 28px 28px;
  background:
    radial-gradient(circle at 38% 24%, rgba(255, 255, 255, 0.72), transparent 18%),
    rgba(255, 250, 241, 0.58);
  overflow: hidden;
}

.capsule {
  position: absolute;
  width: 54px;
  height: 38px;
  border: 1px solid rgba(37, 35, 31, 0.24);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint) 0 50%, #fff8ed 50%);
  transform: rotate(var(--spin));
  animation: capsuleFloat 4.8s ease-in-out infinite;
}

.capsule-a {
  --spin: -18deg;
  left: 34px;
  top: 94px;
}

.capsule-b {
  --spin: 20deg;
  right: 34px;
  top: 72px;
  background: linear-gradient(90deg, var(--coral) 0 50%, #fff8ed 50%);
  animation-delay: -1.3s;
}

.capsule-c {
  --spin: 8deg;
  left: 88px;
  top: 34px;
  background: linear-gradient(90deg, var(--gold) 0 50%, #fff8ed 50%);
  animation-delay: -2.1s;
}

.capsule-d {
  --spin: -30deg;
  right: 72px;
  bottom: 18px;
  background: linear-gradient(90deg, var(--blue) 0 50%, #fff8ed 50%);
  animation-delay: -3s;
}

.gacha-body {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  width: min(100%, 258px);
  min-height: 184px;
  padding: 22px 22px 24px;
  border: 2px solid rgba(37, 35, 31, 0.84);
  border-radius: 16px 16px 8px 8px;
  background: linear-gradient(180deg, #fffaf1, #f2c9bd);
  box-shadow: 8px 8px 0 rgba(37, 35, 31, 0.78);
}

.gacha-knob {
  appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-top: 0;
  padding: 0;
  border: 7px solid #245892;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 22%),
    radial-gradient(circle, #fffdf8 0 58%, #f0ede5 59% 100%);
  cursor: pointer;
  box-shadow: none;
}

.knob-handle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 18px;
  border: 1px solid rgba(37, 35, 31, 0.16);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #dedbd2);
  box-shadow: none;
  transform: translate(-50%, -50%) rotate(-18deg);
}

.gacha-knob:hover:not(:disabled) {
  filter: brightness(1.05);
}

.gacha-knob:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.gacha-machine.cranking .gacha-knob {
  animation: knobTurn 0.72s ease-in-out;
}

.gacha-mouth {
  position: absolute;
  left: 50%;
  bottom: -15px;
  display: flex;
  box-sizing: border-box;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  width: 168px;
  height: 52px;
  padding-top: 15px;
  border: 2px solid rgba(37, 35, 31, 0.84);
  border-radius: 0 0 18px 18px;
  background: #fffaf1;
  transform: translateX(-50%);
}

.prize-token,
.flying-prize,
.drag-preview {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(37, 35, 31, 0.24);
  border-radius: 50%;
  background: var(--gift-color);
  color: #fff8ed;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(47, 36, 25, 0.18);
}

.prize-token.has-image,
.flying-prize.has-image,
.drag-preview.has-image {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 8px 8px rgba(47, 36, 25, 0.22));
}

.prize-token img,
.flying-prize img,
.drag-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.prize-token {
  animation: prizePop 0.62s cubic-bezier(0.2, 1.2, 0.35, 1);
}

.flying-prize {
  position: fixed;
  z-index: 200;
  pointer-events: none;
}

.drag-preview {
  pointer-events: none;
}

.live-drag-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(37, 35, 31, 0.24);
  border-radius: 50%;
  background: var(--gift-color);
  color: #fff8ed;
  font-size: 20px;
  font-weight: 900;
  pointer-events: none;
  will-change: transform;
}

.live-drag-preview.has-image {
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  filter: drop-shadow(0 10px 10px rgba(47, 36, 25, 0.22));
}

.live-drag-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.result-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
}

.result-board {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  font-size: 13px;
}

.result-board b {
  color: var(--blue);
}

.stage-panel {
  padding: 0;
  overflow: hidden;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 650px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 250, 241, 0.6), rgba(255, 250, 241, 0.24)),
    radial-gradient(ellipse at center bottom, rgba(63, 184, 154, 0.32), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(246, 213, 194, 0.36));
  overflow: hidden;
}

.stage::before {
  content: "";
  position: absolute;
  inset: auto 9% 14px;
  height: 18px;
  border-radius: 50%;
  background: rgba(37, 35, 31, 0.18);
  filter: blur(11px);
}

.stage.drop-ready {
  outline: 3px solid rgba(63, 184, 154, 0.55);
  outline-offset: -8px;
}

.reaction-bubble {
  position: absolute;
  top: 34px;
  left: 50%;
  z-index: 5;
  max-width: min(360px, 80%);
  padding: 11px 15px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: 5px 5px 0 var(--gold);
  transform: translateX(-50%);
  font-weight: 700;
  text-align: center;
}

.sound-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 28;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(37, 35, 31, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.64);
  backdrop-filter: blur(10px);
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(37, 35, 31, 0.12);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.sound-toggle:hover {
  border-color: rgba(37, 35, 31, 0.28);
  background: rgba(255, 250, 241, 0.9);
  transform: translateY(-1px);
}

.sound-toggle:active {
  transform: translateY(1px);
}

.sound-toggle:not(.is-muted) {
  color: var(--blue);
}

.sound-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-wave,
.sound-slash {
  fill: none;
}

.sound-toggle.is-muted .sound-wave {
  opacity: 0;
}

.sound-toggle:not(.is-muted) .sound-slash {
  opacity: 0;
}

.character {
  position: relative;
  z-index: 2;
  width: min(74%, 470px);
  height: min(82%, 560px);
  min-height: 420px;
  filter: drop-shadow(0 26px 22px rgba(37, 35, 31, 0.22));
  user-select: none;
  pointer-events: auto;
}

.live2d-canvas,
.feedback-canvas,
.character-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.live2d-canvas {
  display: block;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.feedback-canvas {
  z-index: 3;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.character.feedback-active .feedback-canvas {
  opacity: 1;
}

.character.feedback-active .live2d-canvas {
  opacity: 0;
}

.character-fallback {
  object-fit: contain;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.live2d-status {
  position: absolute;
  left: 50%;
  bottom: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 6px;
  background: rgba(255, 250, 241, 0.78);
  color: rgba(37, 35, 31, 0.72);
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.character.live2d-ready .live2d-canvas {
  opacity: 1;
}

.character.live2d-ready.feedback-active .live2d-canvas {
  opacity: 0;
}

.character.live2d-ready .character-fallback,
.character.live2d-ready .live2d-status {
  opacity: 0;
  visibility: hidden;
}

.character.live2d-error .character-fallback {
  opacity: 1;
  visibility: visible;
}

.character.live2d-error .live2d-status {
  color: #a74239;
}

.interaction-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 32;
  display: none;
  width: 86px;
  height: 86px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  will-change: transform;
  filter: drop-shadow(0 5px 5px rgba(37, 35, 31, 0.18));
}

.stage.hand-cursor-active {
  cursor: none;
}

.stage.hand-cursor-active .sound-toggle,
.stage.hand-cursor-active .focus-mode-toggle {
  cursor: pointer;
}

.interaction-cursor.visible {
  display: block;
}

.interaction-cursor.pat-mode {
  transform: translate(-50%, -64%) rotate(-5deg);
}

.interaction-cursor.poke-mode {
  transform: translate(-18%, -20%);
}

.hotspot {
  position: absolute;
  z-index: 4;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  pointer-events: none;
}

.hotspot:hover {
  border-color: rgba(37, 35, 31, 0.22);
  background: rgba(255, 250, 241, 0.22);
}

.hair {
  top: 16%;
  left: 35%;
  width: 30%;
  height: 20%;
}

.face {
  top: 30%;
  left: 39%;
  width: 22%;
  height: 15%;
}

.hand {
  top: 45%;
  left: 24%;
  width: 52%;
  height: 18%;
}

.body {
  top: 58%;
  left: 35%;
  width: 30%;
  height: 24%;
}

.focus-mode-toggle {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 28;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(37, 35, 31, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.64);
  backdrop-filter: blur(10px);
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(37, 35, 31, 0.12);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.focus-mode-toggle:hover {
  border-color: rgba(37, 35, 31, 0.28);
  background: rgba(255, 250, 241, 0.9);
  transform: translateY(-1px);
}

.focus-mode-toggle:active {
  transform: translateY(1px);
}

.focus-icon {
  position: relative;
  display: block;
  width: 21px;
  height: 21px;
}

.focus-icon i {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: currentColor;
  border-style: solid;
}

.focus-icon i:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
}

.focus-icon i:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
}

.focus-icon i:nth-child(3) {
  right: 0;
  bottom: 0;
  border-width: 0 2px 2px 0;
}

.focus-icon i:nth-child(4) {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
}

body.focus-mode {
  overflow: hidden;
}

body.focus-mode .shell {
  width: 100vw;
  height: 100vh;
  padding: 0;
}

body.focus-mode .topbar,
body.focus-mode .announcement-bar,
body.focus-mode .claim-panel,
body.focus-mode .leaderboard-panel,
body.focus-mode .inventory-panel,
body.focus-mode .site-footer {
  display: none;
}

body.focus-mode .workspace {
  display: block;
  width: 100vw;
  height: 100vh;
  min-height: 0;
}

body.focus-mode .stage-panel {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.focus-mode .stage {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

body.focus-mode .character {
  width: min(58vw, 620px);
  height: 82vh;
  min-height: 0;
}

body.focus-mode .reaction-bubble {
  top: 28px;
}

body.focus-mode .focus-mode-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  background: rgba(255, 250, 241, 0.78);
}

body.focus-mode .focus-icon i:nth-child(1) {
  top: 6px;
  left: 6px;
}

body.focus-mode .focus-icon i:nth-child(2) {
  top: 6px;
  right: 6px;
}

body.focus-mode .focus-icon i:nth-child(3) {
  right: 6px;
  bottom: 6px;
}

body.focus-mode .focus-icon i:nth-child(4) {
  bottom: 6px;
  left: 6px;
}

.status-panel {
  position: relative;
  display: grid;
  align-content: start;
  gap: 16px;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow-y: auto;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  overscroll-behavior: contain;
  scrollbar-color: rgba(37, 35, 31, 0.34) rgba(255, 250, 241, 0.18);
  scrollbar-width: thin;
}

.leaderboard-list::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: rgba(255, 250, 241, 0.18);
  border-radius: 999px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: rgba(37, 35, 31, 0.34);
  border-radius: 999px;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 24px 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
}

.leaderboard-list .leaderboard-empty {
  display: grid;
  place-items: center;
  min-height: 88px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

.lamp-status div {
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}

.lamp-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lamp-status strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.rank {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.leaderboard-list li:nth-child(1) .rank {
  color: var(--gold);
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 50%;
  background: hsl(var(--avatar-hue) 64% 72%);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.player-name {
  min-width: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name:hover {
  color: var(--coral);
}

.leaderboard-list strong {
  color: var(--muted);
  font-size: 15px;
}

.profile-popover {
  position: absolute;
  z-index: 120;
  display: grid;
  gap: 7px;
  width: 184px;
  padding: 12px;
  border: 1px solid rgba(37, 35, 31, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.98);
  box-shadow: 0 16px 38px rgba(47, 36, 25, 0.18);
}

.profile-popover[hidden] {
  display: none;
}

.profile-popover strong {
  font-size: 15px;
}

.profile-popover span {
  color: var(--muted);
  font-size: 12px;
}

.profile-popover button {
  height: 34px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff8ed;
  cursor: pointer;
}

.my-rank {
  display: grid;
  grid-template-columns: 24px 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid rgba(37, 35, 31, 0.2);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.38);
}

.self-avatar {
  --avatar-hue: 38;
}

.self-name {
  cursor: default;
  pointer-events: none;
}

.my-rank strong {
  color: var(--coral);
  font-size: 15px;
}

.inventory-panel {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  min-height: 138px;
  margin-top: 18px;
  padding: 16px 18px;
  background: rgba(255, 250, 241, 0.18);
  border-color: rgba(37, 35, 31, 0.08);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.gift-rail {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: 10px;
}

.gift-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 92px;
  padding: 9px;
  border: 1px dashed rgba(37, 35, 31, 0.22);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.34);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.gift-slot.filled {
  border-style: solid;
  border-color: rgba(37, 35, 31, 0.72);
  background: #fffaf1;
  cursor: grab;
}

.gift-slot.filled:hover:not(.disabled) {
  transform: translateY(-3px);
  box-shadow: 5px 5px 0 rgba(37, 35, 31, 0.88);
}

.gift-slot.disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: grayscale(0.6);
}

.empty-slot-mark {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(37, 35, 31, 0.16);
  border-radius: 50%;
  opacity: 0.55;
}

.gift-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--gift-color);
  color: #fff8ed;
  font-size: 20px;
  font-weight: 900;
}

.gift-icon.has-image {
  border-radius: 0;
  background: transparent;
}

.gift-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.gift-slot h3 {
  margin: 0 0 8px;
  font-size: 14px;
  text-align: center;
}

.gift-slot p {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.gift-count {
  position: absolute;
  right: 7px;
  top: 7px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff8ed;
  font-size: 12px;
  font-weight: 800;
}

.site-footer {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-top: 18px;
  padding: 14px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
}

.footer-link-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 20px;
}

.footer-links a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
  transition: color 0.16s ease;
}

.footer-links a:hover {
  color: var(--ink);
}

.footer-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.footer-icon img {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.footer-actions a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.footer-actions a:hover {
  color: var(--ink);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(37, 35, 31, 0.28);
  backdrop-filter: blur(8px);
}

.modal-layer[hidden],
.modal-sheet[hidden] {
  display: none;
}

.modal-sheet {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(37, 35, 31, 0.14);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: 0 24px 70px rgba(47, 36, 25, 0.22);
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(37, 35, 31, 0.72);
  border-radius: 0;
  background: #fff5df;
  box-shadow:
    3px 3px 0 rgba(37, 35, 31, 0.22),
    inset -3px -3px 0 rgba(242, 107, 94, 0.18),
    inset 3px 3px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  image-rendering: pixelated;
  transition: transform 0.08s steps(1), box-shadow 0.08s steps(1), background 0.08s steps(1);
}

.modal-close:hover {
  background: #ffe2dc;
}

.modal-close:active {
  transform: translate(2px, 2px);
  box-shadow:
    1px 1px 0 rgba(37, 35, 31, 0.22),
    inset -3px -3px 0 rgba(242, 107, 94, 0.18),
    inset 3px 3px 0 rgba(255, 255, 255, 0.8);
}

.contributors-sheet {
  width: min(720px, calc(100vw - 32px));
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.96), rgba(239, 249, 244, 0.94)),
    rgba(255, 250, 241, 0.96);
}

.contributors-head {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 2px 48px 20px 2px;
  border-bottom: 1px solid rgba(37, 35, 31, 0.1);
}

.contributors-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 2px solid rgba(255, 250, 241, 0.92);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), #6dcbb3);
  color: #fffaf1;
  box-shadow: 0 12px 26px rgba(63, 184, 154, 0.22);
  font-size: 25px;
  font-weight: 900;
}

.contributors-head h2 {
  margin: 0;
  font-size: 24px;
}

.contributors-head p {
  max-width: 540px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.contributors-head strong {
  display: inline-block;
  margin-top: 9px;
  color: var(--blue);
  font-size: 12px;
}

.contributors-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-height: 300px;
  margin-top: 18px;
  padding: 2px 10px 2px 2px;
  overflow-y: auto;
  scrollbar-color: rgba(63, 184, 154, 0.68) rgba(37, 35, 31, 0.06);
  scrollbar-width: thin;
}

.contributors-grid::-webkit-scrollbar {
  width: 7px;
}

.contributors-grid::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(37, 35, 31, 0.06);
}

.contributors-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(63, 184, 154, 0.68);
}

.contributors-grid:focus-visible {
  outline: 2px solid rgba(63, 184, 154, 0.68);
  outline-offset: 4px;
}

.contributors-grid div {
  display: grid;
  justify-items: center;
  min-width: 0;
  min-height: 132px;
  padding: 14px 8px 12px;
  border: 1px solid rgba(37, 35, 31, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
  text-align: center;
}

.contributors-grid div:nth-child(4n + 2) span {
  background: linear-gradient(135deg, #e7b33d, #f1cb72);
}

.contributors-grid div:nth-child(4n + 3) span {
  background: linear-gradient(135deg, #f07d70, #f5aaa1);
}

.contributors-grid div:nth-child(4n) span {
  background: linear-gradient(135deg, #6599d8, #91b8e7);
}

.contributors-grid span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 3px solid rgba(255, 250, 241, 0.9);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), #78cdb8);
  color: #fffaf1;
  box-shadow: 0 8px 18px rgba(37, 35, 31, 0.12);
  font-size: 21px;
  font-weight: 900;
}

.contributors-grid span img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.contributors-grid b {
  max-width: 100%;
  margin-top: 9px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contributors-grid small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.about-sheet {
  width: min(720px, calc(100vw - 32px));
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.97), rgba(242, 249, 246, 0.95)),
    rgba(255, 250, 241, 0.96);
}

.about-head {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 2px 48px 18px 2px;
  border-bottom: 1px solid rgba(37, 35, 31, 0.1);
}

.about-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255, 250, 241, 0.92);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #f0c86c);
  color: #fffaf1;
  box-shadow: 0 12px 26px rgba(230, 173, 57, 0.22);
  font-size: 24px;
  font-weight: 900;
}

.about-head h2 {
  margin: 0;
  font-size: 24px;
}

.about-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.about-content {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.about-content p {
  margin: 0;
  color: rgba(37, 35, 31, 0.78);
  font-size: 13px;
  line-height: 1.85;
}

.authorization-shot {
  margin: 18px 0 0;
  padding: 10px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

.authorization-shot img {
  display: block;
  width: 100%;
  height: 230px;
  border-radius: 6px;
  object-fit: cover;
  object-position: center;
}

.authorization-shot figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.profile-sheet {
  width: min(900px, calc(100vw - 32px));
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.94), rgba(239, 249, 244, 0.9)),
    rgba(255, 250, 241, 0.92);
}

.profile-cover {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  min-height: 190px;
  padding: 22px 56px 22px 22px;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 8px;
  background:
    var(--profile-default-cover-image, url("assets/profile-pigniu-id-photo-v1.png")) right 12px top -28px / 292px auto no-repeat,
    #fee3e4;
  overflow: hidden;
}

.profile-cover.has-custom-cover {
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.9), rgba(255, 250, 241, 0.36)),
    var(--profile-cover-image) center / cover no-repeat,
    #fee3e4;
}

.profile-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.profile-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 3px solid rgba(255, 250, 241, 0.9);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), #74cdb6);
  color: #fff8ed;
  box-shadow: 0 14px 34px rgba(63, 184, 154, 0.28);
  font-size: 30px;
  font-weight: 900;
}

.profile-identity {
  min-width: 0;
}

.profile-id {
  display: inline-flex;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.profile-identity h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.profile-identity p {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.profile-tags span {
  padding: 5px 9px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.68);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.profile-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.profile-actions button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(37, 35, 31, 0.14);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.64);
  cursor: pointer;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.profile-actions button:hover {
  border-color: rgba(37, 35, 31, 0.24);
  background: rgba(255, 250, 241, 0.94);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.profile-stats div {
  min-height: 82px;
  padding: 13px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.38);
}

.profile-stats span,
.profile-log span,
.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-stats strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
}

.profile-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.profile-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.profile-section {
  padding: 16px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 17px;
}

.medal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-height: 248px;
  padding: 2px 10px 2px 2px;
  overflow-y: auto;
  scrollbar-color: rgba(230, 173, 57, 0.68) rgba(37, 35, 31, 0.06);
  scrollbar-width: thin;
}

.medal-grid::-webkit-scrollbar {
  width: 7px;
}

.medal-grid::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(37, 35, 31, 0.06);
}

.medal-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(230, 173, 57, 0.68);
}

.medal-grid:focus-visible {
  outline: 2px solid rgba(230, 173, 57, 0.72);
  outline-offset: 4px;
}

.medal-grid span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(230, 173, 57, 0.18);
  font-size: 13px;
  font-weight: 800;
}

.medal-grid b {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(230, 173, 57, 0.32);
  color: #795719;
  font-size: 12px;
}

.medal-grid b.medal-image {
  overflow: hidden;
}

.medal-grid b.medal-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.medal-grid .locked {
  background: rgba(255, 255, 255, 0.24);
  color: var(--muted);
}

.medal-grid .locked b {
  background: rgba(37, 35, 31, 0.08);
  color: var(--muted);
}

.medal-grid .profile-empty {
  grid-column: 1 / -1;
  justify-content: center;
  background: rgba(255, 255, 255, 0.24);
  color: var(--muted);
}

.profile-log {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-log li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(37, 35, 31, 0.08);
}

.profile-log li:last-child {
  border-bottom: 0;
}

.profile-log b {
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.profile-log .profile-empty {
  display: block;
  color: var(--muted);
  text-align: center;
}

.auth-sheet {
  width: min(880px, calc(100vw - 32px));
  min-height: 560px;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.06) 0%, rgba(255, 250, 241, 0.08) 54%, rgba(255, 250, 241, 0.94) 72%, rgba(255, 250, 241, 0.98) 100%),
    url("assets/auth-pixel-scene-v1.png") center / cover no-repeat;
}

.settings-sheet {
  width: min(760px, calc(100vw - 32px));
}

.display-settings-sheet {
  width: min(560px, calc(100vw - 32px));
}

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

.display-preference {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 72px;
  padding: 11px 14px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.54);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.display-preference:hover {
  border-color: rgba(63, 184, 154, 0.34);
  background: rgba(255, 250, 241, 0.88);
}

.preference-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fffaf1;
  font-size: 16px;
  font-weight: 900;
}

.gacha-symbol {
  background: var(--coral);
}

.rank-symbol {
  background: var(--blue);
}

.preference-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.preference-copy strong {
  font-size: 15px;
}

.preference-copy small,
.display-settings-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.switch-control {
  position: relative;
  display: block;
  width: 46px;
  height: 26px;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(37, 35, 31, 0.16);
  border-radius: 999px;
  background: rgba(37, 35, 31, 0.1);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fffaf1;
  box-shadow: 0 2px 5px rgba(47, 36, 25, 0.22);
  transition: transform 0.2s cubic-bezier(0.22, 0.8, 0.22, 1);
}

.switch-control input:checked + .switch-track {
  border-color: rgba(63, 184, 154, 0.62);
  background: var(--mint);
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 2px solid rgba(72, 111, 159, 0.72);
  outline-offset: 3px;
}

.display-settings-note {
  margin: -2px 2px 0;
}

.auth-form {
  display: grid;
  gap: 15px;
  width: min(340px, 100%);
  margin: 0 0 0 auto;
  padding: 18px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.82);
  box-shadow: 0 16px 34px rgba(47, 36, 25, 0.12);
  backdrop-filter: blur(6px);
}

.settings-form {
  display: grid;
  gap: 15px;
}

.profile-edit-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.avatar-editor {
  display: grid;
  justify-items: center;
  padding: 16px;
  border: 1px solid rgba(37, 35, 31, 0.09);
  border-radius: 8px;
  background: rgba(254, 227, 228, 0.42);
}

.avatar-editor-title {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.avatar-editor-title strong {
  font-size: 15px;
}

.avatar-editor-title span {
  color: var(--muted);
  font-size: 11px;
}

.avatar-crop-stage {
  position: relative;
  width: 210px;
  height: 210px;
  overflow: hidden;
  border: 3px solid rgba(255, 250, 241, 0.96);
  border-radius: 50%;
  background:
    linear-gradient(45deg, rgba(37, 35, 31, 0.04) 25%, transparent 25% 75%, rgba(37, 35, 31, 0.04) 75%),
    linear-gradient(45deg, rgba(37, 35, 31, 0.04) 25%, rgba(255, 255, 255, 0.42) 25% 75%, rgba(37, 35, 31, 0.04) 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  box-shadow:
    0 0 0 1px rgba(37, 35, 31, 0.14),
    0 12px 28px rgba(47, 36, 25, 0.12);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.avatar-crop-stage:active {
  cursor: grabbing;
}

.avatar-crop-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  pointer-events: none;
  user-select: none;
  will-change: width, height, transform;
}

.avatar-crop-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--mint), #74cdb6);
  color: #fffaf1;
  font-size: 58px;
  font-weight: 900;
}

.avatar-crop-empty[hidden] {
  display: none;
}

.avatar-crop-guide {
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(255, 255, 255, 0.84);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(37, 35, 31, 0.12);
  pointer-events: none;
}

.avatar-upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
}

.avatar-upload-actions button {
  height: 38px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.avatar-upload-button {
  border: 1px solid rgba(63, 184, 154, 0.42);
  background: rgba(224, 247, 239, 0.8);
  color: #247c65;
}

.avatar-remove-button {
  border: 1px solid rgba(37, 35, 31, 0.12);
  background: rgba(255, 250, 241, 0.68);
  color: var(--muted);
}

.avatar-zoom-control {
  width: 100%;
  margin-top: 14px;
}

.settings-form .avatar-zoom-control {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.settings-form .avatar-zoom-control input {
  width: 100%;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--mint);
}

.settings-form .avatar-zoom-control input:focus {
  box-shadow: none;
}

.avatar-editor-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.profile-fields {
  display: grid;
  gap: 15px;
}

.cover-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
}

.cover-editor-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.cover-editor-title strong {
  font-size: 13px;
}

.cover-editor-title span {
  color: var(--muted);
  font-size: 11px;
}

.cover-preview {
  position: relative;
  min-height: 98px;
  aspect-ratio: 10 / 3;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 7px;
  background:
    var(--profile-default-cover-image, url("assets/profile-pigniu-id-photo-v1.png")) center / cover no-repeat,
    #fee3e4;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.cover-preview.has-custom-cover {
  background:
    var(--profile-cover-image) center / cover no-repeat,
    #fee3e4;
}

.cover-preview:active {
  cursor: grabbing;
}

.cover-preview img {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  max-width: none;
  transform-origin: center;
  pointer-events: none;
}

.cover-preview img[hidden] {
  display: none;
}

.cover-crop-guide {
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.88);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(37, 35, 31, 0.12),
    0 0 0 999px rgba(37, 35, 31, 0.06);
  pointer-events: none;
}

.settings-form .profile-visibility-setting {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 35, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
  cursor: pointer;
}

.settings-form .profile-visibility-setting input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--mint);
}

.profile-visibility-setting span {
  display: grid;
  gap: 3px;
  color: var(--ink);
}

.profile-visibility-setting small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.auth-form[hidden] {
  display: none;
}

.auth-hero {
  position: relative;
  display: block;
  align-items: center;
  margin: -2px 0 4px;
  padding: 0 34px 14px 0;
  border-bottom: 1px solid rgba(37, 35, 31, 0.08);
}

.auth-hero::before,
.auth-hero::after {
  content: none;
}

.auth-hero::before {
  left: 18px;
}

.auth-hero::after {
  left: 42px;
  background: rgba(242, 107, 94, 0.16);
}

.auth-mascot {
  display: none;
}

.auth-form h2 {
  margin-bottom: 5px;
  font-size: 22px;
}

.auth-hero p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: -2px 36px 4px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(37, 35, 31, 0.08);
}

.settings-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--mint);
  color: #fff8ed;
  font-size: 20px;
  font-weight: 900;
}

.settings-mark.lock-mark {
  background: var(--blue);
}

.settings-head h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.settings-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-form label,
.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-form input,
.settings-form input,
.settings-form textarea {
  height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.settings-form textarea {
  min-height: 88px;
  padding-top: 11px;
  resize: vertical;
  line-height: 1.6;
}

.auth-form input:focus,
.settings-form input:focus,
.settings-form textarea:focus {
  border-color: rgba(63, 184, 154, 0.7);
  box-shadow: 0 0 0 3px rgba(63, 184, 154, 0.14);
}

.form-submit {
  height: 46px;
  margin-top: 2px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ink), #315f83);
  color: #fff8ed;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(37, 35, 31, 0.16);
}

.form-submit:hover {
  filter: brightness(1.04);
}

.form-submit:disabled,
.auth-form button:disabled {
  cursor: wait;
  filter: none;
  opacity: 0.62;
}

.auth-form[aria-busy="true"] input {
  background: rgba(245, 242, 235, 0.74);
}

.settings-form[aria-busy="true"] input,
.settings-form[aria-busy="true"] textarea {
  background: rgba(245, 242, 235, 0.74);
}

.profile-sheet[aria-busy="true"] {
  cursor: wait;
  opacity: 0.76;
}

.settings-actions {
  display: grid;
  grid-template-columns: 0.8fr 1fr;
  gap: 10px;
}

.ghost-submit {
  height: 46px;
  margin-top: 2px;
  border: 1px solid rgba(37, 35, 31, 0.12);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.68);
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.ghost-submit:hover {
  border-color: rgba(37, 35, 31, 0.22);
  color: var(--ink);
}

.form-message {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.form-message.success {
  color: var(--mint);
}

.auth-message:empty {
  display: none;
}

.auth-switch {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-switch button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

body.logged-out .user-dropdown {
  display: none;
}

@keyframes idle {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-7px) scale(1.01);
  }
}

@keyframes gachaShake {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }
  18% {
    transform: translateX(-5px) rotate(-1.4deg);
  }
  36% {
    transform: translateX(5px) rotate(1.4deg);
  }
  54% {
    transform: translateX(-3px) rotate(-0.8deg);
  }
  72% {
    transform: translateX(3px) rotate(0.8deg);
  }
}

@keyframes announcementScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes knobTurn {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(720deg);
  }
}

@keyframes capsuleFloat {
  0%,
  100% {
    transform: translateY(0) rotate(var(--spin));
  }
  50% {
    transform: translateY(-8px) rotate(calc(var(--spin) + 8deg));
  }
}

@keyframes prizePop {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.42);
  }
  70% {
    opacity: 1;
    transform: translateY(4px) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-16px);
  }
}

@media (max-width: 1100px) {
  .shell {
    width: min(100% - 24px, 920px);
  }

  .workspace,
  .inventory-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .workspace {
    min-height: 0;
  }

  .stage {
    min-height: 540px;
  }

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

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

  .profile-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 16px, 560px);
    padding-top: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .top-actions {
    position: static;
    transform: none;
  }

  .game-repository-entry {
    justify-self: stretch;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  .avatar-button,
  .user-menu {
    width: 100%;
  }

  .avatar-button {
    justify-content: space-between;
  }

  .panel,
  .inventory-panel {
    padding: 13px;
  }

  .user-dropdown {
    left: 0;
    right: 0;
  }

  .stage {
    min-height: 460px;
  }

  .character {
    width: 92%;
    height: 420px;
    min-height: 0;
  }

  body.focus-mode .character {
    width: min(86vw, 520px);
    height: 78vh;
  }

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

  .modal-layer {
    padding: 12px;
  }

  .profile-sheet {
    width: calc(100vw - 24px);
    padding: 12px;
  }

  .contributors-sheet {
    width: calc(100vw - 24px);
    padding: 18px 14px 14px;
  }

  .about-sheet {
    width: calc(100vw - 24px);
    padding: 18px 14px 14px;
  }

  .settings-sheet {
    width: calc(100vw - 24px);
  }

  .profile-edit-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .avatar-editor {
    width: min(100%, 300px);
    justify-self: center;
  }

  .contributors-head {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    padding-right: 38px;
  }

  .contributors-mark {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }

  .contributors-head h2 {
    font-size: 21px;
  }

  .contributors-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: min(360px, 48vh);
  }

  .contributors-grid div {
    min-height: 122px;
    padding-inline: 5px;
  }

  .contributors-grid span {
    width: 52px;
    height: 52px;
  }

  .about-head {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    padding-right: 38px;
  }

  .about-mark {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }

  .about-head h2 {
    font-size: 21px;
  }

  .authorization-shot img {
    height: 190px;
  }

  .profile-cover {
    grid-template-columns: 1fr;
    padding: 18px 44px 18px 16px;
  }

  .profile-head {
    align-items: flex-start;
  }

  .profile-avatar {
    width: 58px;
    height: 58px;
    font-size: 23px;
  }

  .profile-identity h2 {
    font-size: 21px;
  }

  .profile-actions {
    justify-content: flex-start;
  }

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

  .profile-log li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .auth-sheet {
    min-height: 0;
    padding-top: 180px;
    background:
      linear-gradient(180deg, rgba(255, 250, 241, 0.04) 0%, rgba(255, 250, 241, 0.18) 42%, rgba(255, 250, 241, 0.98) 68%),
      url("assets/auth-pixel-scene-v1.png") 26% top / auto 260px no-repeat,
      rgba(255, 250, 241, 0.96);
  }

  .auth-form {
    width: 100%;
    margin: 0;
    background: rgba(255, 250, 241, 0.9);
  }

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