/* Reuse the Portal palette, font, topbar and raised controls. Game-only variables
   describe the canvas; a theme change refreshes its cached palette once. */
:root {
  --suika-arena-top: #272151; --suika-arena-bottom: #1c1740;
  --suika-grid: #ffffff0d; --suika-wall: #706798; --suika-floor: #897aad;
  --suika-edge: #c3b4e6; --suika-limit: #968bb9; --suika-aim: #ffdd62;
  --suika-cooldown: #766a93; --suika-landing: #ffdd6266;
}
:root[data-theme="light"] {
  --suika-arena-top: #fff9e7; --suika-arena-bottom: #f4e7bf;
  --suika-grid: #654d4c12; --suika-wall: #d7b872; --suika-floor: #be9651;
  --suika-edge: #92753b; --suika-limit: #9a8250; --suika-aim: #b7337a;
  --suika-cooldown: #b9a88b; --suika-landing: #b7337a66;
}
@media(prefers-color-scheme:light) {
  :root:not([data-theme="dark"]) {
    --suika-arena-top: #fff9e7; --suika-arena-bottom: #f4e7bf;
    --suika-grid: #654d4c12; --suika-wall: #d7b872; --suika-floor: #be9651;
    --suika-edge: #92753b; --suika-limit: #9a8250; --suika-aim: #b7337a;
    --suika-cooldown: #b9a88b; --suika-landing: #b7337a66;
  }
}
button, input {font:inherit} button {touch-action:manipulation}
button:disabled {cursor:default;opacity:.55}
button:focus-visible,a:focus-visible,summary:focus-visible,canvas:focus-visible {outline:3px solid var(--glow-b);outline-offset:4px}
svg {width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.topbar .brand img {flex:none} .topbar .brand {text-decoration:none}
.page-wrap {max-width:1120px;margin:auto;padding:0 20px}
.intro {padding:24px 0 22px;text-align:center;max-width:716px;margin:auto}
h1 {font-size:38px;line-height:1.3;letter-spacing:-1.4px;margin:0 0 10px;font-weight:900}
.game-title-mark {display:inline-block;max-width:100%;padding:1px 12px 3px;background:#ffdd62;color:#2a1c00;border-radius:12px;box-shadow:4px 4px 0 var(--base);transform:rotate(-1.2deg);overflow-wrap:anywhere;vertical-align:middle}
#game-title {display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;width:fit-content;margin:auto}
#game-subtitle {margin:0;color:var(--muted);font-size:14px;line-height:1.5}
.game-expiry {display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px 12px;margin:14px auto 0;padding:9px 14px;border:1px solid var(--glass-line-2);border-radius:12px;background:var(--glass);color:var(--ink);width:fit-content;max-width:100%;box-sizing:border-box;line-height:1.4}
.game-expiry[hidden],.expiry-values[hidden] {display:none}
.expiry-label {font-size:11px;color:var(--muted);word-break:keep-all}
.expiry-values {display:flex;align-items:baseline;gap:9px;white-space:nowrap}
.expiry-part {display:inline-flex;align-items:baseline;gap:3px;font-size:10px;color:var(--muted)}
.expiry-part strong {font-size:14px;color:var(--ink);font-variant-numeric:tabular-nums;min-width:2ch;text-align:right}
.game-expiry[data-expired="true"] {border-color:var(--press)}
.game-expiry[data-expired="true"] .expiry-label {color:var(--press)}
.creator-button {width:100%;min-height:76px;margin-top:20px;text-align:left;justify-content:space-between;padding:15px 22px;border-radius:18px;gap:16px;white-space:normal}
.creator-button svg {width:28px;height:28px} .creator-copy {display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
.creator-copy strong {font-size:20px;line-height:1.25} .creator-copy>span {font-size:13px;font-weight:500;line-height:1.45}
.creator-arrow {font-size:26px;flex:none}
.game-shell {display:grid;grid-template-columns:minmax(0,450px) 244px;align-items:start;gap:22px;justify-content:center}
.game-card {border:1px solid var(--glass-line-2);background:var(--glass);border-radius:24px;padding:14px 14px 0;box-shadow:var(--shadow);min-width:0;overflow:hidden}
.game-hud {min-height:68px;display:flex;align-items:center;gap:16px;padding:0 9px 12px}
.hud-label {display:block;font-size:11px;font-weight:600;line-height:1.2;color:var(--muted);margin-bottom:6px}
.score-block {flex:1} .score-block strong {font-size:32px;font-weight:900;letter-spacing:-1px;line-height:1;color:var(--press);display:block;font-variant-numeric:tabular-nums}
.score-unit {font-size:13px;letter-spacing:0;margin-left:5px} .best-block strong {font-size:18px;line-height:1;font-weight:800;font-variant-numeric:tabular-nums}
.next-block {width:62px;border-left:1px solid var(--glass-line);text-align:center;padding-left:12px}
.next-block .hud-label {margin-bottom:1px} #next-fruit {width:35px;height:35px;object-fit:contain;vertical-align:middle}
.rank-button {display:flex;flex-direction:column;align-items:center;gap:4px;flex:none;padding:7px;border:1px solid var(--glass-line-2);border-radius:12px;background:var(--glass-2);color:var(--ink);font-size:10px;font-weight:700;cursor:pointer}
.rank-button:hover {background:var(--glass)} .rank-button svg {width:19px;height:19px}
.arena-wrap {position:relative;max-width:min(400px,var(--arena-fit-width,calc((100svh - 360px)*.714286)));min-width:min(220px,100%);margin:auto;isolation:isolate;aspect-ratio:5/7;width:100%;overflow:hidden;border-radius:16px;background:var(--suika-arena-bottom);box-shadow:inset 0 0 0 1px var(--glass-line)}
canvas {display:block;width:100%;height:100%;touch-action:none;user-select:none;-webkit-user-select:none;cursor:crosshair}
.game-overlay {position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;background:color-mix(in srgb,var(--page) 72%,transparent);z-index:2;cursor:default}
.game-overlay[hidden],.pause-layer[hidden] {display:none}
.overlay-content {text-align:center;max-width:310px;width:100%;background:var(--pop-bg);border:1px solid var(--glass-line-2);border-radius:22px;padding:26px 20px;box-shadow:var(--shadow)}
.overlay-kicker {font-size:11px;font-weight:700;color:var(--muted)}
.overlay-content h2 {font-size:25px;letter-spacing:-.8px;margin:9px 0 14px;font-weight:900;line-height:1.25}
.overlay-content p {font-size:12px;color:var(--muted);line-height:1.7;margin:0 0 20px}
.primary-button,.secondary-button {border-radius:14px;min-height:46px;width:100%;padding:12px 14px;font-size:14px;font-weight:800;display:flex;align-items:center;justify-content:center;gap:16px;border:1px solid transparent;cursor:pointer;transition:transform .12s,box-shadow .12s}
.primary-button {color:var(--press-ink);background:var(--press);box-shadow:4px 4px 0 var(--press-base)}
.primary-button:hover {transform:translate(2px,2px);box-shadow:2px 2px 0 var(--press-base)}
.primary-button:active {transform:translate(4px,4px);box-shadow:0 0 0 var(--press-base)}
.secondary-button {margin-top:12px;background:var(--glass-2);border-color:var(--glass-line-2);color:var(--ink);box-shadow:3px 3px 0 var(--base)}
.start-note {display:block;color:var(--faint);font-size:10px;margin-top:18px;line-height:1.5}
.game-tools {display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:50px;padding:5px 5px}
.game-tools p {font-size:11px;line-height:1.4;margin:0;color:var(--muted);flex:1;min-width:0}
.tool-buttons {display:flex;gap:5px;flex:none}
.small-icon-button {width:34px;height:34px;display:grid;place-items:center;background:var(--glass);border:1px solid var(--glass-line);color:var(--ink);border-radius:10px;padding:6px;cursor:pointer}
.small-icon-button svg {width:18px;height:18px} .small-icon-button:hover,.small-icon-button[aria-pressed=true] {background:var(--glass-2)}
.inline-message {font-size:12px;color:var(--press);margin:0;padding:0 10px 12px;line-height:1.55}
.side-panel {display:flex;flex-direction:column;gap:16px}
.garden-card {background:var(--glass);border:1px solid var(--glass-line-2);border-radius:22px;padding:22px;text-align:center;overflow:hidden}
.card-kicker {font-size:11px;color:var(--muted);font-weight:700}
.garden-card h2 {font-size:19px;line-height:1.4;letter-spacing:-.5px;margin:8px 0 15px;font-weight:800;word-break:keep-all}
.goal-progress {--goal-progress:0;position:relative;width:168px;max-width:100%;aspect-ratio:1;margin:0 auto 12px;display:grid;place-items:center}
.goal-ring {position:absolute;inset:0;width:100%;height:100%;overflow:visible;stroke-width:6;transform:rotate(-90deg)}
.goal-track {stroke:var(--glass-line-2)}
.goal-fill {stroke:var(--press);stroke-dasharray:100;stroke-dashoffset:calc(100 - var(--goal-progress));transition:stroke-dashoffset .3s ease-out;stroke-linecap:round}
.goal-progress[data-complete="true"] .goal-fill {stroke:var(--ok)}
.goal-fruit {display:block;width:72%;height:72%;object-fit:contain;filter:drop-shadow(0 7px 7px #0003)}
.goal-caption {display:flex;justify-content:center;align-items:baseline;gap:9px;min-width:0;margin-bottom:9px;line-height:1.35;word-break:keep-all;overflow-wrap:anywhere}
.goal-caption strong {font-size:20px;min-width:0}
#goal-percent {font-size:17px;color:var(--press);font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}
.garden-card p {font-size:12px;color:var(--muted);line-height:1.6;margin:0}
.progress-card,.guide-card {border:1px solid var(--glass-line-2);border-radius:18px;padding:16px;background:var(--glass)}
.progress-card summary,.guide-card summary {display:flex;justify-content:space-between;align-items:center;font-size:13px;font-weight:700;list-style:none;cursor:pointer;line-height:1.5}
.progress-card summary::-webkit-details-marker,.guide-card summary::-webkit-details-marker {display:none}
.detail-chevron {display:none}
.fruit-progression {padding:0;margin:16px 0 0;display:grid;grid-template-columns:repeat(4,1fr);gap:12px 8px;list-style:none}
.fruit-progression li {display:flex;flex-direction:column;align-items:center;position:relative;text-align:center;min-width:0}
.fruit-progression img {width:34px;height:34px;object-fit:contain;transition:filter .2s,transform .2s}
.fruit-progression span {font-size:10px;color:var(--muted);margin-top:4px;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.fruit-progression li.unlocked span {color:var(--ink)} .fruit-progression li.current-max img {transform:scale(1.18);filter:drop-shadow(0 0 5px var(--mark))}
.guide-card p {font-size:12px;line-height:1.7;margin:14px 0 0;color:var(--muted)}
.page-credit {display:flex;justify-content:center;gap:16px;font-size:12px;color:var(--muted);margin:24px 0;padding-bottom:env(safe-area-inset-bottom)}
.page-credit a {text-decoration:none} .page-credit a:hover {color:var(--press)}
.result-score {font-size:54px;font-weight:900;letter-spacing:-2px;line-height:1.1;color:var(--press);margin:8px 0 14px}
.result-score span {font-size:14px;margin-left:7px;letter-spacing:0} .result-content h2 {font-size:18px;margin:9px 0}
.result-content p {margin-bottom:15px} .result-count {font-size:10px;display:block;color:var(--muted);margin-top:15px}
.pause-layer {position:absolute;inset:0;background:color-mix(in srgb,var(--page) 75%,transparent);display:grid;place-items:center;z-index:1}
.pause-layer span {font-size:18px;font-weight:800;color:var(--ink);background:var(--pop-bg);border:1px solid var(--glass-line-2);padding:20px 25px;border-radius:16px}
#toast {position:fixed;bottom:max(25px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);max-width:calc(100% - 32px);background:var(--pop-bg);color:var(--ink);border:1px solid var(--glass-line-2);border-radius:14px;padding:12px 18px;font-size:13px;z-index:50;box-shadow:var(--shadow);text-align:center;line-height:1.5}
#toast:not([hidden]) {opacity:1;transform:translateX(-50%)}
.is-expanded-view .game-shell {grid-template-columns:minmax(0,450px) 244px}
.custom-catalog:empty {display:none} .custom-catalog {max-width:716px;margin:28px auto 0}
.game-card:fullscreen {background:var(--page);border:0;border-radius:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px}
.game-card:fullscreen .game-hud,.game-card:fullscreen .game-tools {width:min(430px,100%)}
.game-card:fullscreen .arena-wrap {max-height:calc(100svh - 145px);width:auto;height:calc(100svh - 145px);aspect-ratio:5/7;flex:none;max-width:calc(100vw - 24px)}
@media(max-width:759px) {
  .page-wrap {padding:0 12px} .topbar .shell {padding:0 12px;gap:8px}
  .controls {gap:6px} .controls .pill {min-height:34px;padding:8px 10px;font-size:12px}
  .controls .icon-only {min-width:34px;width:34px;padding:8px} .brand {font-size:19px;gap:7px}
  .brand img {width:28px;height:28px} .intro {padding:16px 0 16px;max-width:400px}
  h1 {font-size:27px;letter-spacing:-1px;margin-bottom:7px} #game-subtitle {font-size:12px}
  .creator-button {min-height:60px;margin-top:14px;padding:10px 14px;gap:10px;border-radius:15px}
  .creator-button svg {width:23px;height:23px} .creator-copy strong {font-size:17px}
  .creator-copy>span {font-size:11px} .creator-arrow {font-size:23px}
  .game-shell {display:flex;flex-direction:column;align-items:center;gap:12px}
  .game-card {width:100%;max-width:400px;padding:10px 10px 0;border-radius:20px}
  .game-hud {min-height:58px;padding:0 4px 9px;gap:11px} .hud-label {font-size:10px;margin-bottom:5px}
  .score-block strong {font-size:27px} .best-block strong {font-size:16px} .next-block {width:52px;padding-left:8px}
  #next-fruit {width:31px;height:31px} .rank-button {padding:6px;font-size:9px;gap:3px}
  .arena-wrap {max-width:var(--arena-fit-width,calc((100svh - 325px)*.714286));border-radius:14px}
  .game-tools {min-height:44px;padding:3px 2px} .game-tools p {font-size:10px}
  .small-icon-button {width:30px;height:32px;padding:6px} .small-icon-button svg {width:16px;height:16px}
  .side-panel {width:100%;max-width:400px;gap:9px}
  .garden-card {display:grid;grid-template-columns:70px minmax(0,1fr);grid-template-areas:"ring kicker" "ring caption" "ring detail";column-gap:14px;align-items:center;text-align:left;padding:12px 15px;border-radius:16px}
  .garden-card .card-kicker {grid-area:kicker;font-size:10px}
  .garden-card h2 {display:none}
  .goal-progress {grid-area:ring;width:70px;margin:0}
  .goal-caption {grid-area:caption;justify-content:flex-start;gap:8px;margin:3px 0}
  .goal-caption strong {font-size:17px} #goal-percent {font-size:15px}
  .garden-card p {grid-area:detail;font-size:10px;line-height:1.4}
  .progress-card,.guide-card {padding:12px 15px;border-radius:14px} .detail-chevron {display:inline}
  .progress-card summary,.guide-card summary {font-size:12px}
  .fruit-progression {grid-template-columns:repeat(11,1fr);gap:3px;margin-top:12px}
  .fruit-progression img {width:24px;height:24px} .fruit-progression span {display:none}
  .page-credit {margin:18px 0;font-size:11px}
  .overlay-content {padding:20px 15px;border-radius:18px} .overlay-content h2 {font-size:22px}
  .overlay-content p {font-size:11px;margin-bottom:16px} .primary-button,.secondary-button {min-height:42px;font-size:13px;padding:10px}
  .start-note {font-size:9px;margin-top:14px} .result-score {font-size:46px}
  .result-content h2 {font-size:16px} .result-content .secondary-button {margin-top:10px}
  .result-count {font-size:9px} .custom-catalog {margin-top:19px}
}
@media(max-width:350px),(max-height:650px) and (max-width:759px) {
  .intro {padding:10px 0 12px} h1 {font-size:24px;margin-bottom:5px}
  #game-subtitle {display:none} .creator-button {min-height:54px;margin-top:11px;padding:9px 12px}
  .creator-copy strong {font-size:16px} .creator-copy>span {font-size:10px;letter-spacing:-.3px}
  .controls .theme-pill {font-size:0;min-width:34px;justify-content:center}
  .controls .theme-pill svg {width:16px;height:16px}
  .creator-button svg {width:20px;height:20px} .game-hud {min-height:53px;gap:8px}
  .hud-label {font-size:9px} .next-block {width:48px} .game-tools p {font-size:9px}
  .overlay-content {padding:13px 12px;border-radius:17px} .overlay-content h2 {font-size:19px;margin:7px 0 10px}
  .overlay-content p {font-size:10px;margin-bottom:13px} .overlay-kicker {font-size:9px}
  .primary-button,.secondary-button {font-size:12px;min-height:37px;padding:9px}
  .start-note {margin-top:11px;font-size:8px} .result-score {font-size:38px;margin:7px 0}
  .result-content p {margin-bottom:10px;font-size:10px} .result-count {margin-top:9px;font-size:8px}
}
@media(prefers-reduced-motion:reduce) {*,*::before,*::after {scroll-behavior:auto!important} .primary-button,.secondary-button,.fruit-progression img,.goal-fill {transition:none}}
/* Short laptop windows need room for the game, even at desktop widths. */
@media(max-height:800px) and (min-width:760px) {
  .intro {padding:14px 0 15px}
  h1 {font-size:32px;margin-bottom:8px} #game-subtitle {font-size:12px}
  .creator-button {min-height:58px;margin-top:14px;padding:10px 18px;gap:12px}
  .creator-copy strong {font-size:18px} .creator-copy>span {font-size:12px}
  .creator-button svg {width:24px;height:24px}
  .game-card {padding:12px 12px 0} .game-hud {min-height:62px;padding-bottom:9px}
  .overlay-content {padding:14px 12px;border-radius:18px}
  .overlay-kicker {font-size:9px} .overlay-content h2 {font-size:20px;margin:7px 0 10px}
  .overlay-content p {font-size:10px;margin-bottom:13px}
  .primary-button,.secondary-button {min-height:38px;font-size:12px;padding:9px}
  .start-note {margin-top:12px;font-size:8px}
  .result-score {font-size:38px;margin:7px 0}
  .result-content h2 {font-size:16px}
  .result-content p {margin-bottom:10px} .result-count {margin-top:9px;font-size:8px}
}

/* Neutral asset placeholders keep previous/default artwork out of custom themes. */
img.asset-loading {background:linear-gradient(105deg,var(--glass-line) 20%,var(--glass-line-2) 45%,var(--glass-line) 70%);background-size:220% 100%;border-radius:18%;animation:asset-shimmer 1.4s ease-in-out infinite;filter:none!important;color:transparent}
img.asset-unavailable {animation:none}
@keyframes asset-shimmer {from {background-position:100% 0} to {background-position:-100% 0}}
@media(prefers-reduced-motion:reduce) {img.asset-loading {animation:none}}
