:root {
  --ink: #1f1b18;
  --muted: #756a60;
  --paper: #fff8e8;
  --paper-strong: #fff1be;
  --line: #2c251d;
  --mustard: #f4d35e;
  --tomato: #ef6f5e;
  --mint: #72c9a5;
  --blue: #5da9e9;
  --pink: #f6a6c1;
  --lilac: #c6b5f7;
  --brown: #8a5b3e;
  --shadow: 0 18px 0 rgba(31, 27, 24, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Gill Sans", "Trebuchet MS", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 18px 18px, rgba(31, 27, 24, 0.08) 0 3px, transparent 4px) 0 0 / 46px 46px,
    linear-gradient(140deg, #ffe4a7 0%, #f9c0a0 34%, #c7e9d5 68%, #bdd7ff 100%);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 14px 92px;
  overflow: hidden;
}

.decor-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.topbar,
.screen,
.tabbar {
  position: relative;
  z-index: 1;
}

.paw,
.toy {
  position: absolute;
  opacity: 0.38;
  filter: drop-shadow(0 5px 0 rgba(31, 27, 24, 0.12));
}

.paw {
  width: 42px;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: 55% 55% 44% 44%;
  background: rgba(255, 253, 243, 0.72);
}

.paw::before,
.paw::after {
  position: absolute;
  top: -16px;
  width: 12px;
  height: 15px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: inherit;
  content: "";
}

.paw::before {
  left: 7px;
}

.paw::after {
  right: 7px;
}

.paw-a {
  top: 130px;
  left: max(10px, calc((100vw - 460px) / 2 - 34px));
  transform: rotate(-18deg);
}

.paw-b {
  right: max(10px, calc((100vw - 460px) / 2 - 30px));
  bottom: 148px;
  transform: rotate(20deg) scale(0.92);
}

.toy {
  width: 38px;
  height: 38px;
  border: 2px solid var(--line);
  border-radius: 14px 999px 14px 999px;
  background: var(--pink);
}

.toy::after {
  position: absolute;
  inset: 10px;
  border: 2px solid var(--line);
  border-radius: inherit;
  background: var(--paper);
  content: "";
}

.toy-a {
  top: 72px;
  right: max(18px, calc((100vw - 460px) / 2 + 18px));
  transform: rotate(18deg);
}

.toy-b {
  bottom: 235px;
  left: max(20px, calc((100vw - 460px) / 2 + 20px));
  background: var(--blue);
  transform: rotate(-25deg) scale(0.84);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 2px 12px;
  backdrop-filter: blur(12px);
}

.brand,
.tagline {
  margin: 0 0 6px;
  color: var(--brown);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1,
.hero-copy h2,
.result-hero h2,
.daily-panel h2,
.share-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 290px;
  font-size: clamp(1.25rem, 6vw, 1.72rem);
  line-height: 1.08;
}

.ghost-button {
  flex: 0 0 auto;
  min-width: 58px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--ink);
  background: rgba(255, 248, 232, 0.76);
  box-shadow: 0 4px 0 var(--line);
  font-size: 0.86rem;
  font-weight: 800;
}

.screen {
  display: none;
  padding-bottom: 118px;
}

.screen-active {
  display: block;
  animation: rise 0.24s ease-out;
}

.hero-panel,
.setup-card,
.question-card,
.result-hero,
.report-card,
.daily-panel,
.check-group,
.share-head,
.canvas-wrap {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 10px;
  min-height: 206px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.95), rgba(255, 241, 190, 0.9)),
    radial-gradient(circle at 80% 20%, rgba(246, 166, 193, 0.5), transparent 28%);
}

.hero-panel::after {
  position: absolute;
  right: -36px;
  bottom: -46px;
  width: 150px;
  height: 150px;
  border: 2px solid rgba(31, 27, 24, 0.14);
  border-radius: 50%;
  content: "";
}

.hero-copy h2 {
  max-width: 12ch;
  color: var(--ink);
  font-size: clamp(1.86rem, 10vw, 2.62rem);
  line-height: 0.92;
  text-shadow: 0 3px 0 rgba(255, 253, 243, 0.72);
}

.hero-copy p:last-child,
.daily-panel p,
.result-hero p,
.share-head p {
  margin: 12px 0 0;
  color: #5e5046;
  font-weight: 700;
  line-height: 1.55;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.mascot-card {
  position: relative;
  align-self: end;
  justify-self: end;
  width: 116px;
  height: 146px;
  transform: rotate(3deg);
}

.orbit-sticker {
  position: absolute;
  z-index: 4;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fffdf3;
  box-shadow: 0 4px 0 var(--line);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.sticker-a {
  top: -10px;
  right: 34px;
  transform: rotate(-9deg);
}

.sticker-b {
  right: -5px;
  bottom: 38px;
  background: var(--pink);
  transform: rotate(9deg);
}

.pet-face {
  position: absolute;
  top: 16px;
  left: 9px;
  z-index: 2;
  width: 92px;
  height: 82px;
  border: 3px solid var(--line);
  border-radius: 44% 44% 38% 38%;
  background: #f7b267;
  box-shadow: 8px 8px 0 var(--line);
}

.pet-face::before,
.pet-face::after {
  position: absolute;
  top: -21px;
  width: 34px;
  height: 38px;
  border: 3px solid var(--line);
  background: #f7b267;
  content: "";
}

.pet-face::before {
  left: 5px;
  border-radius: 80% 20% 50% 50%;
  transform: rotate(-24deg);
}

.pet-face::after {
  right: 5px;
  border-radius: 20% 80% 50% 50%;
  transform: rotate(24deg);
}

.pet-face span {
  position: absolute;
  top: 32px;
  width: 10px;
  height: 16px;
  border-radius: 999px;
  background: var(--ink);
}

.pet-face span:first-child {
  left: 23px;
}

.pet-face span:nth-child(2) {
  right: 23px;
}

.pet-face i {
  position: absolute;
  left: 40px;
  top: 48px;
  width: 14px;
  height: 8px;
  border-radius: 0 0 999px 999px;
  background: var(--ink);
}

.pet-body {
  position: absolute;
  right: 4px;
  bottom: 0;
  width: 82px;
  height: 68px;
  border: 3px solid var(--line);
  border-radius: 42px 42px 26px 26px;
  background: var(--mustard);
}

.pet-tail {
  position: absolute;
  right: -6px;
  bottom: 42px;
  width: 34px;
  height: 54px;
  border: 8px solid var(--line);
  border-left: 0;
  border-radius: 0 999px 999px 0;
}

.axis-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 16px;
}

.axis-pill {
  min-height: 40px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 9px 10px;
  background: rgba(255, 253, 243, 0.82);
  box-shadow: 0 4px 0 rgba(31, 27, 24, 0.18);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.setup-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
}

.setup-card label:nth-child(3) {
  grid-column: 1 / -1;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--ink);
  background: #fffdf3;
  outline: 0;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(93, 169, 233, 0.55);
  outline-offset: 2px;
}

.question-card {
  margin-top: 16px;
  padding: 16px;
  background:
    radial-gradient(circle at 95% 12%, rgba(114, 201, 165, 0.35) 0 44px, transparent 45px),
    var(--paper);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.progress-track {
  height: 10px;
  margin: 12px 0 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fffdf3;
  overflow: hidden;
}

.question-badge {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  margin: 0 0 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--lilac);
  box-shadow: 0 3px 0 var(--line);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
}

#progressBar {
  width: 0;
  height: 100%;
  border-right: 2px solid var(--line);
  background: linear-gradient(90deg, var(--mint), var(--mustard), var(--tomato));
  transition: width 0.22s ease;
}

.question-card h3 {
  min-height: 78px;
  margin: 0 0 16px;
  font-size: 1.34rem;
  line-height: 1.22;
}

.answer-list {
  display: grid;
  gap: 10px;
}

.answer-option {
  width: 100%;
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fffdf3;
  box-shadow: 0 4px 0 var(--line);
  font-weight: 800;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.answer-option.selected {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent),
    var(--mustard);
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--line);
}

.question-roast {
  position: relative;
  margin-top: 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 13px 13px 14px;
  color: #fffdf3;
  background:
    radial-gradient(circle at 92% 10%, rgba(239, 111, 94, 0.42), transparent 30%),
    #1f1b18;
  box-shadow: 0 7px 0 rgba(31, 27, 24, 0.22);
  transform-origin: 26px 0;
}

.question-roast[hidden] {
  display: none;
}

.question-roast::before {
  position: absolute;
  top: -8px;
  left: 22px;
  width: 14px;
  height: 14px;
  border-top: 2px solid var(--line);
  border-left: 2px solid var(--line);
  background: #1f1b18;
  content: "";
  transform: rotate(45deg);
}

.question-roast span {
  display: inline-grid;
  min-height: 26px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--ink);
  background: var(--mustard);
  box-shadow: 0 3px 0 rgba(255, 253, 243, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
}

.question-roast p {
  margin: 9px 0 0;
  color: #fffdf3;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.42;
}

.question-roast.roast-pop {
  animation: roast-pop 0.28s cubic-bezier(0.18, 1.42, 0.44, 1);
}

.primary-actions {
  display: grid;
  grid-template-columns: 0.84fr 1.16fr;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button {
  display: inline-grid;
  min-height: 54px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  color: var(--ink);
  box-shadow: 0 5px 0 var(--line);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.primary-button {
  background: var(--tomato);
}

.secondary-button {
  background: #fffdf3;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--line);
}

.result-hero,
.daily-panel,
.share-head {
  padding: 18px;
}

.result-hero {
  background:
    radial-gradient(circle at 86% 24%, rgba(246, 166, 193, 0.55), transparent 26%),
    var(--paper-strong);
}

.result-hero h2,
.daily-panel h2,
.share-head h2 {
  font-size: clamp(1.8rem, 9vw, 2.45rem);
  line-height: 0.98;
}

.report-card {
  margin-top: 14px;
  padding: 16px;
}

.report-card h3 {
  margin: 0 0 6px;
  font-size: 1.34rem;
}

.report-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.identity-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.identity-chip,
.detail-item,
.signature {
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fffdf3;
}

.identity-chip {
  min-height: 82px;
  padding: 12px;
  box-shadow: 0 6px 0 rgba(31, 27, 24, 0.18);
}

.identity-chip b {
  display: block;
  font-size: 1.15rem;
}

.identity-chip span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.detail-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.detail-item {
  padding: 10px;
}

.detail-item b {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.detail-item span {
  display: block;
  color: var(--muted);
  line-height: 1.42;
}

.signature {
  margin-top: 14px;
  padding: 12px;
  background: var(--mustard);
  font-weight: 900;
  line-height: 1.35;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.metric {
  min-height: 76px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fffdf3;
  overflow: hidden;
}

.metric b {
  display: block;
  font-size: 1.2rem;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.accent-card {
  background:
    radial-gradient(circle at 92% 14%, rgba(244, 211, 94, 0.55), transparent 24%),
    #dff3e3;
}

.power-card {
  background:
    radial-gradient(circle at 10% 12%, rgba(246, 166, 193, 0.42), transparent 25%),
    #dfeefe;
}

.roast-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 8%, rgba(239, 111, 94, 0.52), transparent 26%),
    linear-gradient(145deg, #fff1be, #fff8e8 58%, #f6c2d2);
}

.roast-card::after {
  position: absolute;
  top: -18px;
  right: -14px;
  width: 78px;
  height: 78px;
  border: 2px solid var(--line);
  border-radius: 26px 999px 28px 999px;
  background: var(--tomato);
  box-shadow: 0 8px 0 rgba(31, 27, 24, 0.16);
  content: "";
  transform: rotate(14deg);
}

.roast-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.roast-head .tagline {
  margin-bottom: 6px;
}

.roast-head span {
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--mint);
  box-shadow: 0 4px 0 var(--line);
  font-size: 0.72rem;
  font-weight: 900;
}

.roast-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.roast-item {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 253, 243, 0.86);
  box-shadow: 0 5px 0 rgba(31, 27, 24, 0.18);
}

.roast-item b,
.roast-item span {
  display: block;
}

.roast-item b {
  margin-bottom: 7px;
  font-size: 0.92rem;
}

.roast-item span {
  color: var(--ink);
  font-weight: 900;
  line-height: 1.42;
}

.check-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 253, 243, 0.92), rgba(255, 248, 232, 0.92)),
    radial-gradient(circle at 100% 0%, rgba(93, 169, 233, 0.28), transparent 32%);
}

.check-group h3 {
  grid-column: 1 / -1;
  margin: 0 0 2px;
}

.check-group button {
  min-height: 50px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fffdf3;
  box-shadow: 0 4px 0 var(--line);
  color: var(--ink);
  font-weight: 800;
}

.check-group button.selected {
  background: var(--mint);
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--line);
}

.daily-result {
  background:
    radial-gradient(circle at 88% 18%, rgba(114, 201, 165, 0.5), transparent 26%),
    var(--paper-strong);
}

.canvas-wrap {
  margin-top: 14px;
  padding: 10px;
  background: #fffdf3;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff8e8;
}

.tabbar {
  position: fixed;
  right: max(14px, calc((100vw - 460px) / 2 + 14px));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(14px, calc((100vw - 460px) / 2 + 14px));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  max-width: 432px;
  margin: 0 auto;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 7px;
  background: rgba(255, 253, 243, 0.86);
  box-shadow: 0 9px 0 var(--line);
  backdrop-filter: blur(16px);
}

.tabbar button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 900;
}

.tabbar button.tab-active {
  color: var(--ink);
  background: var(--mustard);
}

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

@keyframes roast-pop {
  0% {
    opacity: 0;
    transform: translateY(-6px) rotate(-1deg) scale(0.92);
  }
  72% {
    opacity: 1;
    transform: translateY(2px) rotate(0.6deg) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
}

@media (max-width: 360px) {
  .setup-card,
  .check-group,
  .primary-actions,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .mascot-card {
    justify-self: start;
  }
}
