:root {
  color-scheme: light;
  --ink: #17191f;
  --muted: #606575;
  --panel: #fffdfa;
  --paper: #f7f2e8;
  --line: #d8d2c4;
  --blue: #2275d7;
  --green: #1e8d60;
  --red: #c84435;
  --yellow: #f3bd3e;
  --shadow: 0 18px 50px rgba(32, 25, 12, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(34, 117, 215, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(34, 117, 215, 0.08) 1px, transparent 1px),
    #efe7d8;
  background-size: 34px 34px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 22px auto 0;
}

.game-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
  min-height: 640px;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: panel-in 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow,
.task-number {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
}

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

h1 {
  max-width: 650px;
  margin-bottom: 0;
  font-size: clamp(1.9rem, 3.8vw, 3.35rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 10px;
  min-width: 238px;
}

.scoreboard div,
.status-strip,
.achievement-tray,
.ad-slot {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
}

.scoreboard div {
  padding: 10px;
  text-align: center;
}

.scoreboard span {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.7rem;
  font-weight: 700;
}

.scoreboard span.pop {
  animation: score-pop 360ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.scoreboard small {
  color: var(--muted);
  font-size: 0.72rem;
}

.status-strip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 10px 8px 14px;
  background: var(--yellow);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  animation: slide-in 480ms 100ms both cubic-bezier(0.2, 0.9, 0.2, 1);
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.task-stage {
  display: flex;
  flex-direction: column;
  min-height: 430px;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  position: relative;
  overflow: hidden;
}

.task-copy h2 {
  min-height: 72px;
  margin-bottom: 8px;
  font-size: clamp(1.7rem, 3.8vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

.task-copy p:last-child {
  min-height: 48px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.task-area {
  display: grid;
  place-items: center;
  min-height: 210px;
  margin: 14px 0;
  padding: 18px;
  border: 2px dashed rgba(23, 25, 31, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.task-area.swap {
  animation: task-swap 360ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.task-area.done {
  animation: complete-glow 560ms ease;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin-top: auto;
}

.primary-button,
.secondary-button,
.share-button,
.mini-button {
  min-height: 46px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 5px 0 var(--ink);
}

.secondary-button,
.share-button,
.mini-button {
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
}

.share-button {
  color: #fff;
  background: var(--ink);
  animation: share-arrive 420ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.primary-button:active,
.secondary-button:active,
.share-button:active,
.mini-button:active,
.icon-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.primary-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 5px 0 var(--ink);
}

.achievement-tray {
  padding: 16px;
  background: #eff8f2;
}

.achievement-tray h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

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

.achievement-tray li {
  padding: 10px;
  border: 1px solid rgba(23, 25, 31, 0.22);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  animation: praise-in 320ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.ad-zone {
  margin: 26px 0 18px;
  padding-top: 22px;
  border-top: 2px solid rgba(23, 25, 31, 0.28);
}

.ad-zone > p {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  text-align: center;
  text-transform: uppercase;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 118px;
  background: repeating-linear-gradient(
    45deg,
    #fff,
    #fff 12px,
    #f2f2f2 12px,
    #f2f2f2 24px
  );
  color: #727272;
  font-family: "JetBrains Mono", monospace;
}

.ad-slot span {
  animation: quiet-pulse 2.8s ease-in-out infinite;
}

.site-footer {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.footer-copy {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.site-footer a,
.policy-page a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.policy-page {
  width: min(820px, calc(100% - 28px));
  margin: 24px auto;
  padding: 22px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.policy-page h1 {
  white-space: normal;
}

.policy-page h2 {
  margin: 24px 0 8px;
}

.policy-page p {
  color: var(--muted);
  line-height: 1.65;
}

.policy-page h3 {
  margin: 18px 0 6px;
}

.policy-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.policy-home {
  display: inline-block;
  margin-bottom: 18px;
}

.about-shell {
  margin-bottom: 18px;
}

.about-panel {
  min-height: 0;
}

.about-panel .top-bar h1 {
  max-width: 720px;
  white-space: normal;
}

.status-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 800;
  text-decoration: none;
}

.about-lead {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
}

.about-story {
  min-height: 0;
  gap: 8px;
}

.about-story h2,
.about-section h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.65rem);
  line-height: 1;
}

.about-story p,
.about-section p {
  color: var(--muted);
  line-height: 1.62;
}

.compact-story {
  padding: 18px;
}

.about-briefing {
  align-self: stretch;
}

.about-section {
  grid-column: 1 / -1;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 2px solid rgba(23, 25, 31, 0.18);
}

.section-heading .task-number {
  flex: 0 0 auto;
}

.how-grid,
.faq-grid,
.policy-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.faq-grid,
.policy-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.how-grid article,
.faq-grid article,
.policy-card-grid article,
.sample-task-grid span {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
}

.how-grid article,
.faq-grid article,
.policy-card-grid article {
  padding: 14px;
}

.how-grid strong,
.faq-grid h3,
.policy-card-grid h3 {
  display: block;
  margin: 0 0 8px;
  font-size: 1rem;
}

.how-grid p,
.faq-grid p,
.policy-card-grid p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.sample-task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sample-task-grid span {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.task-widget {
  width: min(440px, 100%);
}

.file-card,
.report-card,
.toast-card {
  width: min(360px, 100%);
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.file-card strong,
.report-card strong {
  display: block;
  margin-bottom: 10px;
  font-family: "JetBrains Mono", monospace;
  overflow-wrap: anywhere;
}

.drag-zone {
  position: relative;
  width: min(430px, 100%);
  height: 170px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.draggable {
  position: absolute;
  left: 18px;
  top: 54px;
  display: grid;
  place-items: center;
  width: 86px;
  height: 52px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  cursor: grab;
  user-select: none;
  touch-action: none;
  animation: floaty 2.4s ease-in-out infinite;
}

.drop-target {
  position: absolute;
  right: 18px;
  top: 44px;
  display: grid;
  place-items: center;
  width: 118px;
  height: 72px;
  border: 2px dashed var(--green);
  border-radius: 8px;
  color: var(--green);
  font-weight: 800;
  animation: dash-pulse 1.4s ease-in-out infinite;
}

.fake-window {
  width: min(420px, 100%);
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.fake-window header {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 2px solid var(--ink);
  background: #e8edf7;
}

.dot {
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}

.dot:nth-child(2) {
  background: var(--yellow);
}

.dot:nth-child(3) {
  background: var(--green);
}

.fake-window .content {
  padding: 16px;
}

.checkbox-row,
.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.text-input,
.select-input {
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.range-input {
  width: 100%;
  accent-color: var(--blue);
}

.progress-shell {
  width: 100%;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 0.18s ease;
  background-image: linear-gradient(90deg, rgba(255,255,255,0.22) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.22) 50%, rgba(255,255,255,0.22) 75%, transparent 75%);
  background-size: 24px 24px;
  animation: progress-stripes 680ms linear infinite;
}

.memo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 10px;
  width: min(360px, 100%);
}

.memo-grid button {
  min-height: 54px;
}

.stamp {
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  border: 5px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-weight: 800;
  text-align: center;
  transform: rotate(-14deg);
  animation: stamp-in 420ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.paperclip {
  font-family: "JetBrains Mono", monospace;
  font-size: 4rem;
}

.shake {
  animation: shake 0.22s linear;
}

.points-float {
  position: fixed;
  left: var(--x);
  top: var(--y);
  color: var(--green);
  font-family: "JetBrains Mono", monospace;
  font-size: 1.2rem;
  font-weight: 800;
  text-shadow: 0 2px 0 #fff;
  animation: points-float 900ms ease-out forwards;
}

.confetti {
  position: fixed;
  left: var(--x);
  top: -16px;
  width: 10px;
  height: 16px;
  border: 2px solid var(--ink);
  background: var(--c);
  animation: confetti-fall var(--d) linear forwards;
}

.confetti.big {
  width: 16px;
  height: 24px;
  border-radius: 50%;
}

.confetti.ribbon {
  width: 7px;
  height: 34px;
  border-radius: 999px;
}

.task-stamp {
  position: absolute;
  right: 20px;
  bottom: 86px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 138px;
  height: 138px;
  border: 5px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  background: rgba(255, 255, 255, 0.74);
  font-weight: 800;
  text-align: center;
  transform: rotate(-12deg);
  animation: stamp-in 520ms cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  pointer-events: none;
}

.wiggle-on-hover:hover {
  animation: wiggle 320ms ease-in-out;
}

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

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

@keyframes task-swap {
  from {
    opacity: 0;
    transform: translateY(20px) rotate(0.7deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes complete-glow {
  0%,
  100% {
    background: rgba(255, 255, 255, 0.62);
  }
  35% {
    background: rgba(30, 141, 96, 0.2);
  }
}

@keyframes score-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.26) rotate(-2deg);
    color: var(--green);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes praise-in {
  from {
    opacity: 0;
    transform: translateX(12px) rotate(0.8deg);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes quiet-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.88;
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes dash-pulse {
  0%,
  100% {
    border-color: var(--green);
  }
  50% {
    border-color: var(--blue);
  }
}

@keyframes progress-stripes {
  to {
    background-position: 24px 0;
  }
}

@keyframes points-float {
  from {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.84);
  }
  20% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(-50%, -58px) scale(1.12);
  }
}

@keyframes confetti-fall {
  to {
    transform: translateY(calc(100vh + 42px)) translateX(var(--drift)) rotate(var(--spin));
    opacity: 0.85;
  }
}

@keyframes share-arrive {
  from {
    opacity: 0;
    transform: translateY(10px) rotate(-2deg) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: rotate(-22deg) scale(1.8);
  }
  to {
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  35% {
    transform: rotate(-2deg);
  }
  70% {
    transform: rotate(2deg);
  }
}

@keyframes shake {
  0%,
  100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

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

@media (max-width: 820px) {
  .game-panel {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 12px;
  }

  .top-bar {
    flex-direction: column;
  }

  .scoreboard {
    width: 100%;
    min-width: 0;
  }

  .task-stage {
    padding: 14px;
  }

  .task-copy h2,
  .task-copy p:last-child {
    min-height: auto;
  }

  .task-stamp {
    right: 14px;
    bottom: 128px;
    width: 112px;
    height: 112px;
    font-size: 0.82rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-lead,
  .how-grid,
  .faq-grid,
  .policy-card-grid {
    grid-template-columns: 1fr;
  }

  .sample-task-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    display: block;
  }
}

@media (max-width: 480px) {
  .app-shell,
  .site-footer {
    width: min(100% - 16px, 1120px);
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .task-area {
    min-height: 190px;
    padding: 10px;
  }

  .status-strip {
    gap: 8px;
    font-size: 0.76rem;
  }

  h1 {
    font-size: clamp(1.55rem, 8vw, 2.05rem);
    white-space: normal;
  }

  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }

  .scoreboard span {
    font-size: 1.35rem;
  }

  .drag-zone {
    height: 190px;
  }

  .drop-target {
    right: 10px;
    width: 96px;
  }

  .draggable {
    width: 76px;
  }

  .task-stamp {
    position: static;
    width: min(100%, 220px);
    height: 58px;
    margin: 10px auto 0;
    border-radius: 8px;
    transform: rotate(0);
  }

  .ad-slot {
    min-height: 96px;
  }

  .about-section {
    padding: 12px;
  }

  .sample-task-grid {
    grid-template-columns: 1fr;
  }

  .status-link {
    width: 100%;
    justify-content: center;
  }
}
