:root {
  --sky-top: #fde7f0;
  --sky-mid: #ffe9d2;
  --sky-bot: #fff6e8;
  --ink: #5a3d4a;
  --muted: #8a6a74;
  --card: #fffaf4;
  --line: #f3d5c8;
  --pink: #e58b8b;
  --shadow: #f6c9bc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  min-height: 100dvh;
  padding: clamp(1.1rem, 3.2vh, 2.2rem) clamp(0.7rem, 2vw, 1.4rem);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sky-bot);
}

.photo,
.wash,
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.photo {
  z-index: 0;
  background: url(/bg.jpg) center / cover no-repeat;
  opacity: 0.42;
}

.wash {
  z-index: 0;
  background: linear-gradient(180deg, rgba(253, 231, 240, 0.55), rgba(255, 246, 232, 0.62));
}

.sky {
  z-index: 0;
}

.star {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffd6e8;
  border-radius: 50%;
  box-shadow: 0 0 12px #ffd0e4;
}
.s1 { top: 10%; left: 12%; }
.s2 { top: 18%; right: 16%; width: 7px; height: 7px; }
.s3 { top: 7%; right: 34%; width: 6px; height: 6px; }

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 999px;
}
.c1 { width: 120px; height: 36px; top: 14%; left: 7%; }
.c1::before { width: 48px; height: 48px; top: -24px; left: 18px; }
.c1::after { width: 38px; height: 38px; top: -16px; left: 52px; }
.c2 { width: 90px; height: 28px; top: 24%; right: 8%; }
.c2::before { width: 36px; height: 36px; top: -18px; left: 14px; }
.c2::after { width: 28px; height: 28px; top: -12px; left: 42px; }

.topbar {
  position: sticky;
  top: 0.6rem;
  z-index: 6;
  width: min(96rem, 100%);
  margin: 0 auto 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.45rem 0.55rem 0.45rem 0.9rem;
  background: rgba(255, 250, 244, 0.85);
  border: 3px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 0 rgba(246, 201, 188, 0.75);
  backdrop-filter: blur(6px);
}

.links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.links a {
  padding: 0.32em 0.9em;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.links a:hover {
  color: var(--ink);
  background: #ffeee6;
}

.links a.active {
  color: #fff;
  background: var(--pink);
}

.account {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  display: block;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: url(/bg.jpg) center 30% / cover no-repeat;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 var(--line);
  cursor: pointer;
}

.menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 8.6rem;
  padding: 8px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: none;
  z-index: 8;
}

.account:hover .menu,
.account:focus-within .menu,
.account.open .menu {
  display: block;
}

.menu .panel {
  padding: 0.4rem;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 0 var(--shadow);
  display: grid;
  gap: 0.25rem;
}

.menu a,
.menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45em 0.7em;
  border-radius: 12px;
  cursor: pointer;
}

.menu a:hover,
.menu button:hover {
  background: #ffeee6;
}

.profile {
  width: min(96rem, 100%);
  margin: 1rem auto 0;
  position: relative;
  z-index: 1;
}

#achievements,
#profile {
  display: none;
}

#achievements:target,
#profile:target {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(90, 61, 74, 0.28);
  padding: 1rem;
}

.modal[hidden],
.profile[hidden] { display: none; }

.sheet {
  width: min(22rem, 100%);
  padding: 1.3rem 1.2rem 1.2rem;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 12px 0 var(--shadow);
  position: relative;
}

.sheet .close {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
}

.sheet form {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.sheet label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.sheet input {
  border: 2px solid var(--line);
  background: #fff6ee;
  color: var(--ink);
  font: inherit;
  padding: 0.5em 0.7em;
  border-radius: 14px;
}

.sheet .play { width: 100%; text-align: center; }
.sheet .lede { margin: 0.45em 0 0; max-width: none; font-size: 0.92rem; }
.sheet.register-mode #authSubmit { display: none; }
.qq-orb {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0.95rem auto 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 5px 0 #0a93c9;
  cursor: pointer;
  overflow: hidden;
}
.qq-orb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.qq-orb:hover { filter: brightness(1.05); }
.qq-orb:active { transform: translateY(2px); box-shadow: 0 3px 0 #0a93c9; }
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin: 0 0 0.8rem;
}
.tab {
  border: 0;
  background: #fff;
  color: var(--muted);
  font: inherit;
  padding: 0.4em 0.7em;
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
}
.tab.active {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 3px 0 #e06b66;
}
.sheet .ghost { margin-top: 0.7rem; width: 100%; }
.ghost {
  display: block;
  text-align: center;
  padding: 0.55em 1.15em;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 4px 0 var(--line);
}
.err { color: #d36b6b; font-size: 0.82rem; }

#home,
#adventure,
#quests,
#about,
#achievements,
#profile {
  scroll-margin-top: 5rem;
}

.layout {
  position: relative;
  z-index: 1;
  width: min(96rem, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  grid-template-areas:
    "welcome music"
    "server server";
  gap: 1rem;
}

.tile {
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 32px;
  box-shadow: 0 12px 0 var(--shadow);
  padding: 1.45rem 1.4rem 1.35rem;
}

.welcome {
  grid-area: welcome;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 16rem;
  gap: 1rem;
}

.fortune {
  width: 100%;
}

.fortune-row {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  margin-top: 0.55rem;
}

.fortune .play {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  min-width: 7.2rem;
}

.slip {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.85rem 1rem;
  background: #fff6ee;
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.slip .rank {
  color: var(--pink);
  letter-spacing: 0.18em;
  font-size: 0.82rem;
}

.slip .omen {
  margin-top: 0.3em;
  line-height: 1.7;
}

.music { grid-area: music; }
.server { grid-area: server; }

.kicker {
  color: var(--pink);
  font-size: 0.82rem;
  letter-spacing: 0.24em;
}

h1, h2 { font-weight: 700; }

h1 {
  font-size: clamp(1.9rem, 1.2rem + 2.2vw, 3rem);
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.deck {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.vinyl-wrap {
  flex-shrink: 0;
  width: 118px;
  height: 118px;
}

.vinyl {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #f7c4c4 0 14px, #2b2b2b 15px 22px, #111 23px 100%);
  box-shadow:
    0 8px 0 #e8c4ba,
    inset 0 0 0 14px rgba(255, 255, 255, 0.04),
    inset 0 0 0 28px rgba(0, 0, 0, 0.25),
    inset 0 0 0 42px rgba(255, 255, 255, 0.03),
    inset 0 0 0 56px rgba(0, 0, 0, 0.2);
  position: relative;
}

.vinyl .label {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe3ea, #e58b8b);
  box-shadow: inset 0 0 0 6px #f7c4c4;
}

.vinyl.spin { animation: spin 3.6s linear infinite; }

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

.now h2 {
  margin-top: 0.15em;
  font-size: 1.25rem;
}

.now p#artist {
  margin-top: 0.2em;
  color: var(--muted);
  font-size: 0.88rem;
}

.progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #f3d5c8;
  border-radius: 999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f28b82;
  border: 2px solid #fff;
  box-shadow: 0 2px 0 #e06b66;
  cursor: pointer;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.controls button {
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--line);
}

.controls .play {
  width: auto;
  padding: 0 1.15em;
  border-radius: 999px;
  background: #f28b82;
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 5px 0 #e06b66;
}

.vol {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  min-width: 9.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 1rem;
}

.picks label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.picks select {
  width: 100%;
  border: 2px solid var(--line);
  background: #fff6ee;
  color: var(--ink);
  font: inherit;
  padding: 0.5em 0.7em;
  border-radius: 14px;
}

.server h2 {
  margin: 0.25em 0 1rem;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.55rem);
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.facts div {
  padding: 0.9rem 0.85rem;
  background: #fff6ee;
  border: 2px solid var(--line);
  border-radius: 20px;
}

.facts b {
  display: block;
  color: var(--pink);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.facts span {
  display: block;
  margin-top: 0.35em;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "welcome"
      "music"
      "server";
  }
  .welcome { min-height: 0; }
  .fortune-row { flex-direction: column; align-items: stretch; }
  .fortune .play { align-self: flex-start; }
  .facts { grid-template-columns: 1fr 1fr; }
  .picks { grid-template-columns: 1fr; }
  .vol { margin-left: 0; width: 100%; }
}

.about {
  width: min(96rem, 100%);
  margin: 1.2rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

@media (prefers-reduced-motion: reduce) {
  .vinyl.spin { animation: none; }
}
