@font-face {
  font-family: Nunito;
  src: url("arta/nunito-latin-ext.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02D1-02D2,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: Nunito;
  src: url("arta/nunito-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #fffcf4;
  --ink: #262843;
  --muted: #505872;
  --teal: #176957;
  --teal-dark: #0c5445;
  --mint: #e7f2eb;
  --edge: #cddfd2;
  --sun: #f7c74d;
  --coral: #b24647;
  --plum: #64459a;
  --shadow: 0 3px 0 #315d4a20, 0 12px 30px #315d4a12;
  --display: Georgia, "Times New Roman", serif;
  --text: Nunito, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 260px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 86% 0%, #fbebbd 0, transparent 45%),
    radial-gradient(ellipse at 4% 12%, #d7ecf6 0, transparent 45%),
    var(--mint);
  font: 650 1rem/1.45 var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #6c4598; outline-offset: 3px; }
#screen:focus { outline: none; }
h1, h2, h3 { margin: 0; font: 700 1.65rem/1.1 var(--display); text-wrap: balance; }
h3 { font-size: 1.22rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top {
  flex: none;
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font: 700 1.2rem/1.05 var(--display); }
.brand img { width: auto; height: 46px; object-fit: contain; }
.stats { display: flex; align-items: center; gap: 7px; }
.pill, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 2px 0 #315d4a16;
}
.pill { padding-inline: 8px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pill svg { width: 18px; height: 18px; }
.star-ico { color: #a76b08; }
.home-ico { color: var(--coral); }
.icon-btn { flex: none; width: 44px; height: 44px; font-weight: 900; font-size: 1.2rem; }
.icon-btn svg { width: 23px; height: 23px; }
.sound-off, .off .sound-waves { display: none; }
.off .sound-off { display: block; }

#screen {
  width: 100%;
  max-width: 620px;
  flex: 1;
  min-height: 0;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 13px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9dcabb transparent;
}
#screen > * { flex-shrink: 0; }
#screen[data-view="welcome"], #screen[data-view="clinic"] { max-width: 1120px; }
#screen[data-view="game"] { max-width: 570px; }
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  flex: none;
  align-self: center;
  gap: 6px;
  width: min(100% - 32px, 570px);
  margin: 0 0 max(10px, env(safe-area-inset-bottom));
  padding: 5px;
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 4px 16px #274f411a;
}
.tabs button {
  min-height: 44px;
  padding: 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--teal-dark);
  font-weight: 850;
}
.tabs button[aria-current="page"] { background: var(--teal); color: #fff; }
.tabs svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn {
  min-height: 48px;
  padding: 10px 19px;
  border: 1px solid #0001;
  border-radius: 15px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--teal-dark);
}
.btn.sun { background: var(--sun); color: var(--ink); box-shadow: 0 4px 0 #b4811c; }
.btn.ghost { background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 var(--edge); }
.btn:active { transform: translateY(2px); }
.btn.wide { width: 100%; }
.panel { padding: 15px 17px; border: 1px solid var(--edge); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.critter { display: block; width: 100%; height: 100%; overflow: visible; }
.stars { display: inline-flex; gap: 2px; white-space: nowrap; }
.stars i { color: #9ba5ab; font-style: normal; }
.stars i.on { color: #a9680a; }
.big-stars .stars i.on { color: #f1ae29; filter: drop-shadow(0 2px 0 #a9680a); }

.welcome {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  overflow: hidden;
  margin: auto 0;
  border: 6px solid var(--paper);
  border-radius: clamp(24px, 4vw, 42px);
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--edge), 0 12px 0 #81ac9130, 0 28px 65px #29534324;
}
.welcome-copy { container-type: inline-size; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 20px; padding: clamp(20px, 3.8vw, 50px); }
.welcome h1 { font-size: clamp(1.8rem, 17.8cqi, 4.2rem); line-height: .96; letter-spacing: -.055em; }
.welcome h1 span { display: block; color: var(--teal); }
.welcome p { max-width: 32ch; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.15rem); }
.welcome .btn { margin-top: 3px; padding-inline: 22px; }
.welcome-art { width: 100%; height: 100%; min-height: 400px; object-fit: cover; object-position: 50% 56%; border-radius: clamp(17px, 3.3vw, 34px); }

.scene { display: block; width: 100%; overflow: hidden; border: 4px solid var(--paper); border-radius: 24px; box-shadow: var(--shadow); }
.scene image { image-rendering: auto; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  text-align: left;
  padding: 8px 8px 14px;
  border: 1px solid var(--edge);
  border-radius: 21px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.card.ready { border-color: #a97317; }
.card .face {
  position: relative;
  height: clamp(100px, 18vh, 173px);
  overflow: hidden;
  border-radius: 15px;
  background: radial-gradient(ellipse at 50% 42%, #fff8df 10%, #f2dfb6);
}
.card:nth-child(2) .face { background: radial-gradient(ellipse, #edfaff, #cce5f1); }
.card:nth-child(3) .face { background: radial-gradient(ellipse, #fff5ea, #f3d9d4); }
.card .face .critter { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .info { display: flex; flex-direction: column; gap: 4px; padding-inline: 7px; }
.name { font: 700 1.4rem/1.15 var(--display); }
.name em { margin-left: 6px; padding: 2px 7px; border-radius: 99px; vertical-align: middle; background: #fae3a8; font: 850 .8rem/1.15 var(--text); }
.card .chips { display: flex; gap: 7px; margin-top: 3px; }
.chip { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #eaf1ee; color: #526963; }
.chip.done { background: var(--teal); color: #fff; }
.chip b { position: absolute; right: -4px; top: -4px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--sun); color: var(--ink); font-size: .68rem; }
.goal { text-align: center; color: var(--muted); }

.bar { display: flex; align-items: center; gap: 11px; }
.bar > div { min-width: 0; }
.grow { flex: 1; }
.portrait {
  width: min(74%, 285px, 38vh);
  aspect-ratio: 200/220;
  align-self: center;
  border-radius: 46%;
  background: radial-gradient(ellipse, #fff9e6, #f6e1ab80 61%, transparent 72%);
}
.portrait.small { width: min(64%, 230px, 31vh); }
.traits { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.trait { padding: 5px 10px; border: 1px solid #87bcb0; border-radius: 99px; background: var(--paper); color: var(--teal-dark); font-size: .92rem; font-weight: 850; }
.trait.unknown { min-width: 50px; border-style: dashed; text-align: center; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 86px; padding: 8px 3px; border: 1px solid #0001; border-radius: 17px; box-shadow: 0 4px 0 #24243a35; color: #fff; font-weight: 850; line-height: 1.15; }
.act.wash { background: #216993; }
.act.feed { background: #944816; }
.act.care { background: var(--plum); }
.act:disabled { border-color: var(--edge); background: var(--paper); color: var(--muted); box-shadow: none; }
.result { display: flex; flex-direction: column; gap: 13px; margin-block: auto; padding: clamp(16px, 4vw, 28px); border: 1px solid var(--edge); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.result h1 { color: var(--teal-dark); font-size: clamp(2rem, 5vw, 2.8rem); }
.result .panel { background: #edf5eb; box-shadow: none; }
.big-stars { font-size: 3rem; line-height: 1.12; }
.big-stars .stars i { animation: pop .45s backwards; }
.big-stars .stars i:nth-child(2) { animation-delay: .18s; }
.big-stars .stars i:nth-child(3) { animation-delay: .36s; }
@keyframes pop { from { transform: scale(0) rotate(-60deg); } 70% { transform: scale(1.2); } }

.game { display: flex; flex-direction: column; gap: 8px; flex: 1 0 auto; height: 100%; min-height: 410px; }
.meter { height: 9px; margin-top: 5px; background: #fff; border: 1px solid #b6d2c3; border-radius: 99px; overflow: hidden; }
.meter i { display: block; width: 0; height: 100%; background: var(--teal); transition: width .2s; }
.hint { display: grid; place-items: center; min-height: 2.8em; padding-inline: 5px; font-weight: 850; text-align: center; }
.stage {
  position: relative;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #a6c8c0;
  border-radius: 22px;
  background: radial-gradient(ellipse at 50% 40%, #fffaf0, #e1efe4 67%, #cde7da);
  box-shadow: inset 0 0 0 4px #fff8;
}
.stage[data-art="wash"] { background: radial-gradient(ellipse, #f8fcff, #d6edf5 62%, #b8dce9); }
.board { position: relative; flex: none; touch-action: none; user-select: none; }
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.board.sky { width: 100%; border-radius: inherit; background: #bddfec url("arta/poiana.webp") center 80% / cover no-repeat; }
.overlay { position: absolute; inset: 0; z-index: 3; display: flex; justify-content: center; align-items: center; padding: 8px; background: #dcefebd9; }
.overlay .panel { display: flex; flex-direction: column; gap: 8px; width: min(100%, 410px); max-height: 100%; overflow: auto; text-align: center; }
.phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; list-style-position: inside; }
.phases li { padding: 8px 2px; border: 1px solid var(--edge); border-radius: 12px; background: var(--paper); text-align: center; font-weight: 850; }
.phases .now { border-color: var(--teal); background: var(--teal); color: #fff; }
.phases .past { background: #d2e8de; }
.foods { display: flex; justify-content: center; gap: 9px; }
.foods figure { width: 74px; margin: 0; font-size: .875rem; line-height: 1.15; font-weight: 850; }
.foods img { display: block; width: 48px; height: 48px; margin-inline: auto; object-fit: contain; }
.ok-t { color: var(--teal-dark); }
.no-t { color: #a23647; }
.flea { position: absolute; z-index: 2; width: 52px; height: 48px; padding: 3px; border: 0; background: none; translate: -50% -50%; transition: left .16s, top .16s, scale .2s, opacity .2s; touch-action: none; }
.flea svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 2px #fff); }
.flea.caught { scale: 2; opacity: 0; pointer-events: none; }
.kit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 63px; padding: 5px 1px; border: 2px solid var(--c); border-radius: 12px; background: var(--paper); color: var(--c); font-size: clamp(.67rem, 3vw, .88rem); font-weight: 900; }
.tool.waiting { opacity: .8; }
.tool.lit { opacity: 1; background: var(--c); color: #fff; transform: scale(1.04); }
.dots { display: flex; justify-content: center; min-height: 13px; gap: 7px; margin-bottom: 6px; }
.dots i { width: 13px; height: 13px; border: 2px solid var(--teal); border-radius: 50%; background: var(--paper); }
.dots .on { background: var(--teal); }
.applied { position: absolute; left: 62%; top: 60%; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--paper); box-shadow: var(--shadow); pointer-events: none; animation: pop .35s; }
.syrup { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6%; }
.patient { width: 54%; max-height: 90%; aspect-ratio: 200/220; }
.cup { position: relative; width: 26%; max-width: 120px; height: min(82%, 320px); border: 4px solid #343952; border-top-width: 0; border-radius: 7px 7px 28px 28px; background: repeating-linear-gradient(to top, transparent 0 calc(10% - 2px), #1f2a4a2d calc(10% - 2px) 10%), #fffdf6; box-shadow: 3px 7px 0 #56627f20; }
.liquid { position: absolute; inset: auto 0 0; height: 0; border-radius: 0 0 22px 22px; background: linear-gradient(90deg, #ab3d71, #d2578e 43%, #e875a1); }
.mark { position: absolute; left: -9px; right: -9px; height: 12%; translate: 0 50%; border-block: 2px dashed #176957; background: #78ba7d70; }
.mark i { position: absolute; inset: calc(50% - 2px) 0 auto; height: 4px; background: #176957; }
.pour { padding-block: 13px; background: var(--plum); box-shadow: 0 4px 0 #483474; touch-action: none; }
.pour.held { transform: translateY(3px); box-shadow: 0 1px 0 #483474; }

.who { display: flex; align-items: center; gap: 12px; }
.who .face { width: 88px; height: 95px; flex: none; }
.who .traits { flex-direction: column; align-items: flex-start; min-width: 0; }
.say { padding: 10px 14px; border-radius: 14px; background: #fae3a8; text-align: center; font-weight: 850; }
.family { display: flex; flex-direction: column; gap: 8px; }
.fhead { display: flex; align-items: center; gap: 10px; }
.fhead img { object-fit: contain; }
.fhead .house-mint { filter: hue-rotate(235deg) saturate(.72); }
.family ul { margin: 0; padding-left: 21px; }
.family.declined { background: #edf2eb; }
.family .btn:disabled { background: #e1e9e3; color: #4a6060; box-shadow: none; }
.album { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.album figure { display: flex; flex-direction: column; gap: 6px; margin: 0; text-align: center; }
.album .face { width: 82%; max-width: 165px; aspect-ratio: 200/220; margin-inline: auto; }
.album figcaption { display: flex; flex-direction: column; }
.album b { font: 700 1.18rem var(--display); }
.how { margin: 0; padding-left: 36px; display: flex; flex-direction: column; gap: 8px; }
.two { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.confetti { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.4s linear both; }
@keyframes fall { to { transform: translateY(105vh) rotate(560deg); } }

@media (hover: hover) {
  .card:hover, .icon-btn:hover, .tabs button:not([aria-current]):hover { border-color: #7aa997; background-color: #f1f7ee; }
  .btn:not(:disabled):hover { filter: brightness(1.07); }
}
@media (max-width: 650px) {
  .welcome { grid-template-columns: 1fr; }
  .welcome-art { grid-row: 1; min-height: 0; height: auto; aspect-ratio: 1.2; object-position: center; }
  .welcome-copy { align-items: center; gap: 12px; text-align: center; }
  .welcome h1 { font-size: clamp(1.8rem, 15cqi, 3.5rem); }
  .welcome .btn { width: min(100%, 300px); }
  .cards { grid-template-columns: 1fr; gap: 8px; }
  .card { flex-direction: row; align-items: center; padding: 6px; }
  .card .face { width: 84px; height: 87px; flex: none; }
  .card .info { padding: 1px 4px; }
  .scene { border-radius: 15px; }
}
@media (max-width: 360px) {
  .top { gap: 6px; padding-inline: 10px; }
  .brand { gap: 5px; font-size: 1rem; }
  .brand img { height: 35px; }
  .stats { gap: 4px; }
  .pill { min-width: 38px; padding-inline: 4px; }
  .tabs button { gap: 3px; font-size: .95rem; }
  .tool { font-size: .67rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
