/* Andy Summer Adventure — Mario playground */
:root {
  --bg-color: #79ccff;
  --text-color: #2c3e50;
  --accent-color: #ff3333;
  --card-bg: #ffffff;
  --border-color: #2c3e50;
  --muted: #5d6d7e;
  --gold: #f1c40f;
  --green: #27ae60;
  --radius: 16px;
  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.12);
  --focus: 0 0 0 3px rgba(241, 196, 15, 0.75);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Comic Neue', 'Microsoft YaHei', cursive;
  color: var(--text-color);
  background-color: var(--bg-color);
  background-image:
    linear-gradient(180deg, #8fd4ff 0%, #79ccff 42%, #6bc4f5 100%),
    url('data:image/svg+xml,%3Csvg width="42" height="44" viewBox="0 0 42 44" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%23ffffff" fill-opacity="0.28"%3E%3Cpath d="M0 0h42v44H0V0zm1 1h40v20H1V1zM0 22h20v20H0V22zm22 0h20v20H22V22z"/%3E%3C/g%3E%3C/svg%3E');
  font-size: 1.15rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background:
    repeating-linear-gradient(90deg, #27ae60 0 18px, #219150 18px 36px),
    linear-gradient(#8b5a2b, #8b5a2b);
  background-size: auto, 100% 10px;
  background-position: top, bottom;
  background-repeat: repeat-x, no-repeat;
  z-index: 0;
  pointer-events: none;
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.clouds span {
  position: fixed;
  background: #fff;
  border-radius: 999px;
  opacity: 0.95;
  z-index: 0;
  animation: drift linear infinite;
  box-shadow: 30px 8px 0 -4px #fff, 55px 4px 0 -8px #fff;
}
.clouds span:nth-child(1) {
  width: 120px; height: 40px; top: 8%; left: -10%; animation-duration: 28s;
}
.clouds span:nth-child(2) {
  width: 80px; height: 28px; top: 18%; left: 30%; animation-duration: 36s;
}
.clouds span:nth-child(3) {
  width: 100px; height: 34px; top: 12%; left: 70%; animation-duration: 32s;
}
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(40vw); }
}

.shell {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.2rem 1.2rem max(3.4rem, calc(env(safe-area-inset-bottom) + 2.2rem));
  padding-left: max(1.2rem, env(safe-area-inset-left));
  padding-right: max(1.2rem, env(safe-area-inset-right));
  position: relative;
  z-index: 1;
}

.back-chip {
  display: inline-block;
  background: #fff;
  border: 3px solid var(--border-color);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 800;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, background 0.15s ease;
}
.back-chip:hover { background: #fff7d6; transform: translateY(-1px); }
.back-chip:focus-visible { outline: none; box-shadow: var(--shadow), var(--focus); }

.login-card, .ring-card, .quest, .mini {
  background: var(--card-bg);
  border: 3px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-card {
  padding: 1.35rem 1.2rem 1.25rem;
  margin-top: 0.85rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border-style: dashed;
  border-color: var(--accent-color);
  position: relative;
}
.login-card::before {
  content: '★';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--border-color);
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  line-height: 1;
  padding-top: 2px;
}
.mascot {
  font-size: 2.9rem;
  animation: bounce 1.4s ease infinite;
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.08));
}
@keyframes bounce {
  50% { transform: translateY(-7px); }
}
.kicker {
  color: var(--accent-color);
  font-weight: 800;
  margin: 0.15rem 0;
  letter-spacing: 0.04em;
}
.login-card h1 {
  font-family: 'Fredoka One', cursive;
  color: var(--accent-color);
  line-height: 1.25;
  margin: 0.25rem 0 0.55rem;
  font-size: clamp(1.45rem, 5vw, 1.8rem);
  text-wrap: balance;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.06);
}
.lede { color: var(--muted); margin: 0 0 1rem; font-weight: 700; }

.field-label {
  display: block;
  text-align: left;
  font-weight: 800;
  margin-bottom: 0.7rem;
}
.field, input[type='password'], input[type='text'] {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  border: 3px solid var(--border-color);
  font-family: inherit;
  font-size: 1.05rem;
  background: #fff;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.field:focus-visible,
input[type='password']:focus-visible,
input[type='text']:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-color: #d4a017;
}

.btn {
  border: 3px solid var(--border-color);
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--text-color);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
  transition: transform 0.12s ease, background 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1); }
.btn:focus-visible { outline: none; box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1), var(--focus); }
.btn.primary { background: var(--accent-color); color: #fff; }
.btn.camera { background: var(--gold); }
.btn.ghost { background: #fff; color: var(--accent-color); }
.btn.sm { padding: 0.3rem 0.55rem; font-size: 0.9rem; }
.btn.mega { width: 100%; padding: 1rem; font-size: 1.1rem; margin-top: 0.3rem; }
.btn.big-tap { min-height: 52px; font-size: 1.05rem; }
.btn.icon { width: 44px; height: 44px; font-size: 1.3rem; padding: 0; }
.btn.loading { opacity: 0.55; pointer-events: none; }

.tiny { color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.adv { margin-top: 0.85rem; text-align: left; color: var(--muted); }
.adv summary { cursor: pointer; font-weight: 800; }

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.5rem 0 1rem;
  gap: 0.75rem;
}
.hud-left { display: flex; gap: 0.65rem; align-items: center; min-width: 0; }
.avatar-badge {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: #fff;
  border: 3px solid var(--accent-color);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.who-line { font-size: 1.25rem; font-family: 'Fredoka One', cursive; }
.week-theme {
  color: var(--accent-color);
  font-weight: 800;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52vw;
}

.stat-row { display: grid; gap: 0.7rem; }
.ring-card {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 0.75rem;
  padding: 0.95rem;
  align-items: center;
  background: linear-gradient(180deg, #fff 0%, #fff9e8 100%);
}
.ring-wrap { position: relative; width: 120px; height: 120px; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #dfe6e9; stroke-width: 12; }
.ring-fg {
  fill: none;
  stroke: var(--gold);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 339;
  stroke-dashoffset: 339;
  transition: stroke-dashoffset 0.5s ease;
  filter: drop-shadow(0 0 3px rgba(241, 196, 15, 0.55));
}
.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
#ring-label {
  font-family: 'Fredoka One', cursive;
  font-size: 1.35rem;
  color: var(--accent-color);
  font-variant-numeric: tabular-nums;
}
#ring-sub { font-size: 0.78rem; color: var(--muted); font-weight: 800; }
.xp-top {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.xp-bar {
  height: 14px;
  background: #eee;
  border: 2px solid var(--border-color);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}
#xp-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f1c40f, #e67e22);
  transition: width 0.4s ease;
}
.next-hint {
  margin: 0.5rem 0 0;
  color: var(--accent-color);
  font-weight: 800;
  line-height: 1.35;
}

.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.mini { padding: 0.8rem; text-align: center; }
.mini-n {
  display: block;
  font-family: 'Fredoka One', cursive;
  font-size: 1.65rem;
  color: var(--accent-color);
  font-variant-numeric: tabular-nums;
}
.mini-l { font-weight: 800; color: var(--muted); }

.day-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  margin: 1rem 0 0.35rem;
}
.day-chip {
  border: 3px solid var(--border-color);
  background: var(--gold);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-weight: 900;
  font-family: inherit;
  box-shadow: var(--shadow);
  cursor: pointer;
  min-width: 7.5rem;
  transition: transform 0.12s ease;
}
.day-chip:hover { transform: translateY(-1px); }
.day-chip:focus-visible { outline: none; box-shadow: var(--shadow), var(--focus); }
.day-note {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 0.8rem;
  min-height: 1.2em;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}
.tab {
  border: 3px solid var(--border-color);
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.2rem;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--muted);
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.tab:hover { transform: translateY(-1px); }
.tab:focus-visible { outline: none; box-shadow: var(--shadow), var(--focus); }
.tab.active {
  background: var(--accent-color);
  color: #fff;
}
.tab-count {
  display: block;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.quest {
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  position: relative;
  transition: transform 0.12s ease, background 0.15s ease;
}
.quest:hover { transform: translateY(-1px); }
.quest.is-next {
  border-color: #d4a017;
  background: linear-gradient(180deg, #fffef5, #fff4c2);
  box-shadow: 5px 5px 0 rgba(241, 196, 15, 0.28);
}
.quest.is-next::before {
  content: '下一关!';
  position: absolute;
  top: -0.7rem;
  left: 0.8rem;
  background: var(--gold);
  border: 3px solid var(--border-color);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
}
.quest.is-done {
  background: #eafaf1;
  border-color: var(--green);
}
.quest-main {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0.6rem;
}
.quest-ico {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: #fff;
  border: 3px solid var(--border-color);
}
.quest-title-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; min-width: 0; }
.quest h3 {
  margin: 0;
  font-size: 1.12rem;
  font-family: 'Fredoka One', cursive;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.quest-desc {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.quest-steps {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #2980b9;
}
.quest-link {
  display: inline-block;
  margin-top: 0.4rem;
  color: #1f6f9f;
  font-weight: 800;
  text-decoration: none;
  border: 2px dashed var(--border-color);
  border-radius: 10px;
  padding: 0.25rem 0.55rem;
  background: #f8fbff;
  transition: background 0.15s ease, transform 0.12s ease;
}
.quest-link:hover { background: #eaf4ff; transform: translateY(-1px); }
.quest-link:focus-visible { outline: none; box-shadow: var(--focus); }
.quest-meta {
  margin: 0.3rem 0 0;
  color: var(--green);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.stamp {
  border: 3px solid var(--green);
  color: var(--green);
  border-radius: 10px;
  padding: 0.25rem 0.4rem;
  font-weight: 900;
  transform: rotate(10deg);
  font-family: 'Fredoka One', cursive;
  align-self: start;
}
.quest-actions { margin-top: 0.7rem; display: grid; gap: 0.5rem; }
.quest-panel { display: grid; gap: 0.5rem; }
.pill {
  background: #ffeaa7;
  border: 2px solid var(--border-color);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 800;
}
.thumbs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.35rem; }
.thumbs img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid var(--border-color);
}
.empty {
  text-align: center;
  padding: 1.5rem 1rem;
  font-weight: 800;
  color: var(--muted);
  border: 3px dashed var(--border-color);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}
.quick-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.quick-links a {
  color: var(--text-color);
  font-weight: 800;
  text-decoration: none;
  background: #fff;
  border: 3px solid var(--border-color);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, background 0.15s ease;
}
.quick-links a:hover { background: #fff7d6; transform: translateY(-1px); }
.quick-links a:focus-visible { outline: none; box-shadow: var(--shadow), var(--focus); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.4rem, calc(env(safe-area-inset-bottom) + 0.8rem));
  transform: translateX(-50%) translateY(12px);
  background: #fff;
  border: 3px solid var(--border-color);
  padding: 0.65rem 1.05rem;
  border-radius: 999px;
  font-weight: 900;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: var(--shadow);
  max-width: min(92vw, 28rem);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--accent-color); color: var(--accent-color); }

#fx-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 40;
}
.fx-bit {
  position: absolute;
  top: -12px;
  animation: fall 1.5s ease-in forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(200deg); opacity: 0; }
}

@media (max-width: 480px) {
  .ring-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .xp-block { width: 100%; }
  .login-card h1 { font-size: 1.4rem; }
  .week-theme { max-width: 58vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .mascot, .clouds span { animation: none; }
  .fx-bit { display: none; }
}
