:root {
  --bg: #f6f4ef;
  --ink: #070d22;
  --muted: #687083;
  --surface: #ffffff;
  --line: rgba(7, 13, 34, .12);
  --red: #ff2445;
  --red-dark: #d91231;
  --gold: #f7b733;
  --pink: #ffd7df;
  --shadow: 0 20px 50px rgba(7, 13, 34, .16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 36, 69, .12), transparent 28rem),
    radial-gradient(circle at 85% 0%, rgba(247, 183, 51, .18), transparent 30rem),
    linear-gradient(135deg, #fffaf2 0%, var(--bg) 45%, #eef1ff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.topbar,
.daily-quest {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 14px 34px rgba(7, 13, 34, .08);
  backdrop-filter: blur(16px);
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.brand {
  display: flex;
  align-items: center;
  width: min(300px, 58vw);
  height: 52px;
  overflow: hidden;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.reward-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff6da;
  color: #2d1f00;
}

.reward-pill span {
  color: #705826;
  font-size: .86rem;
  font-weight: 800;
}

.reward-pill strong {
  color: var(--red);
  font-size: 1.25rem;
}

.quest-home {
  padding-top: 22px;
}

.daily-quest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(20px, 5vw, 54px);
  align-items: center;
  min-height: calc(100vh - 140px);
  padding: clamp(24px, 5vw, 58px);
  border-radius: var(--radius);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: .95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: .95;
  letter-spacing: 0;
}

.daily-copy p:last-child {
  max-width: 580px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.quest-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 520px;
  padding: 14px;
  border: 6px solid #bd0f2d;
  border-radius: 14px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .74)),
    radial-gradient(circle at 50% 22%, #ff8aa0, transparent 12rem);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
  transition: transform .22s ease, box-shadow .22s ease;
}

.quest-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border: 2px solid rgba(255, 255, 255, .74);
  border-radius: 8px;
}

.quest-card::after {
  content: "";
  position: absolute;
  inset: -45% -70%;
  z-index: -1;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, .8) 50%, transparent 58%);
  transform: translateX(-30%) rotate(8deg);
  opacity: 0;
}

.quest-card-top,
.quest-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quest-card-top span,
.quest-card-top strong,
.quest-card-footer span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  font-size: .8rem;
  font-weight: 900;
}

.quest-card-top strong {
  background: var(--red);
  color: #fff;
}

.quest-card-art {
  display: grid;
  place-items: center;
  min-height: 190px;
  margin: 16px 0;
  border: 3px solid rgba(7, 13, 34, .14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #ffe4ea, #ffc7d2),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .25) 0 10px, transparent 10px 20px);
}

.pin-stack {
  position: relative;
  width: 150px;
  height: 150px;
}

.pin-stack i {
  position: absolute;
  width: 88px;
  height: 118px;
  border-radius: 12px;
  background: #fff;
  border: 4px solid var(--ink);
  box-shadow: 0 12px 24px rgba(7, 13, 34, .18);
}

.pin-stack i:nth-child(1) {
  left: 0;
  top: 20px;
  transform: rotate(-11deg);
}

.pin-stack i:nth-child(2) {
  left: 34px;
  top: 8px;
  transform: rotate(4deg);
}

.pin-stack i:nth-child(3) {
  left: 64px;
  top: 24px;
  background: linear-gradient(180deg, var(--red), #ff7a91);
  transform: rotate(13deg);
}

.quest-card-body strong {
  display: block;
  margin-bottom: 8px;
  font-size: 2.2rem;
  line-height: 1;
}

.quest-card-body span {
  color: #42485a;
  font-weight: 800;
}

.quest-card-footer {
  margin-top: 18px;
}

.quest-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: min(520px, 100%);
  padding: 26px;
  border: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: -30px 0 80px rgba(7, 13, 34, .28);
  transform: translateX(105%);
  transition: transform .28s ease;
  overflow: auto;
}

.quest-drawer.is-open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  background: rgba(7, 13, 34, .48);
  backdrop-filter: blur(5px);
}

.drawer-backdrop.is-open {
  display: block;
}

.close-button {
  position: sticky;
  top: 0;
  float: right;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 24px;
}

.drawer-content {
  clear: both;
  padding-top: 8px;
}

.detail-list {
  display: grid;
  gap: 12px;
}

.detail-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafafa;
}

.detail-list span,
.quest-form label > span,
.file-drop > span {
  display: block;
  margin-bottom: 6px;
  color: var(--red);
  font-size: .8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-list p {
  margin-bottom: 0;
  color: #3c4358;
}

.quest-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.quest-form textarea,
.quest-form input[type="file"] {
  width: 100%;
}

.quest-form textarea {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  resize: vertical;
}

.file-drop {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 2px dashed rgba(255, 36, 69, .35);
  border-radius: var(--radius);
  background: #fff8fa;
}

.primary-button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(255, 36, 69, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}

.active-timer {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
}

.active-timer span {
  color: rgba(255, 255, 255, .72);
  font-weight: 800;
}

.active-timer strong {
  font-size: 3.4rem;
}

.toast-zone {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: min(320px, calc(100vw - 36px));
  padding: 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  animation: toast-in .25s ease both;
}

.victory-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
}

.victory-screen.is-active {
  display: grid;
}

.victory-bg {
  position: absolute;
  inset: -20%;
  background:
    conic-gradient(from 0deg, var(--red), var(--gold), #7d3cff, var(--red)),
    radial-gradient(circle, rgba(255, 255, 255, .35), transparent 34rem);
  animation: victory-spin 7s linear infinite;
  filter: saturate(1.25);
}

.victory-popup {
  position: relative;
  width: min(560px, calc(100% - 32px));
  padding: 34px;
  border: 2px solid rgba(255, 255, 255, .58);
  border-radius: 14px;
  text-align: center;
  color: white;
  background: rgba(7, 13, 34, .88);
  box-shadow: 0 34px 100px rgba(7, 13, 34, .44);
  backdrop-filter: blur(14px);
  animation: popup-in .5s cubic-bezier(.2, 1.4, .3, 1) both;
}

.victory-popup h2 {
  margin-bottom: 12px;
  font-size: clamp(2.3rem, 8vw, 4.6rem);
}

.victory-popup strong {
  color: var(--gold);
}

@media (hover: hover) {
  .quest-card:hover {
    transform: translateY(-8px) rotateX(3deg);
    box-shadow: 0 30px 80px rgba(7, 13, 34, .22);
  }

  .quest-card:hover::after {
    animation: shine .7s ease both;
  }

  .primary-button:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 820px) {
  .daily-quest {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .quest-card {
    min-height: 430px;
  }
}

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

  .topbar {
    top: 6px;
  }

  .brand {
    width: 210px;
  }

  .reward-pill span {
    display: none;
  }

  h1 {
    font-size: clamp(2.2rem, 12vw, 3.8rem);
  }

  .quest-drawer {
    padding: 18px;
  }
}

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

@keyframes shine {
  from {
    opacity: 0;
    transform: translateX(-45%) rotate(8deg);
  }
  35% {
    opacity: .8;
  }
  to {
    opacity: 0;
    transform: translateX(45%) rotate(8deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes victory-spin {
  to {
    transform: rotate(360deg) scale(1.08);
  }
}

@keyframes popup-in {
  from {
    opacity: 0;
    transform: scale(.82) translateY(18px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
