:root {
  color-scheme: light;
  --teal: #008b84;
  --ink: #20372f;
  --muted: #66736d;
  --line: #e2e6e4;
  --panel: #ffffff;
  --cream: #f7f7f4;
  --gold: #f2c965;
  --shadow: 0 24px 54px rgba(18, 31, 27, .16);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--teal);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

.app-frame {
  width: min(100% - 14px, 1180px);
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  overflow: hidden;
  border-radius: 18px;
  background: var(--cream);
  box-shadow: var(--shadow);
  animation: appIn .28s var(--ease-out) both;
}

.topbar {
  display: grid;
  grid-template-columns: 118px 1fr 54px;
  align-items: center;
  gap: 10px;
  min-height: 98px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(32, 55, 47, .08);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.square-button,
.avatar-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--teal);
  font-size: 1.35rem;
  box-shadow: 0 3px 10px rgba(32, 55, 47, .06);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
}

.avatar-button {
  justify-self: end;
  border-radius: 999px;
  color: #111;
}

.avatar-button span,
.avatar-button span::before,
.avatar-button span::after {
  display: block;
  border: 3px solid currentColor;
}

.avatar-button span {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.avatar-button span::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 8px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.avatar-button span::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  height: 9px;
  border-radius: 999px 999px 0 0;
  border-bottom: 0;
}

.title-block {
  text-align: center;
}

.title-block h1 {
  margin: 0;
  color: #2e5b45;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1;
}

.title-block p {
  margin: 3px 0 0;
  color: #1f2a25;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.quest-view {
  min-height: calc(100vh - 218px);
  padding: 28px 0 30px;
  background:
    linear-gradient(180deg, #f6f6f3 0%, #f1f2f0 100%);
}

.progress-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 16px 18px;
}

.progress-strip div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  text-align: center;
}

.progress-strip strong,
.progress-strip span {
  display: block;
}

.progress-strip strong {
  font-size: 1.2rem;
}

.progress-strip span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
}

.quest-rail {
  overflow: hidden;
}

.quest-track {
  display: grid;
  grid-auto-columns: minmax(285px, 31vw);
  grid-auto-flow: column;
  gap: 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 18px 18px 44px;
  scrollbar-width: none;
}

.quest-track::-webkit-scrollbar {
  display: none;
}

.quest-card {
  min-height: 470px;
  scroll-snap-align: start;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(32, 55, 47, .13);
  animation: cardIn .34s var(--ease-out) var(--enter-delay, 0ms) backwards;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}

.quest-card:active {
  transform: scale(.985);
}

.quest-open {
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: left;
}

.card-image {
  position: relative;
  min-height: 285px;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: #e8ece8;
}

.card-image::before,
.card-image::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-image::before {
  background:
    radial-gradient(circle at 22% 18%, rgba(42, 118, 52, .5) 0 3px, transparent 4px),
    radial-gradient(circle at 34% 10%, rgba(67, 154, 60, .55) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 16%, rgba(42, 118, 52, .45) 0 4px, transparent 5px),
    radial-gradient(circle at 86% 22%, rgba(67, 154, 60, .5) 0 3px, transparent 4px),
    linear-gradient(90deg, transparent 0 32%, rgba(0, 0, 0, .08) 32% 33%, transparent 33% 66%, rgba(0, 0, 0, .08) 66% 67%, transparent 67%),
    linear-gradient(180deg, #fbfaf7, #ecebe7);
  background-size: 64px 64px, 84px 84px, 72px 72px, 92px 92px, 100% 100%, 100% 100%;
}

.card-image::after {
  inset: auto 20% 30px;
  height: 118px;
  border-radius: 24px 24px 12px 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, .08)), var(--card-color);
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, .07), 0 18px 30px rgba(0, 0, 0, .16);
}

.art-photo::before {
  background:
    radial-gradient(circle at 72% 52%, rgba(255, 255, 255, .9) 0 34px, transparent 35px),
    linear-gradient(126deg, transparent 0 46%, rgba(17, 24, 39, .95) 47% 66%, transparent 67%),
    linear-gradient(180deg, #f7f4ef, #e8e4dd);
}

.art-photo::after {
  inset: 45% 17% auto auto;
  width: 150px;
  height: 82px;
  border-radius: 18px;
  background: #17211d;
  box-shadow: inset 0 0 0 7px #2c3934, 0 16px 26px rgba(0, 0, 0, .18);
}

.card-icon,
.card-category {
  position: absolute;
  z-index: 2;
}

.card-icon {
  right: 18px;
  bottom: 74px;
  color: rgba(255, 255, 255, .9);
  font-size: 3.2rem;
  font-weight: 900;
}

.card-category {
  top: 14px;
  right: 14px;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  background: rgba(32, 55, 47, .46);
  color: #fff;
  font-size: 1.45rem;
  backdrop-filter: blur(6px);
}

.card-body {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 185px;
  padding: 44px 18px 20px;
  border-radius: 0 0 16px 16px;
  background: var(--card-color);
  color: #fff;
}

.stars {
  position: absolute;
  top: -22px;
  left: 50%;
  min-width: 88px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--gold);
  font-size: 1.22rem;
  letter-spacing: 1px;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 8px 20px rgba(32, 55, 47, .13);
}

.card-body h2 {
  min-height: 64px;
  margin: 0 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  line-height: 1.02;
}

.view-button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(255, 255, 255, .88);
  border-radius: 999px;
  color: #fff;
  font-size: 1rem;
  text-align: center;
}

.status-chip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 900;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 9px 18px 12px;
  background: #fff;
}

.nav-item {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 54px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: .72rem;
  font-weight: 800;
  transition: transform .18s var(--ease-out), background .18s var(--ease-out);
}

.nav-item span {
  font-size: 1.3rem;
}

.nav-item.is-active {
  background: #ededed;
}

.quest-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.quest-panel::backdrop {
  background: rgba(0, 0, 0, .18);
}

.quest-detail {
  width: min(100%, 520px);
  min-height: 100vh;
  margin-left: auto;
  overflow: hidden;
  background: #fff;
  box-shadow: -28px 0 70px rgba(0, 0, 0, .2);
  animation: panelIn .32s var(--ease-out) both;
}

.detail-hero {
  position: relative;
  display: grid;
  min-height: 260px;
  align-content: end;
  padding: 18px;
  color: #fff;
  background: var(--card-color);
}

.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .02), rgba(0, 0, 0, .35));
}

.detail-hero > * {
  position: relative;
  z-index: 1;
}

.back-button {
  position: absolute;
  top: 18px;
  left: 18px;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  font-size: 2rem;
}

.detail-icon {
  font-size: 4rem;
  font-weight: 900;
}

.detail-hero p,
.detail-hero h2 {
  margin: 0;
}

.detail-hero h2 {
  max-width: 420px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.guide-card {
  padding: 18px;
  border-radius: 18px;
  background: #f7f8f6;
  box-shadow: inset 0 0 0 1px var(--line);
}

.step-label {
  color: var(--teal);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.guide-card h3 {
  margin: 8px 0;
  font-size: 1.35rem;
}

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

.progress-bar {
  height: 9px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e8e5;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--card-color);
  transition: width .28s var(--ease-out);
}

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

.step-list li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
}

.step-list span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: #edf0ee;
  color: var(--muted);
  font-weight: 900;
}

.step-list p {
  margin: 0;
}

.step-list .is-current {
  border-color: var(--card-color);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(32, 55, 47, .08);
}

.step-list .is-current span,
.step-list .is-done span {
  background: var(--card-color);
  color: #fff;
}

.step-list .is-done {
  color: var(--ink);
}

.primary-button {
  min-height: 54px;
  border-radius: 16px;
  background: var(--card-color);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: 0 16px 30px color-mix(in srgb, var(--card-color) 30%, transparent);
  transition: transform .18s var(--ease-out), filter .18s var(--ease-out);
}

.primary-button:active,
.square-button:active,
.avatar-button:active,
.nav-item:active {
  transform: scale(.96);
}

.primary-button:disabled {
  filter: grayscale(.2);
  opacity: .72;
}

.skeleton-card {
  min-height: 470px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent),
    #e4e7e4;
  background-size: 220% 100%, 100% 100%;
  animation: shimmer 1s linear infinite;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 86px;
  left: 18px;
  z-index: 60;
  max-width: 420px;
  margin: 0 auto;
  padding: 13px 16px;
  border-radius: 14px;
  background: #13241f;
  color: #fff;
  font-weight: 900;
  text-align: center;
  box-shadow: var(--shadow);
  animation: toastIn .24s var(--ease-out) both;
  transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(10px) scale(.98);
}

.micro-pulse {
  animation: microPulse .28s var(--ease-out) both;
}

@keyframes appIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateX(18px) scale(.98);
  }
}

@keyframes panelIn {
  from {
    transform: translateX(100%);
  }
}

@keyframes shimmer {
  to {
    background-position: -220% 0, 0 0;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.98);
  }
}

@keyframes microPulse {
  50% {
    transform: scale(.985);
    filter: brightness(1.05);
  }
}

@media (hover: hover) {
  .quest-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 54px rgba(32, 55, 47, .17);
  }
}

@media (max-width: 760px) {
  .app-frame {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .topbar {
    grid-template-columns: 104px 1fr 48px;
    min-height: 86px;
    padding: 12px;
  }

  .square-button,
  .avatar-button {
    width: 42px;
    height: 42px;
  }

  .quest-track {
    grid-auto-columns: minmax(286px, 82vw);
    padding-inline: 14px;
  }

  .bottom-nav {
    gap: 2px;
    padding-inline: 8px;
  }

  .nav-item {
    font-size: .62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
