:root {
  --cream: #fff7df;
  --paper: rgba(255,255,255,.82);
  --ink: #28150f;
  --muted: #7e685e;
  --line: rgba(55,29,17,.14);
  --yellow: #ffd20a;
  --orange: #ff7817;
  --red: #e9172d;
  --green: #4f9e52;
  --shadow: 0 20px 70px rgba(87,42,11,.13);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background:
    linear-gradient(rgba(255,247,223,.88),rgba(255,247,223,.92)),
    radial-gradient(circle at 20% 20%,var(--yellow),transparent 32rem),
    radial-gradient(circle at 90% 80%,#ff9f8b,transparent 30rem),
    var(--cream);
}
body::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: 0;
  opacity: .32;
  background-image: radial-gradient(rgba(63,34,19,.16) 1px,transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}
button { color: inherit; font: inherit; }
button:focus-visible { outline: 4px solid #1979ff; outline-offset: 4px; }
.ambient { position: fixed; z-index: -1; width: 30rem; aspect-ratio: 1; border-radius: 50%; filter: blur(90px); opacity: .2; pointer-events: none; }
.ambient-one { top: -14rem; right: -7rem; background: var(--yellow); }
.ambient-two { bottom: -16rem; left: -8rem; background: var(--red); }

.app-shell { width: min(1480px,calc(100% - 32px)); margin: auto; padding: 18px 0 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 48px; aspect-ratio: 1; place-items: center; border: 2px solid var(--ink); border-radius: 15px; color: white; background: linear-gradient(145deg,var(--orange),var(--red)); box-shadow: 4px 4px 0 var(--ink); font-weight: 1000; transform: rotate(-3deg); }
.brand span:last-child > * { display: block; }
.brand small,.kicker,.board-label { font-size: .58rem; font-weight: 950; letter-spacing: .2em; }
.brand small { color: var(--muted); }
.brand strong { margin-top: 3px; font-size: clamp(.95rem,2vw,1.35rem); letter-spacing: -.04em; }
.brand strong b { color: var(--red); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.round-button,.soft-button { border: 1px solid var(--line); background: rgba(255,255,255,.7); cursor: pointer; }
.round-button { width: 43px; height: 43px; border-radius: 50%; font-size: 1.15rem; font-weight: 900; }
.round-button.off { color: #a89b95; text-decoration: line-through; }
.soft-button { min-height: 40px; padding: 0 15px; border-radius: 12px; font-size: .72rem; font-weight: 900; }
.soft-button:hover,.round-button:hover { background: white; transform: translateY(-1px); }
.soft-button.danger { color: var(--red); }

.number-board { position: relative; overflow: hidden; padding: 25px clamp(18px,4vw,45px) 18px; border: 2px solid var(--ink); border-radius: 25px; color: white; background: linear-gradient(112deg,#2b1710,#542115 55%,#9d1a1f); box-shadow: 7px 7px 0 var(--ink),var(--shadow); }
.number-board::after { content: "∞"; position: absolute; right: -20px; top: -70px; color: rgba(255,210,10,.1); font-size: 15rem; font-weight: 1000; line-height: 1; pointer-events: none; }
.board-label { position: relative; z-index: 1; color: #ffd96a; }
#power-value { position: relative; z-index: 1; display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: clamp(2.6rem,8vw,7rem); font-weight: 1000; line-height: .95; letter-spacing: -.075em; font-variant-numeric: tabular-nums; text-shadow: 0 0 35px rgba(255,112,23,.35); }
.board-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 20px; }
.board-stats span { min-width: 0; padding: 10px 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.06); }
.board-stats small,.board-stats b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-stats small { color: rgba(255,255,255,.54); font-size: .55rem; font-weight: 800; }
.board-stats b { margin-top: 3px; color: #fff1a4; font-size: .85rem; }

.panel { border: 2px solid var(--ink); border-radius: 24px; background: var(--paper); box-shadow: 7px 7px 0 var(--ink),var(--shadow); backdrop-filter: blur(14px); }
.game-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); gap: 16px; margin-top: 18px; }
.click-zone { position: relative; overflow: hidden; padding: clamp(18px,3vw,32px); }
.zone-heading,.shop-heading { position: relative; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.kicker { color: var(--red); }
.zone-heading h1 { margin: 7px 0 0; font-size: clamp(1.8rem,4vw,3.5rem); line-height: .98; letter-spacing: -.07em; }
.zone-heading h1 b { color: var(--red); }
.combo-chip { flex: 0 0 auto; min-width: 94px; padding: 10px 12px; border: 1px solid rgba(233,23,45,.2); border-radius: 14px; text-align: right; background: #fff2d0; }
.combo-chip small,.combo-chip strong { display: block; }
.combo-chip small { color: var(--muted); font-size: .5rem; font-weight: 900; letter-spacing: .12em; }
.combo-chip strong { margin-top: 3px; color: var(--red); font-size: 1.05rem; }

.fruit-stage { position: relative; display: grid; min-height: 380px; place-items: center; isolation: isolate; }
.fruit-stage::before { content: ""; position: absolute; z-index: -2; width: min(62vw,360px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle,#fff8a8 0 20%,rgba(255,210,10,.22) 50%,transparent 72%); animation: breathe 2.6s ease-in-out infinite; }
.orbit { position: absolute; z-index: -1; width: 310px; aspect-ratio: 1; border: 1px dashed rgba(89,45,22,.2); border-radius: 50%; animation: spin 15s linear infinite; }
.orbit::before,.orbit::after { content: ""; position: absolute; width: 12px; aspect-ratio: 1; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 6px rgba(255,120,23,.12); }
.orbit::before { left: 15px; top: 63px; }
.orbit::after { right: 11px; bottom: 70px; background: var(--red); }
.orbit-two { width: 245px; animation-direction: reverse; animation-duration: 10s; }
.orbit-two::before { left: auto; right: -5px; top: 110px; background: var(--yellow); }
.orbit-two::after { left: 30px; right: auto; bottom: 35px; background: var(--green); }
.fruit-button { position: relative; z-index: 2; width: min(62vw,290px); aspect-ratio: 1; border: 0; border-radius: 50%; background: transparent; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; filter: drop-shadow(0 22px 20px rgba(148,50,10,.18)); transition: transform .08s ease,filter .15s ease; }
.fruit-button img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.fruit-button > span { position: absolute; left: 50%; bottom: -3px; padding: 6px 13px; border: 2px solid var(--ink); border-radius: 999px; color: white; background: var(--red); box-shadow: 3px 3px 0 var(--ink); font-size: .7rem; font-weight: 1000; letter-spacing: .13em; transform: translateX(-50%) rotate(-4deg); }
.fruit-button:hover { filter: drop-shadow(0 25px 24px rgba(148,50,10,.25)) brightness(1.04); transform: scale(1.025) rotate(1deg); }
.fruit-button:active,.fruit-button.pressed { filter: drop-shadow(0 10px 10px rgba(148,50,10,.16)); transform: scale(.92) rotate(-2deg); }
.fruit-button.fever { animation: fever-shake .22s linear infinite; filter: drop-shadow(0 0 24px rgba(255,210,10,.85)); }
.float-layer { position: absolute; z-index: 5; inset: 0; overflow: hidden; pointer-events: none; }
.float-number { position: absolute; color: var(--red); font-size: clamp(1rem,3vw,1.65rem); font-weight: 1000; text-shadow: 0 2px white,2px 0 white,-2px 0 white; transform: translate(-50%,-50%); animation: float-up .9s ease-out forwards; }
.tap-help { margin: -3px 0 17px; color: var(--muted); text-align: center; font-size: .68rem; font-weight: 700; }
kbd { display: inline-grid; min-width: 50px; height: 25px; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; box-shadow: 0 3px 0 rgba(55,29,17,.2); font: 900 .58rem inherit; }

.inflation-progress,.overdrive { position: relative; z-index: 2; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.72); }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; font-size: .7rem; }
.progress-copy span { color: var(--muted); }
.progress-track,.overdrive-track { height: 12px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: #eee4cc; }
.progress-track i,.overdrive-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--yellow),var(--orange),var(--red)); transition: width .2s ease; }
.inflation-progress > small { display: block; margin-top: 8px; color: var(--muted); font-size: .55rem; }
.overdrive { display: grid; grid-template-columns: 1fr minmax(180px,.8fr); align-items: center; gap: 18px; margin-top: 10px; background: #2c1710; }
.overdrive strong { display: block; margin-top: 4px; color: white; font-size: .67rem; }
.overdrive-track { position: relative; margin: 0; background: rgba(255,255,255,.12); }
.overdrive-track b { position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: .52rem; line-height: 1; }
.fever-banner { position: absolute; z-index: 8; left: 50%; top: 18px; display: flex; align-items: center; gap: 12px; padding: 9px 16px; border: 2px solid var(--ink); border-radius: 999px; color: var(--ink); background: linear-gradient(90deg,var(--yellow),#fff491); box-shadow: 4px 4px 0 var(--ink); font-size: .7rem; font-weight: 1000; opacity: 0; pointer-events: none; transform: translate(-50%,-30px); transition: .25s; }
.fever-banner.show { opacity: 1; transform: translate(-50%,0); }
.fever-banner b { color: var(--red); font-variant-numeric: tabular-nums; }

.shop { min-height: 740px; padding: 22px; }
.shop-heading h2,.prestige h2 { margin: 5px 0 0; font-size: 1.7rem; letter-spacing: -.05em; }
.buy-modes { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.7); }
.buy-modes button { min-width: 43px; padding: 7px 8px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: .58rem; font-weight: 950; cursor: pointer; }
.buy-modes button.selected { color: white; background: var(--ink); }
.hold-hint { margin: 12px 0 0; color: var(--muted); font-size: .56rem; font-weight: 800; text-align: right; }
.shop-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.upgrade { position: relative; display: grid; grid-template-columns: 47px minmax(0,1fr) auto; align-items: center; gap: 11px; width: 100%; min-height: 73px; padding: 9px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; text-align: left; background: rgba(255,255,255,.74); cursor: pointer; touch-action:manipulation; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; transition: .15s; }
.upgrade:hover:not(:disabled) { border-color: rgba(233,23,45,.45); background: white; transform: translateX(-2px); }
.upgrade:active:not(:disabled) { transform: scale(.98); }
.upgrade.holding:not(:disabled) { border-color:var(--red); background:#fff2ce; box-shadow:inset 5px 0 var(--red); animation:hold-pulse .45s ease-in-out infinite alternate; }
.upgrade:disabled { cursor: not-allowed; opacity: .48; }
.upgrade.affordable { box-shadow: inset 4px 0 var(--orange); }
.upgrade-icon { display: grid; width: 47px; aspect-ratio: 1; place-items: center; border-radius: 13px; color: white; background: linear-gradient(145deg,var(--orange),var(--red)); font-size: 1.4rem; box-shadow: inset 0 1px rgba(255,255,255,.3); }
.upgrade:nth-child(3n+2) .upgrade-icon { color: #5a3b00; background: linear-gradient(145deg,#fff181,var(--yellow)); }
.upgrade:nth-child(3n) .upgrade-icon { background: linear-gradient(145deg,#80cf7a,var(--green)); }
.upgrade-copy { min-width: 0; }
.upgrade-copy strong,.upgrade-copy small { display: block; }
.upgrade-copy strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.upgrade-copy small { margin-top: 3px; color: var(--muted); font-size: .55rem; }
.upgrade-cost { min-width: 74px; text-align: right; }
.upgrade-cost b,.upgrade-cost small { display: block; }
.upgrade-cost b { color: var(--red); font-size: .75rem; }
.upgrade-cost small { margin-top: 4px; color: var(--muted); font-size: .5rem; }
.upgrade.locked::after { content: attr(data-lock); position: absolute; inset: 0; display: grid; place-items: center; color: white; background: rgba(40,21,15,.88); font-size: .62rem; font-weight: 900; letter-spacing: .05em; }

.prestige { display: grid; grid-template-columns: 1.3fr .8fr auto; align-items: center; gap: 30px; margin-top: 18px; padding: 25px 28px; background: linear-gradient(120deg,rgba(255,255,255,.85),rgba(255,227,147,.78)); }
.prestige-copy p { max-width: 630px; margin: 8px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.7; }
.prestige-meter span,.prestige-meter strong,.prestige-meter small { display: block; }
.prestige-meter span { color: var(--muted); font-size: .55rem; font-weight: 800; }
.prestige-meter strong { margin-top: 4px; font-size: 1.2rem; overflow-wrap: anywhere; }
.prestige-meter small { margin-top: 3px; color: var(--red); font-size: .55rem; font-weight: 850; }
.prestige-button { min-width: 190px; min-height: 66px; padding: 8px 18px; border: 2px solid var(--ink); border-radius: 15px; color: white; background: linear-gradient(135deg,var(--orange),var(--red)); box-shadow: 4px 4px 0 var(--ink); cursor: pointer; }
.prestige-button:disabled { filter: grayscale(.7); cursor: not-allowed; opacity: .45; }
.prestige-button small,.prestige-button strong { display: block; }
.prestige-button small { font-size: .5rem; letter-spacing: .1em; }
.prestige-button strong { margin-top: 3px; font-size: .85rem; }

footer { display: flex; justify-content: space-between; gap: 12px; padding: 17px 5px 0; color: var(--muted); font-size: .58rem; font-weight: 750; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; max-width: calc(100% - 30px); padding: 12px 18px; border: 2px solid var(--ink); border-radius: 999px; color: white; background: var(--ink); box-shadow: 4px 4px 0 var(--red); font-size: .72rem; font-weight: 850; opacity: 0; pointer-events: none; transform: translate(-50%,25px); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
dialog { width: min(440px,calc(100% - 30px)); padding: 0; border: 2px solid var(--ink); border-radius: 22px; color: var(--ink); background: var(--cream); box-shadow: 8px 8px 0 var(--ink); }
dialog::backdrop { background: rgba(40,21,15,.55); backdrop-filter: blur(5px); }
dialog form { padding: 28px; }
dialog h2 { margin: 8px 0; font-size: 1.7rem; }
dialog p { color: var(--muted); font-size: .75rem; line-height: 1.7; }
dialog form > div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

@keyframes spin { to { transform: rotate(1turn); } }
@keyframes breathe { 50% { transform: scale(1.09); opacity: .72; } }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%,0) scale(.7); } 18% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-95px) scale(1.15) rotate(-4deg); } }
@keyframes fever-shake { 25% { transform: translateX(-3px) rotate(-1deg); } 75% { transform: translateX(3px) rotate(1deg); } }
@keyframes hold-pulse { to { filter:brightness(1.05); transform:scale(.985); } }

@media (max-width: 980px) {
  .game-grid { grid-template-columns: 1fr; }
  .shop { min-height: 0; }
  .shop-list { display: grid; grid-template-columns: repeat(2,1fr); }
  .prestige { grid-template-columns: 1fr 1fr; }
  .prestige-button { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .app-shell { width: calc(100% - 18px); padding-top: 9px; }
  .brand-mark { width: 41px; border-radius: 12px; }
  .brand small { display: none !important; }
  .brand strong { font-size: .9rem; }
  .soft-button { min-height: 38px; padding: 0 10px; }
  #save-button { display: none; }
  .number-board { padding: 18px 15px 14px; border-radius: 19px; box-shadow: 4px 4px 0 var(--ink),var(--shadow); }
  #power-value { font-size: clamp(2.2rem,14vw,4.5rem); }
  .board-stats { grid-template-columns: repeat(2,1fr); margin-top: 15px; }
  .panel { border-radius: 19px; box-shadow: 4px 4px 0 var(--ink),var(--shadow); }
  .click-zone { padding: 16px 12px; }
  .zone-heading h1 { font-size: 1.85rem; }
  .combo-chip { min-width: 82px; padding: 8px; }
  .fruit-stage { min-height: 325px; }
  .fruit-button { width: min(72vw,255px); }
  .orbit { width: 270px; }
  .orbit-two { width: 215px; }
  .overdrive { grid-template-columns: 1fr; gap: 10px; }
  .shop { padding: 17px 12px; }
  .shop-heading { align-items: center; }
  .shop-list { grid-template-columns: 1fr; }
  .upgrade { grid-template-columns: 44px minmax(0,1fr) auto; }
  .prestige { grid-template-columns: 1fr; gap: 18px; padding: 20px 17px; }
  .prestige-button { grid-column: auto; min-width: 0; width: 100%; }
  footer { flex-direction: column; gap: 5px; }
}

@media (max-width: 390px) {
  .top-actions { gap: 5px; }
  .round-button { width: 38px; height: 38px; }
  .soft-button { font-size: .62rem; }
  .brand-mark { width: 37px; font-size: .76rem; }
  .brand strong { font-size: .78rem; }
  .zone-heading { align-items: center; }
  .zone-heading h1 { font-size: 1.55rem; }
  .fruit-stage { min-height: 290px; }
  .fruit-button { width: 225px; }
  .orbit { width: 240px; }
  .orbit-two { width: 195px; }
  .tap-help { line-height: 1.7; }
}

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