* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  color-scheme: light;
  --cream: #FBF6EA;
  --brown: #5C4930;
  --sand: #F5E6C8;
  --leaf: #BFE3B4;
  --sky: #BEE3F0;
  --peach: #FFDAB3;
  --orange: #FF9B54;
  --orange-dark: #E07E3A;
  --green: #5BB98C;
  --muted: #8B765A;
  --white: #FFFFFF;
  --shadow: 0 5px 0 rgba(92, 73, 48, .14);
}

html {
  min-height: 100%;
  background: var(--cream);
  overscroll-behavior: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 4%, rgba(190, 227, 240, .55) 0 70px, transparent 71px),
    radial-gradient(circle at 92% 22%, rgba(191, 227, 180, .45) 0 90px, transparent 91px),
    var(--cream);
  color: var(--brown);
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDGothic", "Yu Gothic", sans-serif;
  touch-action: manipulation;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

button {
  min-height: 60px;
  border: 0;
  color: var(--brown);
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid var(--sky);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.screen {
  animation: arrive .22s ease-out;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 64px;
}

.topbar h1,
.home-title {
  margin: 0;
  font-size: clamp(1.4rem, 6vw, 2rem);
  letter-spacing: .04em;
}

.back,
.text-button {
  min-width: 60px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.rank-ribbon {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--brown);
  color: var(--white);
  font-size: .86rem;
  font-weight: 800;
}

.home-hero {
  margin-top: 14px;
  padding: 22px;
  border-radius: 30px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.completion-card {
  overflow: hidden;
}

.stamp-pop {
  display: grid;
  width: 132px;
  height: 132px;
  margin: 4px auto 18px;
  place-items: center;
  border: 7px double var(--orange-dark);
  border-radius: 50%;
  background: var(--peach);
  color: var(--orange-dark);
  font-size: 1.28rem;
  font-weight: 900;
  line-height: 1.2;
  transform: rotate(-7deg);
  animation: stamp-in .45s cubic-bezier(.2, 1.5, .5, 1);
}

.rank-up-card {
  margin: 20px -8px 24px;
  padding: 24px 16px;
  border: 5px solid var(--orange);
  border-radius: 26px;
  background: var(--sand);
  box-shadow: 0 7px 0 var(--orange-dark);
  animation: rank-in .55s ease-out;
}

.rank-up-sparkles {
  font-size: 2rem;
}

.rank-up-label,
.rank-up-note {
  margin-top: 8px;
  font-weight: 800;
}

.rank-up-number {
  margin-top: 8px;
  color: var(--orange-dark);
  font-size: 2rem;
  font-weight: 900;
}

.rank-up-name {
  margin-top: 5px;
  font-size: 1.45rem;
  font-weight: 900;
}

@keyframes stamp-in {
  from { opacity: 0; transform: scale(1.7) rotate(-18deg); }
  to { opacity: 1; transform: scale(1) rotate(-7deg); }
}

@keyframes rank-in {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.today {
  min-width: 0;
  text-align: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 13px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--white);
  font-size: .78rem;
  font-weight: 800;
}

.emoji {
  margin: 7px 0 2px;
  font-size: clamp(2.7rem, 12vw, 4.4rem);
  line-height: 1.15;
}

.today h2,
.card h2 {
  margin: 4px 0;
  font-size: clamp(1.05rem, 4.5vw, 1.35rem);
  line-height: 1.45;
}

.small {
  margin: 5px 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.55;
}

.primary,
.secondary {
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  font-size: 1.06rem;
  font-weight: 800;
}

.primary {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 4px 0 var(--orange-dark);
}

.primary.green {
  background: var(--green);
  box-shadow: 0 4px 0 #3B916B;
}

.secondary {
  background: var(--sky);
  box-shadow: 0 4px 0 #8DBFCE;
}

.primary:active,
.secondary:active,
.nav-card:active,
.key:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(92, 73, 48, .2);
}

.primary:disabled {
  background: #D9CBB5;
  box-shadow: none;
  cursor: default;
}

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

.nav-card {
  min-width: 0;
  padding: 12px 5px;
  border-radius: 20px;
  background: var(--sky);
  box-shadow: var(--shadow);
  font-size: .88rem;
  font-weight: 800;
}

.nav-card:nth-child(2) {
  background: var(--leaf);
}

.nav-card:nth-child(3) {
  background: var(--peach);
}

.nav-card .nav-icon {
  display: block;
  font-size: 1.8rem;
}

.nav-card.locked {
  opacity: .55;
}

.parent-tip {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 15px;
  background: #F0E5D2;
  color: #7B674E;
  font-size: .78rem;
  line-height: 1.65;
}

.parent-tip strong {
  color: var(--brown);
}

.card {
  margin-top: 14px;
  padding: 20px;
  border-radius: 26px;
  background: var(--white);
  box-shadow: 0 4px 14px rgba(92, 73, 48, .09);
}

.center {
  text-align: center;
}

.instruction {
  margin: 12px 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.7;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--cream);
  font-size: .88rem;
  font-weight: 700;
}

.value-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: center;
  gap: 6px;
  margin: 16px 0;
}

.value-row + .value-row {
  margin-top: 22px;
}

.row-label {
  flex-basis: 100%;
  text-align: center;
  font-weight: 800;
}

.value-slot {
  min-width: 76px;
  min-height: 64px;
  padding: 8px;
  border: 3px solid #E7D7BC;
  border-radius: 16px;
  background: var(--cream);
  font-size: 1.7rem;
  font-weight: 800;
}

.value-slot.active {
  border-color: var(--orange);
  background: #FFF2E5;
}

.unit {
  padding-bottom: 10px;
  font-weight: 800;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.key {
  height: 64px;
  border-radius: 16px;
  background: var(--sky);
  box-shadow: 0 3px 0 #8DBFCE;
  font-size: 1.42rem;
  font-weight: 800;
}

.key.delete {
  background: var(--peach);
  box-shadow: 0 3px 0 #D9AE82;
  font-size: 1rem;
}

.meter {
  height: 24px;
  margin: 10px 0 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sand);
}

.meter > span {
  display: block;
  width: 6%;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width .2s ease;
}

.meter.real > span,
.comparison-bar > span {
  background: var(--green);
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--cream);
  text-align: left;
  font-weight: 800;
}

.check span {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border: 3px solid #E7D7BC;
  border-radius: 11px;
  background: var(--white);
}

.check.on {
  background: var(--leaf);
}

.discover {
  margin: 16px 0;
  color: #3F8D6A;
  font-size: 1.16rem;
  font-weight: 900;
  line-height: 1.75;
  text-align: center;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-grid.three {
  grid-template-columns: 1fr;
}

.choice {
  min-height: 72px;
  padding: 12px;
  border-radius: 18px;
  background: var(--sky);
  font-weight: 800;
}

.count-number {
  margin: 10px 0;
  color: var(--orange-dark);
  font-size: 4.5rem;
  font-weight: 900;
}

.notice {
  margin-top: 12px;
  padding: 12px;
  border-radius: 15px;
  background: var(--peach);
  font-weight: 700;
  line-height: 1.55;
}

.photo-preview {
  display: block;
  width: min(100%, 360px);
  max-height: 360px;
  margin: 12px auto;
  border-radius: 20px;
  object-fit: cover;
}

.mission-list,
.zukan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.mission-pick,
.zukan-card {
  min-height: 112px;
  padding: 12px 8px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 3px 9px rgba(92, 73, 48, .08);
  text-align: center;
}

.mission-pick {
  width: 100%;
}

.mission-pick .emoji,
.zukan-card .emoji {
  margin: 0;
  font-size: 2.2rem;
}

.done-mark {
  color: var(--green);
  font-weight: 900;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
}

.tab {
  flex: 1 0 auto;
  min-width: 82px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 15px;
  background: var(--sand);
  font-weight: 800;
}

.tab.on {
  background: var(--orange);
  color: var(--white);
}

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

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

.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 68px;
  padding: 9px 11px;
  border: 3px solid var(--green);
  border-radius: 17px;
  background: var(--leaf);
  font-size: .82rem;
}

.badge span {
  font-size: 1.7rem;
}

.badge.off {
  border-color: #D7CAB5;
  background: var(--sand);
  filter: grayscale(1);
  opacity: .35;
}
.benchmark {
  min-height: 88px;
  padding: 8px 4px;
  border: 2px dashed #D2BFA1;
  border-radius: 15px;
  background: var(--cream);
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
}

.zukan-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  object-fit: cover;
}

.pin {
  min-height: 48px;
  margin-top: 6px;
  padding: 5px 9px;
  border-radius: 12px;
  background: var(--sand);
  font-size: .76rem;
  font-weight: 700;
}

.pin.on {
  background: var(--leaf);
}

.compare-row {
  display: grid;
  grid-template-columns: 84px 1fr 74px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: .78rem;
  font-weight: 700;
}

.comparison-bar {
  height: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sand);
}

.comparison-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.free-name {
  width: 100%;
  min-height: 60px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 3px solid #E7D7BC;
  border-radius: 16px;
  background: var(--cream);
  color: var(--brown);
  font-size: 1.1rem;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.emoji-pick {
  min-width: 0;
  padding: 4px;
  border-radius: 14px;
  background: var(--cream);
  font-size: 1.6rem;
}

.emoji-pick.on {
  background: var(--leaf);
}

@media (max-width: 480px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }


  .home-nav {
    gap: 7px;
  }

  .nav-card {
    font-size: .76rem;
  }

  .mission-list,
  .zukan-grid {
    grid-template-columns: 1fr 1fr;
  }

  .compare-row {
    grid-template-columns: 70px 1fr 62px;
  }
}


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