:root {
  color-scheme: dark;
  --ink: #10252c;
  --night: #071b2a;
  --night-2: #0b2a38;
  --teal: #0c4b52;
  --teal-bright: #15828a;
  --glass: #7ee6dc;
  --glass-pale: #c8fff4;
  --brass: #b9792d;
  --brass-light: #f2c36b;
  --coral: #e96754;
  --paper: #f4e6c8;
  --muted: #a7c5c3;
  --line: rgba(200, 255, 244, .28);
  --panel: rgba(7, 27, 42, .95);
  --shadow: 0 18px 48px rgba(0, 9, 18, .48);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; letter-spacing: 0; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--night); }
body { color: var(--paper); overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; white-space: nowrap; }
[data-ui-label], .wallet strong, .level-plate > *, .chain-badge > *, .receipt-stamp, .row-stamp { white-space: nowrap; }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--glass-pale); outline-offset: 3px; }
[hidden] { display: none !important; }

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 280px;
  isolation: isolate;
  background: var(--night);
  overflow: hidden;
}

.world {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  transform: none;
}
.world::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.world-home { background-image: url("/games/arrow-atelier/v1/assets/background-workshop-home.webp"); }
.world-home::after { background: linear-gradient(180deg, rgba(3, 13, 24, .5) 0%, rgba(3, 13, 24, .08) 35%, rgba(3, 13, 24, .2) 55%, rgba(3, 13, 24, .88) 84%, #071b2a 100%); }
.world-play { background-image: url("/games/arrow-atelier/v1/assets/background-workshop-play.webp"); filter: saturate(.82) brightness(.58); }
.world-play::after { background: radial-gradient(circle at 50% 52%, rgba(7, 27, 42, .05), rgba(7, 27, 42, .8) 68%), linear-gradient(180deg, rgba(7, 27, 42, .85), transparent 28%, rgba(7, 27, 42, .88)); }

.surface { position: absolute; inset: 0; z-index: 4; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.game-canvas { inset: 0; z-index: 2; width: 100%; height: 100%; }

.home-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; text-shadow: 0 2px 10px rgba(0,0,0,.75); }
.home-head h1 { margin: 1px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(25px, 7.2vw, 38px); line-height: .95; }
.eyebrow { margin: 0; color: var(--brass-light); text-transform: uppercase; font-size: 10px; font-weight: 800; }
.wallet { min-height: 46px; min-width: 76px; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 2px 10px 2px 3px; border: 1px solid rgba(242,195,107,.5); border-radius: 24px; background: rgba(4,22,31,.78); box-shadow: inset 0 1px rgba(255,255,255,.08), var(--shadow); }
.wallet strong { font-variant-numeric: tabular-nums; font-size: 16px; }

.asset-crop, .panel-seal, .skin-preview {
  display: inline-block;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-size: 400% 200%;
}
.asset-crop { width: 40px; height: 40px; background-image: url("/games/arrow-atelier/v1/assets/reward-objects.webp"); }
.crop-heart { background-position: 0 0; }
.crop-feather { background-position: 33.333% 0; }
.crop-case { background-position: 66.666% 0; }
.crop-key { background-position: 100% 0; }
.crop-undo { background-position: 0 100%; }
.crop-hint { background-position: 33.333% 100%; }
.crop-scan { background-position: 66.666% 100%; }
.crop-ribbon { background-position: 100% 100%; }
.crop-seal, .panel-seal { background-image: url("/games/arrow-atelier/v1/assets/chapter-seals.webp"); background-size: 500% 200%; background-position: 0 0; }
.crop-wind { background-image: url("/games/arrow-atelier/v1/assets/chapter-seals.webp"); background-size: 500% 200%; background-position: 0 0; }
.crop-beacon { background-image: url("/games/arrow-atelier/v1/assets/chapter-seals.webp"); background-size: 500% 200%; background-position: 100% 100%; }

.hero-copy { position: absolute; top: 48%; left: 50%; transform: translate(-50%, -50%); width: min(72vw, 310px); padding: 9px 13px; text-align: center; border-radius: 18px; background: linear-gradient(180deg, rgba(7,27,42,.18), rgba(7,27,42,.78)); border: 1px solid rgba(126,230,220,.18); text-shadow: 0 2px 10px #000; }
.hero-copy strong { display: block; margin: 3px 0 1px; color: var(--glass-pale); font-size: 18px; }
.hero-copy span { font-size: 11px; }
.chapter-kicker { color: var(--brass-light); font-weight: 800; text-transform: uppercase; white-space: nowrap; }
body[data-aa-state="reentry"] .hero-copy { background: linear-gradient(180deg, rgba(21,130,138,.48), rgba(7,27,42,.9)); border-color: rgba(242,195,107,.62); box-shadow: 0 0 24px rgba(126,230,220,.18); }
body[data-aa-state="reentry"] #homeSub { color: var(--brass-light); font-weight: 800; }

.secondary-rail { position: absolute; top: 37%; display: flex; flex-direction: column; gap: 8px; z-index: 7; }
.rail-left { left: max(8px, env(safe-area-inset-left)); }
.rail-right { right: max(8px, env(safe-area-inset-right)); }
.rail-btn { position: relative; width: 68px; min-height: 70px; padding: 2px 4px 6px; display: grid; grid-template-rows: 40px 14px; align-items: center; justify-items: center; border-radius: 19px; border: 1px solid rgba(200,255,244,.24); background: linear-gradient(160deg, rgba(12,75,82,.88), rgba(6,31,43,.94)); box-shadow: inset 0 1px rgba(255,255,255,.1), 0 8px 20px rgba(0,0,0,.28); font-size: 10px; font-weight: 750; line-height: 14px; }
.rail-btn .asset-crop { width: 38px; height: 38px; }
.rail-btn .ui-label { height: 14px; line-height: 14px; }
.rail-btn:active { transform: translateY(1px) scale(.98); }
.state-dot { position: absolute; top: 5px; right: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--brass-light); border: 2px solid var(--night); box-shadow: 0 0 0 2px rgba(242,195,107,.25); }

.start-cluster { position: absolute; z-index: 8; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 92px), 430px); display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.mode-tabs { min-height: 52px; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; gap: 3px; border-radius: 22px; background: rgba(5,25,35,.9); border: 1px solid rgba(126,230,220,.3); box-shadow: var(--shadow); }
.mode-tab { min-width: 0; min-height: 44px; padding: 0 5px; border-radius: 18px; background: transparent; color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 850; text-transform: uppercase; }
.mode-tab.active { color: var(--ink); background: linear-gradient(180deg, var(--glass-pale), var(--glass)); box-shadow: 0 4px 14px rgba(126,230,220,.28); }
.start-detail { min-height: 18px; display: grid; place-items: center; color: var(--paper); font-size: 10px; line-height: 18px; font-weight: 750; text-shadow: 0 2px 8px #000; }
.primary-cta { min-height: 58px; padding: 8px 18px; display: flex; align-items: center; justify-content: center; border-radius: 23px; color: #332313; background: linear-gradient(180deg, #fff0a3, var(--brass-light) 45%, #ce8e36); box-shadow: inset 0 2px rgba(255,255,255,.6), inset 0 -3px rgba(91,48,26,.28), 0 10px 24px rgba(0,0,0,.4), 0 0 28px rgba(242,195,107,.24); border: 1px solid #ffe09a; }
.primary-cta span { font-family: Georgia, "Songti SC", serif; font-weight: 900; font-size: 21px; line-height: 1; }
.primary-cta:active { transform: translateY(2px); box-shadow: inset 0 2px rgba(255,255,255,.5), 0 5px 13px rgba(0,0,0,.35); }
.ad-link, .dispatch-link { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 16px; background: rgba(7,27,42,.86); border: 1px solid rgba(126,230,220,.25); font-size: 10px; font-weight: 720; }
.dispatch-link { color: var(--brass-light); }
.dispatch-link .asset-crop { width: 30px; height: 30px; }
.video-icon { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.video-icon path { fill: currentColor; stroke: none; }

.play-surface { pointer-events: none; }
.play-surface button, .play-hud, .tool-dock, .end-run-btn { pointer-events: auto; }
.play-hud { position: absolute; z-index: 8; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); min-height: 54px; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 7px; align-items: stretch; }
.icon-btn { min-width: 48px; min-height: 48px; border-radius: 17px; background: rgba(7,27,42,.9); border: 1px solid rgba(126,230,220,.32); display: grid; place-items: center; box-shadow: var(--shadow); }
.icon-btn svg { width: 23px; height: 23px; fill: var(--paper); }
.level-plate { min-width: 0; padding: 4px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 18px; background: rgba(7,27,42,.9); border: 1px solid rgba(242,195,107,.3); box-shadow: var(--shadow); text-align: center; }
.level-plate span { color: var(--brass-light); font-size: 10px; line-height: 12px; font-weight: 900; }
.level-plate strong { max-width: 100%; white-space: nowrap; font-family: Georgia, "Songti SC", serif; font-size: clamp(12px, 3.6vw, 14px); line-height: 17px; }
.level-plate small { color: var(--muted); font-size: 10px; line-height: 12px; }
.heart-rail { position: absolute; z-index: 7; top: calc(max(8px, env(safe-area-inset-top)) + 62px); left: 50%; transform: translateX(-50%); min-width: 116px; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 8px; border-radius: 18px; background: rgba(7,27,42,.8); }
.heart { width: 28px; height: 28px; flex: 0 0 28px; background: url("/games/arrow-atelier/v1/assets/reward-objects.webp") 0 0 / 400% 200% no-repeat; filter: drop-shadow(0 0 5px rgba(233,103,84,.55)); }
.heart.spent { filter: grayscale(1) brightness(.56); opacity: .62; }
.chain-badge { position: absolute; z-index: 6; top: 104px; right: 12px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(126,230,220,.8), rgba(12,75,82,.84) 58%, rgba(7,27,42,.82)); border: 2px solid var(--glass-pale); opacity: 0; transform: scale(.7); transition: opacity .18s, transform .22s; }
.chain-badge.show { opacity: 1; transform: scale(1); }
.chain-badge span { font-size: 10px; font-weight: 900; }
.chain-badge strong { position: absolute; top: 21px; font-size: 18px; }
.first-hint { position: absolute; z-index: 6; top: calc(max(8px, env(safe-area-inset-top)) + 110px); left: 50%; transform: translateX(-50%); min-height: 44px; width: max-content; max-width: calc(100% - 40px); display: flex; align-items: center; gap: 9px; padding: 7px 14px; border-radius: 22px; background: rgba(7,27,42,.92); border: 1px solid rgba(200,255,244,.42); box-shadow: var(--shadow); pointer-events: none; transition: opacity .3s, transform .3s; }
.first-hint.dismissed { opacity: 0; transform: translate(-50%, -10px); }
.first-hint strong { font-size: 12px; }
.first-hint-art { width: 30px; height: 30px; }
.focus-readout { position: absolute; z-index: 6; left: 50%; bottom: 88px; transform: translateX(-50%); min-height: 22px; min-width: 150px; text-align: center; font-size: 11px; color: var(--glass-pale); text-shadow: 0 2px 8px #000; pointer-events: none; }
.tool-dock { position: absolute; z-index: 8; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 24px), 410px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.tool-btn { position: relative; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 18px; background: linear-gradient(180deg, rgba(12,75,82,.95), rgba(5,31,43,.96)); border: 1px solid rgba(126,230,220,.3); box-shadow: var(--shadow); font-size: 10px; font-weight: 800; }
.tool-btn b { position: absolute; right: 8px; top: 7px; min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 9px; color: var(--ink); background: var(--brass-light); font-size: 10px; }
.tool-asset { width: 30px; height: 30px; margin-bottom: 1px; }
.end-run-btn { position: absolute; z-index: 8; right: 13px; bottom: 82px; min-height: 44px; padding: 0 12px; border-radius: 15px; color: var(--muted); background: rgba(7,27,42,.9); border: 1px solid rgba(167,197,195,.25); font-size: 10px; }

.atelier-panel { width: min(92vw, 430px) !important; padding: 18px 18px 16px !important; color: var(--paper); border: 1px solid rgba(242,195,107,.38); background: linear-gradient(165deg, rgba(14,52,64,.98), rgba(5,24,36,.99)) !important; box-shadow: inset 0 1px rgba(255,255,255,.08), var(--shadow); }
.atelier-panel::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(126,230,220,.12); border-radius: 12px; pointer-events: none; }
.atelier-panel h2 { position: relative; margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(23px, 6.4vw, 31px); line-height: 1.05; }
.atelier-panel p { position: relative; margin: 2px 0; color: var(--muted); font-size: 12px; line-height: 1.38; }
.panel-seal { width: 86px; height: 86px; }
.primary-small, .secondary-btn, .ad-cta, .text-btn { position: relative; width: 100%; min-height: 48px; padding: 9px 12px; border-radius: 17px; font-size: 12px; line-height: 16px; font-weight: 850; white-space: nowrap; }
.primary-small { color: #35220f; background: linear-gradient(180deg, #fff0a3, var(--brass-light)); box-shadow: inset 0 1px rgba(255,255,255,.6), 0 7px 18px rgba(0,0,0,.3); }
.secondary-btn { background: rgba(8,40,51,.86); border: 1px solid rgba(126,230,220,.3); }
.text-btn { background: transparent; color: var(--muted); border: 1px solid rgba(167,197,195,.18); }
.ad-cta { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--glass-pale); background: linear-gradient(180deg, #126b72, #0a3f4c); border: 1px solid rgba(200,255,244,.55); box-shadow: inset 0 1px rgba(255,255,255,.12); font-size: 12px; }
.ad-cta.slim { min-height: 46px; font-size: 11px; }
.ad-cta:disabled, button:disabled { opacity: .46; cursor: default; filter: grayscale(.35); }
.reward-large { width: 92px; height: 92px; }
.rescue-panel { border-color: rgba(233,103,84,.55); }
.grouped-actions { width: 100%; display: grid; gap: 7px; }

.clear-panel { overflow: visible !important; }
.clear-iris { position: relative; width: 118px; height: 118px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(200,255,244,.42), rgba(21,130,138,.2) 50%, transparent 70%); }
.clear-iris::before, .clear-iris::after { content: ""; position: absolute; inset: 7px; border: 2px dashed rgba(242,195,107,.7); border-radius: 50%; animation: irisSpin 8s linear infinite; }
.clear-iris::after { inset: 17px; border-style: solid; border-color: rgba(126,230,220,.4); animation-direction: reverse; }
@keyframes irisSpin { to { transform: rotate(360deg); } }
.stamp-track { width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.stamp-node { height: 11px; border-radius: 6px; border: 1px solid rgba(126,230,220,.3); background: #193a45; }
.stamp-node.done { background: var(--brass-light); border-color: #fff0a3; box-shadow: 0 0 9px rgba(242,195,107,.35); }

.result-panel { text-align: left !important; }
.result-panel > .eyebrow, .result-panel > h2 { align-self: center; text-align: center; }
.unlock-seal { align-self: center; width: 108px; height: 108px; animation: unlockSeal .7s cubic-bezier(.2,.9,.2,1) both; }
@keyframes unlockSeal { from { transform: scale(.55) rotate(-18deg); opacity: .15; filter: grayscale(1); } to { transform: none; opacity: 1; filter: none; } }
.reward-ledger { width: 100%; min-height: 76px; display: grid; grid-template-columns: 60px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 17px; color: var(--ink); background: linear-gradient(145deg, #f5e8ca, #d7bd8d); box-shadow: inset 0 0 0 2px rgba(91,48,26,.18); }
.reward-ledger .asset-crop { width: 58px; height: 58px; }
.reward-ledger small, .reward-ledger strong { display: block; }
.reward-ledger strong { color: #6b381d; font-size: 24px; }
.receipt-stamp, .row-stamp { transform: rotate(-5deg); border: 2px solid #3c746f; border-radius: 5px; color: #22564f; padding: 3px; font-style: normal; font-size: 10px; font-weight: 950; }
.result-actions { width: 100%; display: grid; gap: 7px; }

.activity-panel { text-align: left !important; height: min(88dvh, 650px); align-items: stretch !important; }
.activity-hero { flex: 0 0 auto; min-height: 106px; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: center; padding: 5px 6px 10px; }
.activity-copy { min-width: 0; display: grid; justify-items: start; align-content: center; }
.activity-hero h2 { margin-bottom: 4px; font-size: clamp(20px, 5.4vw, 28px); white-space: nowrap; }
.activity-hero p { font-size: 11px; }
.activity-object { width: 92px; height: 92px; filter: drop-shadow(0 9px 12px rgba(0,0,0,.35)); }
.progress-rail { position: relative; flex: 0 0 40px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; padding: 0 14%; }
.progress-rail i { position: absolute; left: 16%; right: 16%; height: 7px; border-radius: 4px; background: #20404a; overflow: hidden; }
.progress-rail i::after { content: ""; display: block; width: var(--daily-progress, 0%); height: 100%; background: linear-gradient(90deg, var(--glass), var(--brass-light)); transition: width .35s; }
.progress-rail b { position: relative; z-index: 1; justify-self: center; width: 24px; height: 24px; border: 4px solid #20404a; border-radius: 50%; background: var(--night); }
.progress-rail b.done { border-color: var(--brass-light); background: var(--brass); }
.activity-list { min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 7px; padding: 2px; }
.activity-row, .mission-row { position: relative; min-height: 62px; flex: 0 0 auto; display: grid; grid-template-columns: 38px 1fr auto; gap: 9px; align-items: center; padding: 8px 9px; border-radius: 14px; background: rgba(5,31,43,.72); border-left: 4px solid #4b666b; }
.activity-row strong, .activity-row small, .mission-row strong, .mission-row small { display: block; }
.activity-row strong, .mission-row strong { font-size: 12px; white-space: nowrap; }
.activity-row small, .mission-row small { margin-top: 2px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.state-glyph { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #547178; position: relative; }
.state-claimable { border-left-color: var(--brass-light); box-shadow: inset 0 0 18px rgba(242,195,107,.06); }
.state-claimable .state-glyph { border-color: var(--brass-light); box-shadow: 0 0 9px rgba(242,195,107,.35); }
.state-claimable .state-glyph::after { content: ""; position: absolute; width: 11px; height: 6px; left: 6px; top: 7px; border-left: 3px solid var(--brass-light); border-bottom: 3px solid var(--brass-light); transform: rotate(-45deg); }
.state-claimable button { min-width: 64px; min-height: 44px; border-radius: 13px; color: var(--ink); background: var(--brass-light); font-size: 11px; font-weight: 900; }
.state-progress { border-left-color: var(--glass); }
.state-progress .state-glyph { border-color: var(--glass); border-right-color: transparent; }
.mini-track { grid-column: 2 / 4; height: 5px; border-radius: 4px; background: #244550; overflow: hidden; }
.mini-track b { display: block; width: 0; height: 100%; background: var(--glass); transition: width .3s; }
.state-claimed { border-left-color: #8eaa9f; opacity: .82; }
.state-claimed .state-glyph { border-color: #8eaa9f; background: #315951; }
.state-claimed .state-glyph::after { content: ""; position: absolute; inset: 7px; border: 2px solid var(--paper); transform: rotate(45deg); }
.state-locked { border-left-color: #3d5158; filter: saturate(.45); }
.state-locked .state-glyph::before, .row-lock::before { content: ""; position: absolute; width: 14px; height: 12px; left: 5px; top: 11px; border-radius: 3px; background: #688087; }
.state-locked .state-glyph::after, .row-lock::after { content: ""; position: absolute; width: 10px; height: 9px; left: 7px; top: 4px; border: 3px solid #688087; border-bottom: 0; border-radius: 8px 8px 0 0; }
.row-lock { width: 28px; height: 30px; position: relative; }
.claim-burst { animation: claimBurst .55s ease-out; }
@keyframes claimBurst { 0% { transform: scale(.75); opacity: .4; } 55% { transform: scale(1.12); filter: brightness(1.5); } 100% { transform: none; opacity: 1; } }

.mission-hero { grid-template-columns: 82px 1fr; min-height: 94px; }
.mission-hero .activity-object { width: 80px; height: 80px; }
.mission-meter { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.mission-meter i { height: 10px; border-radius: 6px; background: #244550; overflow: hidden; }
.mission-meter b { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--glass), var(--brass-light)); }
.mission-row .asset-crop { width: 36px; height: 36px; }

.workshop-panel { align-items: stretch !important; text-align: left !important; }
.workshop-panel > h2, .workshop-panel > .eyebrow { text-align: center; }
.workshop-panel > * { min-width: 0; }
.skin-stand { min-height: 130px; display: grid; grid-template-columns: 148px 1fr; gap: 10px; align-items: center; padding: 8px; border-radius: 20px; background: radial-gradient(circle at 31% 50%, rgba(126,230,220,.23), rgba(5,31,43,.74) 62%); }
.skin-stand strong, .skin-stand small { display: block; }
.skin-stand strong { font-size: 12px; white-space: nowrap; }
.skin-stand small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.skin-preview { width: 128px; height: 128px; background-image: url("/games/arrow-atelier/v1/assets/skin-vane-sheet.webp"); background-size: 400% 100%; }
.skin-atelier { background-position: 0 0; }
.skin-storm { background-position: 33.333% 0; }
.skin-sun { background-position: 66.666% 0; }
.skin-verdant { background-position: 100% 0; }
.material-line { min-width: 0; min-height: 54px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 14px; background: rgba(244,230,200,.09); }
.material-line > * { white-space: nowrap; }

.skins-panel { align-items: stretch !important; }
.skins-panel > h2, .skins-panel > .eyebrow { text-align: center; }
.skin-strip { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.skin-choice { min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 17px; background: rgba(5,31,43,.76); border: 1px solid rgba(126,230,220,.22); }
.skin-choice .skin-preview { width: 72px; height: 72px; }
.skin-choice b { font-size: 10px; white-space: nowrap; }
.skin-choice small { color: var(--brass-light); font-size: 10px; }
.skin-choice.selected { border: 2px solid var(--glass-pale); box-shadow: inset 0 0 20px rgba(126,230,220,.12); }
.skin-choice.owned small { color: var(--glass); }

.guide-panel { height: min(85dvh, 620px); display: grid !important; grid-template-rows: auto auto auto auto; align-content: start; align-items: stretch !important; }
.guide-panel > h2, .guide-panel > .eyebrow, .guide-note { text-align: center; }
.chapter-map { height: 442px; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 5px; padding: 3px; scroll-snap-type: y mandatory; }
.chapter-row { min-height: 58px; display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 5px 9px; border-radius: 14px; background: rgba(5,31,43,.72); border: 1px solid rgba(126,230,220,.12); scroll-snap-align: start; }
.chapter-row .panel-seal { width: 48px; height: 48px; background-position: var(--seal-pos); filter: grayscale(.8) brightness(.7); }
.chapter-row.unlocked .panel-seal { filter: none; }
.chapter-row strong, .chapter-row small { display: block; }
.chapter-row strong { font-size: 11px; white-space: nowrap; }
.chapter-row small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.chapter-row b { min-width: 42px; font-size: 10px; color: var(--brass-light); text-align: right; }

.offer-panel { border-color: rgba(126,230,220,.55); }
.offer-status { min-height: 18px; color: var(--brass-light) !important; font-weight: 750; }
.ad-tag { color: var(--glass-pale); }

.reward-flight { position: fixed; z-index: 120; left: 50%; top: 55%; width: 54px; height: 54px; pointer-events: none; opacity: 0; transform: translate(-50%, -50%); }
.reward-flight .asset-crop { width: 54px; height: 54px; }
.reward-flight.flying { animation: rewardFly .72s cubic-bezier(.2,.8,.25,1) both; }
@keyframes rewardFly { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.65); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 100% { opacity: 0; left: calc(100% - 44px); top: 34px; transform: translate(-50%, -50%) scale(.45); } }
.game-toast { position: absolute; z-index: 130; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 74px); transform: translate(-50%, 10px); min-height: 38px; max-width: calc(100% - 28px); padding: 10px 16px; border-radius: 20px; background: rgba(7,27,42,.96); border: 1px solid rgba(126,230,220,.38); box-shadow: var(--shadow); font-size: 11px; font-weight: 750; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.game-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 650px) and (orientation: portrait) {
  .home-head h1 { font-size: 25px; }
  .hero-copy { top: 43%; }
  .secondary-rail { top: 30%; gap: 5px; }
  .rail-btn { width: 62px; min-height: 62px; border-radius: 16px; }
  .rail-btn .asset-crop { width: 31px; height: 31px; }
  .start-cluster { width: min(calc(100% - 78px), 390px); gap: 3px; }
  .mode-tabs { min-height: 52px; }
  .primary-cta { min-height: 55px; }
  .primary-cta span { font-size: 19px; }
  .ad-link, .dispatch-link { min-height: 44px; }
  .first-hint { top: calc(max(8px, env(safe-area-inset-top)) + 110px); }
  .atelier-panel { padding: 13px !important; gap: 5px !important; }
  .activity-panel { height: calc(100dvh - 20px); }
  .activity-hero { min-height: 82px; grid-template-columns: 68px minmax(0, 1fr); gap: 9px; }
  .activity-object { width: 68px; height: 68px; }
  .activity-row { min-height: 55px; }
  .reward-large { width: 68px; height: 68px; }
  .panel-seal { width: 64px; height: 64px; }
  .skin-strip { grid-template-columns: repeat(4, 1fr); }
  .skin-choice { min-height: 78px; }
  .skin-choice .skin-preview { width: 44px; height: 44px; }
  .chapter-map { height: 379px; }
}

@media (max-height: 590px) and (orientation: portrait) {
  .chapter-map { height: 316px; }
}

@media (max-width: 340px) {
  .home-head .eyebrow { max-width: 180px; }
  .rail-btn { width: 58px; }
  .start-cluster { width: calc(100% - 68px); }
  .mode-tab { font-size: 11px; padding-inline: 3px; }
  .primary-cta span { font-size: 18px; }
  .activity-hero { grid-template-columns: 68px minmax(0, 1fr); gap: 8px; }
  .activity-object { width: 68px; height: 68px; }
  .skin-stand { grid-template-columns: 118px 1fr; }
  .skin-stand .skin-preview { width: 108px; height: 108px; }
  .chapter-map { height: 316px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .world-home { background-image: url("/games/arrow-atelier/v1/assets/background-workshop-play.webp"); background-position: center; }
  .world-home::after { background: linear-gradient(90deg, rgba(3,13,24,.74), rgba(3,13,24,.1) 43%, rgba(3,13,24,.82) 64%, #071b2a 100%); }
  .home-head { width: 47%; }
  .home-head h1 { font-size: 30px; white-space: nowrap; }
  .hero-copy { top: 50%; left: 24%; width: 38%; }
  .secondary-rail { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); flex-direction: row; }
  .rail-left { left: max(8px, env(safe-area-inset-left)); }
  .rail-right { left: 154px; right: auto; }
  .rail-btn { width: 66px; min-height: 58px; }
  .rail-btn .asset-crop { width: 30px; height: 30px; }
  .start-cluster { left: auto; right: max(12px, env(safe-area-inset-right)); top: 50%; bottom: auto; transform: translateY(-50%); width: min(43%, 390px); }
  .mode-tabs { min-height: 52px; }
  .primary-cta { min-height: 55px; }
  .play-hud { left: max(8px, env(safe-area-inset-left)); right: 62%; }
  .level-plate { padding-inline: 5px; }
  .level-plate strong { font-size: 12px; }
  .heart-rail { top: auto; left: 26%; bottom: 8px; }
  .first-hint { left: 48%; top: 12px; }
  .chain-badge { top: 74px; right: 116px; width: 48px; height: 48px; }
  .chain-badge strong { top: 18px; }
  .tool-dock { left: auto; right: max(9px, env(safe-area-inset-right)); top: 50%; bottom: auto; transform: translateY(-50%); width: 96px; grid-template-columns: 1fr; }
  .tool-btn { min-height: 62px; }
  .focus-readout { left: 50%; bottom: 8px; }
  .end-run-btn { right: 114px; bottom: 8px; }
  .atelier-panel { width: min(78vw, 620px) !important; max-height: calc(100dvh - 14px) !important; padding: 11px 46px 11px 15px !important; }
  .compact-panel, .rescue-panel, .clear-panel, .offer-panel { width: min(70vw, 520px) !important; }
  .compact-panel { display: grid !important; grid-template-columns: 100px minmax(0, 1fr); gap: 6px 12px !important; align-items: center !important; text-align: left !important; }
  .compact-panel .panel-seal { grid-column: 1; grid-row: 1 / 7; justify-self: center; }
  .compact-panel > :not(.panel-seal) { grid-column: 2; }
  .compact-panel > button { min-height: 44px; padding-block: 5px; }
  .rescue-panel { display: grid !important; grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: auto auto auto auto; gap: 4px 10px !important; align-items: center !important; text-align: left !important; }
  .rescue-panel > .reward-large { grid-column: 1; grid-row: 1 / 4; justify-self: center; }
  .rescue-panel > .eyebrow, .rescue-panel > h2, .rescue-panel > p { grid-column: 2; text-align: left; }
  .rescue-panel > h2 { font-size: 22px; white-space: nowrap; }
  .rescue-panel > .grouped-actions { grid-column: 1 / 3; grid-row: 4; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 7px; }
  .rescue-panel > .grouped-actions > button { min-height: 44px; padding-block: 5px; }
  .activity-panel { height: calc(100dvh - 14px); display: grid !important; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 44px 44px; gap: 5px 10px !important; align-items: stretch !important; }
  .activity-panel .activity-hero { min-width: 0; grid-column: 1; grid-row: 1 / 3; align-content: center; grid-template-columns: 70px minmax(0, 1fr); gap: 7px; }
  .activity-panel .activity-hero h2 { font-size: 20px; }
  .activity-panel .activity-object { width: 68px; height: 68px; }
  .activity-panel .progress-rail, .activity-panel .mission-meter { grid-column: 1; grid-row: 3; }
  .activity-panel .activity-list { grid-column: 2; grid-row: 1; gap: 4px; overflow: auto; }
  .activity-panel .activity-row, .activity-panel .mission-row { min-height: 46px; padding: 4px 7px; }
  .activity-panel > .ad-cta, .activity-panel > .primary-small { grid-column: 2; grid-row: 2; min-height: 44px; padding-block: 4px; }
  .activity-panel > .secondary-btn { grid-column: 2; grid-row: 3; min-height: 44px; padding-block: 4px; }
  .reward-large { width: 62px; height: 62px; }
  .clear-iris { width: 78px; height: 78px; }
  .result-panel { display: grid !important; grid-template-columns: minmax(0, 32%) minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 5px 10px !important; align-items: center !important; }
  .result-panel .unlock-seal { grid-column: 1; grid-row: 1; justify-self: center; width: 72px; height: 72px; }
  .result-panel > .eyebrow { grid-column: 1; grid-row: 2; justify-self: stretch; width: 100%; white-space: nowrap; }
  .result-panel > h2 { grid-column: 1; grid-row: 3; justify-self: stretch; width: 100%; font-size: 22px; white-space: nowrap; }
  .result-panel .reward-ledger { grid-column: 2; grid-row: 1; min-height: 64px; }
  .result-panel .result-actions { grid-column: 2; grid-row: 2 / 4; gap: 4px; }
  .result-panel .result-actions button { min-height: 44px; padding-block: 5px; }
  .skins-panel .skin-strip { grid-template-columns: repeat(4, 1fr); }
  .skin-choice { min-height: 76px; }
  .skin-choice .skin-preview { width: 46px; height: 46px; }
  .workshop-panel { display: grid !important; grid-template-columns: 1fr 1fr; column-gap: 10px !important; }
  .workshop-panel > .eyebrow, .workshop-panel > h2 { grid-column: 1 / 3; }
  .skin-stand { grid-row: span 4; grid-template-columns: 100px minmax(110px, 1fr); gap: 7px; }
  .skin-stand .skin-preview { width: 96px; height: 96px; }
  .chapter-map { height: 127px; }
}

@media (orientation: landscape) and (min-width: 800px) and (max-height: 500px) {
  .chapter-map { height: 190px; }
}

@media (min-width: 760px) and (orientation: portrait) {
  .start-cluster { width: 460px; }
  .secondary-rail { top: 43%; }
  .rail-left { left: calc(50% - 300px); }
  .rail-right { right: calc(50% - 300px); }
  .hero-copy { top: 55%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .08s !important; }
  .world { transform: none; }
  .reward-flight.flying { animation-name: rewardFade; }
  @keyframes rewardFade { from { opacity: .8; transform: translate(-50%, -50%) scale(.9); } to { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
}
