:root {
  color-scheme: light;
  --blue: #27a9f2;
  --blue-deep: #118fdb;
  --orange: #ff9d25;
  --orange-deep: #f08a08;
  --ink: #222;
  --muted: #8b8f98;
  --line: #e8e9ee;
  --panel: #fff;
  --shadow: 0 12px 34px rgba(0, 82, 145, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #ecf4fb;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #ecf4fb;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.phone-shell {
  width: min(100vw, 590px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--blue);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 30px rgba(6, 62, 102, 0.16);
}

.app {
  padding: 10px 18px 116px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.home-ad {
  position: relative;
  margin: -10px -18px 18px;
  background: #0c2a63;
  overflow: hidden;
}

.home-ad img {
  display: block;
  width: 100%;
  aspect-ratio: 1024 / 768;
  object-fit: cover;
}

.music-toggle {
  position: absolute;
  top: 27px;
  left: 25px;
  width: 47px;
  height: 47px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(9, 32, 74, 0.78);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(247, 207, 95, 0.45),
    0 3px 12px rgba(0, 0, 0, 0.28);
  z-index: 2;
}

.music-icon {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: inherit;
}

.music-icon svg {
  width: 100%;
  height: 100%;
}

.music-off {
  opacity: 0.9;
}

.music-toggle .music-on {
  display: none;
}

.music-toggle .music-off {
  display: block;
}

.music-toggle.playing .music-on {
  display: block;
}

.music-toggle.playing .music-off {
  display: none;
}

.music-toggle.playing {
  animation: music-pulse 2.2s ease-in-out infinite;
}

@keyframes music-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.notice-card,
.panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.notice-card {
  padding: 16px 26px;
  color: #555;
  font-size: 16px;
  line-height: 1.8;
}

.notice-card p {
  margin: 0;
}

.notice-card strong {
  color: #424242;
  margin-right: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 26px 0 20px;
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
}

.stats div {
  min-width: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.42);
}

.stats div:last-child {
  border-right: 0;
}

.stats span,
.stats strong {
  display: block;
}

.stats span {
  font-size: 16px;
}

.stats strong {
  margin-top: 7px;
  font-size: 25px;
  font-weight: 500;
  color: #fff;
}

.search {
  height: 51px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  color: #fff;
  margin-bottom: 29px;
}

.search span {
  font-size: 34px;
  line-height: 1;
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 17px;
}

.search input::placeholder {
  color: rgba(255, 255, 255, 0.84);
}

.panel {
  padding: 27px;
}

.sort-tabs {
  height: 46px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #d7dae2;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 27px;
}

.sort-tabs button {
  border: 0;
  border-right: 1px solid #d7dae2;
  background: #fff;
  color: #777;
  font-size: 17px;
}

.sort-tabs button:last-child {
  border-right: 0;
}

.sort-tabs button.active {
  color: var(--orange-deep);
  background: #fffaf2;
  box-shadow: inset 0 0 0 1px var(--orange);
}

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

.pet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.pet-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f5f7f9;
}

.pet-no {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 58px;
  height: 48px;
  padding: 5px 16px 0 12px;
  border-bottom-right-radius: 26px;
  background: var(--orange);
  color: #fff;
  font-size: 26px;
  line-height: 1.25;
}

.pet-body {
  padding: 12px 12px 15px;
  text-align: center;
}

.pet-name {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
}

.pet-votes {
  margin: 8px 0 11px;
  color: var(--orange-deep);
  font-weight: 800;
  font-size: 27px;
}

.pet-votes span {
  font-size: 18px;
}

.vote-button,
.vote-confirm {
  border: 0;
  color: #0088a9;
  font-weight: 900;
  text-shadow: 0 1px 0 #fff6b5;
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.9) 0 14%, transparent 15%),
    linear-gradient(#ffe65b, #ffbd17);
  border: 3px solid #17485b;
  box-shadow:
    inset 0 -4px 0 #48c3d7,
    inset 0 3px 0 rgba(255, 255, 255, 0.62),
    0 2px 0 rgba(0, 0, 0, 0.12);
}

.vote-button {
  width: 100%;
  max-width: 205px;
  min-height: 38px;
  border-radius: 999px;
  font-size: 25px;
  line-height: 1;
}

.empty-note {
  color: #bbb;
  text-align: center;
  margin: 28px 0 0;
  font-size: 15px;
}

.comments-panel {
  margin-top: 54px;
  padding-top: 25px;
}

.comments-panel h2 {
  margin: 0 0 16px;
  font-size: 24px;
}

.comments-panel h2 span {
  display: inline-block;
  width: 4px;
  height: 30px;
  border-radius: 4px;
  margin-right: 12px;
  vertical-align: -6px;
  background: var(--orange);
}

.comments-panel small {
  color: #999;
  font-weight: 400;
}

.comments-panel article {
  padding: 12px 0;
  border-top: 1px dashed #ececec;
  color: #555;
}

.rank-hero {
  min-height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
}

.rules-heading-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #365260;
  place-items: center;
  color: #fff;
}

.rules-heading-icon svg {
  width: 22px;
  height: 22px;
}

.rank-title {
  width: min(100%, 305px);
  height: 84px;
  border-radius: 999px;
  background: linear-gradient(#ffbd6a, #ff8b2b);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 38px;
  font-weight: 900;
  text-shadow: 0 3px 0 #553525;
  border: 3px solid #7b4c24;
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.35);
}

.rank-hint {
  margin: 0 0 18px;
  text-align: center;
  color: #c3c3c3;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 22px;
}

.podium-card {
  text-align: center;
  min-width: 0;
}

.podium-card.top {
  transform: translateY(-14px);
}

.crown {
  height: 28px;
  color: var(--orange);
  font-weight: 900;
  font-size: 22px;
}

.podium-card img {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #f6d28a;
}

.podium-card:nth-child(1) img {
  border-color: #d6dce9;
}

.podium-card:nth-child(3) img {
  border-color: #d89b62;
}

.podium-card strong {
  display: block;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.podium-card span,
.rank-votes {
  color: var(--orange-deep);
  font-weight: 800;
}

.podium-card span {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rank-list li {
  display: grid;
  grid-template-columns: 74px 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  color: #555;
  font-size: 18px;
}

.rank-list img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

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

.rank-votes {
  justify-self: end;
}

.rules-panel {
  margin-top: 0;
  color: #444;
  font-size: 17px;
  line-height: 1.55;
}

.rules-panel h2 {
  margin: 0 0 18px;
  font-size: 25px;
}

.rule-block {
  padding: 18px 0;
  border-top: 1px dashed #e4e4e4;
}

.rule-block:first-of-type {
  border-top: 0;
}

.rule-block h3 {
  display: inline-block;
  margin: 0 0 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fff8ea;
  color: #111;
  font-size: 20px;
}

.rule-block p {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 4px 3px;
  text-align: left;
  font-weight: 400;
  vertical-align: top;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100vw, 590px);
  transform: translateX(-50%);
  height: 88px;
  background: rgba(255, 255, 255, 0.97);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  z-index: 30;
}

.bottom-nav button {
  min-width: 0;
  border: 0;
  background: transparent;
  color: #a2a2a2;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
}

.bottom-nav span {
  font-size: 34px;
  line-height: 1;
}

.bottom-nav small {
  font-size: 13px;
  white-space: nowrap;
}

.bottom-nav button.active {
  color: var(--orange-deep);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
}

.vote-dialog {
  width: min(100%, 462px);
  border-radius: 16px;
  background: #fff;
  padding: 34px 48px 32px;
  text-align: center;
  position: relative;
}

.vote-dialog h2 {
  margin: 0 0 25px;
  font-size: 26px;
}

.vote-dialog img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f6f7f8;
}

.close-modal {
  position: absolute;
  left: 50%;
  bottom: -86px;
  width: 52px;
  height: 52px;
  transform: translateX(-50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 36px;
  line-height: 1;
}

.vote-stepper {
  display: grid;
  grid-template-columns: 44px minmax(90px, 146px) 44px;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 22px 0 22px;
}

.vote-stepper button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #bfc3c8;
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.vote-stepper button:disabled,
.vote-confirm:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.vote-stepper input {
  width: 100%;
  height: 56px;
  border: 1px solid #e1e3e8;
  border-radius: 8px;
  text-align: center;
  font-size: 26px;
  color: #555;
}

.vote-confirm {
  width: 230px;
  max-width: 100%;
  min-height: 51px;
  border-radius: 999px;
  font-size: 28px;
}

#modal-help {
  margin: 22px 0 0;
  color: #b6b6b6;
  font-size: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 108px;
  transform: translate(-50%, 14px);
  width: max-content;
  max-width: min(500px, calc(100vw - 44px));
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(20, 29, 39, 0.9);
  color: #fff;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 70;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 420px) {
  .app {
    padding-inline: 13px;
  }

  .notice-card,
  .panel {
    border-radius: 12px;
  }

  .notice-card {
    padding: 13px 18px;
    font-size: 14px;
  }

  .stats {
    padding-top: 22px;
  }

  .stats span {
    font-size: 14px;
  }

  .stats strong {
    font-size: 21px;
  }

  .search {
    height: 47px;
    margin-bottom: 24px;
  }

  .panel {
    padding: 20px;
  }

  .pet-grid {
    gap: 17px;
  }

  .pet-no {
    min-width: 47px;
    height: 39px;
    font-size: 21px;
  }

  .pet-body {
    padding: 10px 8px 13px;
  }

  .pet-name {
    font-size: 18px;
  }

  .pet-votes {
    font-size: 24px;
  }

  .vote-button {
    min-height: 34px;
    font-size: 21px;
  }

  .vote-dialog {
    padding: 28px 34px 30px;
  }

  .rank-list li {
    grid-template-columns: 60px 38px minmax(0, 1fr) auto;
    font-size: 16px;
  }
}

@media (max-width: 340px) {
  .pet-grid {
    grid-template-columns: 1fr;
  }

  .sort-tabs button {
    font-size: 15px;
  }
}
