@font-face {
  font-family: Silkscreen;
  src: url('assets/fonts/silkscreen-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Silkscreen;
  src: url('assets/fonts/silkscreen-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --bg: #fff8ed;
  --surface: #fffaf3;
  --ink: #3d3028;
  --muted: #806e5c;
  --line: #ceb69e;
  --accent: #cd7947;
  --accent-dark: #b66036;
  --accent-soft: #ffe7d1;
  --button-text: #fffaf2;
  --sage: #9ba27a;
  --ground: #f5dfc8;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif; -webkit-font-smoothing: antialiased; transition: background-color .2s, color .2s; }
body.dark { color-scheme: dark; --bg: #25211e; --surface: #2d2723; --ink: #f6ead9; --muted: #c1ac96; --line: #75604f; --accent: #df996d; --accent-dark: #a96740; --accent-soft: #493126; --button-text: #28211c; --sage: #b1b98f; --ground: #463427; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
.page-width { width: min(1440px, calc(100% - 112px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 0; }
.brand { display: flex; align-items: center; text-decoration: none; font: 700 30px/1.2 Silkscreen, monospace; letter-spacing: -.06em; }
.brand span { margin-left: 24px; padding-left: 24px; border-left: 2px solid var(--line); font: 600 18px/1.2 'PingFang SC', 'Microsoft YaHei', sans-serif; letter-spacing: .03em; }
.utilities { display: flex; align-items: center; gap: 17px; }
.utilities button { display: flex; align-items: center; gap: 9px; border: 0; padding: 8px 0; background: transparent; font-size: 14px; line-height: 1.4; white-space: nowrap; }
.utilities button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.utility-icon { color: var(--sage); flex-shrink: 0; }
.utility-divider { width: 2px; height: 17px; background: var(--line); }
.play-icon { display: none; }
#motion[aria-pressed='true'] .play-icon { display: block; }
#motion[aria-pressed='true'] .pause-icon { display: none; }
main { flex: 1; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-areas: 'copy cat' 'feeding cat' 'picker picker'; column-gap: clamp(36px, 6vw, 96px); row-gap: 28px; padding: 20px 0 32px; align-items: center; }
.hero-copy { grid-area: copy; align-self: end; min-width: 0; }
h1 { margin: 0 0 20px; font-size: clamp(48px, 5.2vw, 80px); font-weight: 650; line-height: 1.12; letter-spacing: -.06em; }
.intro-description { margin: 0; max-width: 28em; font-size: clamp(16px, 1.25vw, 20px); line-height: 1.8; letter-spacing: .01em; }
.feeding-panel { grid-area: feeding; align-self: start; min-width: 0; }
.feeding-total { padding-left: 21px; border-left: 4px solid var(--sage); }
.total-label { display: block; font-size: 15px; font-weight: 500; line-height: 1.6; }
.total-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; margin: 4px 0; }
#total { display: flex; max-width: 100%; font: 700 70px/1 Silkscreen, monospace; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.digit { display: inline-block; position: relative; width: .84em; flex: 0 0 .84em; height: 1.16em; overflow: hidden; perspective: 200px; }
.digit > span { position: absolute; inset: 0; text-align: center; padding-top: .06em; }
.digit-current { transform: translateY(0); }
.digit-previous { opacity: 0; }
.rolling .digit-current { animation: roll-in .78s cubic-bezier(.16, 1, .3, 1) both; animation-delay: var(--delay); }
.rolling .digit-previous { animation: roll-out .5s cubic-bezier(.5, 0, .5, 1) both; animation-delay: var(--delay); }
.unit { font-size: 18px; transform: translateY(6px); }
#storage-note { display: block; font-size: 12px; color: var(--muted); line-height: 1.8; }
.pixel-button { position: relative; display: inline-flex; justify-content: center; min-width: 236px; min-height: 58px; align-items: center; padding: 14px 28px; border: 2px solid var(--accent-dark); background: var(--accent); color: var(--button-text); font-size: 20px; font-weight: 700; letter-spacing: .03em; box-shadow: 0 3px 0 var(--accent-dark); clip-path: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px)); transition: transform .15s, background-color .15s; }
#feed { margin-top: 25px; }
.pixel-button:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-2px); }
.pixel-button:active:not(:disabled) { transform: translateY(1px); }
.pixel-button:disabled { opacity: .6; }
.status { color: var(--muted); font-size: 14px; line-height: 1.8; min-height: 1.8em; margin: 12px 0 0; }
.cat-area { grid-area: cat; min-width: 0; width: 100%; align-self: center; text-align: center; }
.cat-stage { display: block; position: relative; width: min(100%, 520px); aspect-ratio: 1; margin: 0 auto; padding: 0; border: 0; background: transparent; touch-action: manipulation; outline-offset: -4px; }
#canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.stage-ground { position: absolute; z-index: 0; bottom: 5%; left: 10%; right: 10%; height: 12px; background: repeating-conic-gradient(var(--ground) 0 25%, transparent 0 50%) 0 0 / 24px 24px; opacity: .65; }
.cat-loading { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
body.loaded .cat-loading { display: none; }
.stage-hint { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 6px 0 0; }
.cat-picker { grid-area: picker; min-width: 0; padding-top: 8px; }
.cat-picker h2 { margin: 0 0 18px; font-size: 23px; font-weight: 600; letter-spacing: -.03em; line-height: 1.4; }
.cat-options { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: 18px; }
.cat-option { isolation: isolate; display: grid; place-items: center; position: relative; min-width: 0; height: 138px; border: 0; background: var(--line); padding: 5px 10px; clip-path: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px)); transition: background-color .15s, transform .15s; }
.cat-option::before { content: ''; position: absolute; inset: 2px; z-index: -1; background: var(--surface); clip-path: inherit; }
.cat-option[aria-pressed='true'] { background: var(--accent-dark); }
.cat-option[aria-pressed='true']::before { background: var(--accent-soft); }
.cat-option:hover:not(:disabled) { background: var(--accent); transform: translateY(-2px); }
.cat-option:disabled { cursor: wait; }
.cat-option.is-error { opacity: .4; cursor: default; }
.cat-option.is-loading { opacity: .55; }
.cat-option-image { display: block; width: min(100%, 122px); height: auto; aspect-ratio: 1; image-rendering: pixelated; pointer-events: none; }
.cat-option-name, .cat-option-note { display: none; }
.site-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; border-top: 1px solid var(--line); padding: 20px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.site-footer span:first-child { color: var(--ink); }
.public-security { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; text-decoration: none; }
.public-security img { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.public-security span { min-width: 0; overflow-wrap: anywhere; }
.public-security:hover { text-decoration: underline; text-underline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sage); outline-offset: 5px; }
.pixel-button:focus-visible { outline: 0; box-shadow: inset 0 0 0 4px var(--ink); }
.cat-option:focus-visible { outline: 0; background: var(--ink); }
.cat-option:focus-visible::before { inset: 4px; }
@keyframes roll-in { 0% { transform: translateY(100%) rotateX(-35deg); filter: blur(6px); opacity: .2; } 70% { transform: translateY(-4%) rotateX(0); filter: blur(0); opacity: 1; } 100% { transform: translateY(0); filter: blur(0); opacity: 1; } }
@keyframes roll-out { 0% { transform: translateY(0); filter: blur(0); opacity: 1; } 100% { transform: translateY(-110%) rotateX(35deg); filter: blur(5px); opacity: 0; } }
@media (min-width: 961px) and (max-height: 820px) {
  .site-header { padding-block: 21px; }
  .hero { padding-top: 8px; padding-bottom: 24px; row-gap: 18px; }
  h1 { font-size: clamp(48px, 4.9vw, 68px); margin-bottom: 14px; }
  .cat-stage { width: min(100%, 410px); }
  .cat-option { height: 112px; }
  .cat-option-image { width: min(100%, 100px); }
  .cat-picker h2 { margin-bottom: 13px; font-size: 21px; }
  #feed { margin-top: 19px; }
  #total { font-size: 62px; }
  .site-footer { padding-block: 16px; }
}
@media (max-width: 960px) {
  .page-width { width: calc(100% - 56px); }
  .site-header { padding-block: 23px; }
  .brand { font-size: 25px; }
  .brand span { font-size: 15px; margin-left: 16px; padding-left: 16px; }
  .utilities { gap: 12px; }
  .utilities button { font-size: 13px; gap: 6px; }
  .hero { grid-template-columns: 1fr; grid-template-areas: 'copy' 'cat' 'picker' 'feeding'; row-gap: 24px; padding-top: 24px; }
  h1 { font-size: 56px; line-height: 1.14; }
  .intro-description { font-size: 17px; }
  .cat-stage { width: min(100%, 410px); }
  .cat-picker { padding: 0; }
  .cat-picker h2 { font-size: 21px; margin-bottom: 14px; }
  .cat-options { gap: 12px; }
  .cat-option { height: 116px; padding: 4px; }
  .cat-option-image { width: min(100%, 102px); }
  .feeding-panel { margin-top: 4px; }
}
@media (max-width: 600px) {
  .page-width { width: calc(100% - 40px); }
  .site-header { padding-block: 20px; gap: 12px; align-items: center; }
  .brand { font-size: 23px; }
  .brand span { display: none; }
  .utilities { gap: 11px; }
  .utilities button { font-size: 12px; gap: 5px; min-height: 40px; }
  .utility-icon { width: 17px; height: 18px; }
  .utility-divider { width: 1px; height: 13px; }
  .hero { padding-top: 18px; row-gap: 20px; padding-bottom: 28px; }
  h1 { font-size: clamp(38px, 11vw, 50px); margin-bottom: 15px; letter-spacing: -.05em; }
  .intro-description { max-width: 23em; font-size: 15px; line-height: 1.8; }
  .cat-stage { width: min(100%, 330px); }
  .stage-hint { font-size: 12px; margin: 0; }
  .cat-picker h2 { font-size: 18px; margin-bottom: 12px; }
  .cat-options { gap: 8px; }
  .cat-option { height: 86px; padding: 3px 2px; border-width: 1px; }
  .cat-option-image { width: 100%; max-width: 76px; }
  .feeding-total { padding-left: 16px; border-left-width: 3px; }
  .total-label { font-size: 13px; }
  #total { font-size: 56px; }
  .total-row { gap: 12px; margin-block: 3px; }
  .unit { font-size: 15px; transform: translateY(3px); }
  #storage-note { font-size: 12px; }
  #feed { margin-top: 22px; min-width: 100%; font-size: 19px; }
  .status { font-size: 13px; }
  .site-footer { align-items: start; flex-direction: column; gap: 5px; padding-block: 17px; font-size: 12px; }
}
@media (max-width: 360px) {
  .page-width { width: calc(100% - 32px); }
  .brand { font-size: 20px; }
  .utilities { gap: 8px; }
  .utilities button { font-size: 12px; }
  .utility-divider { display: none; }
  .cat-options { gap: 6px; }
  .cat-option { height: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .rolling .digit-current, .rolling .digit-previous { animation: none; }
  .digit-previous { display: none; }
}
