:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #192d48;
  background: #e9f2f4;
  --ink: #192d48;
  --muted: #4b6378;
  --blue: #2244cb;
  --blue-vivid: #3b60e7;
  --line: #b3c7d2;
  --number: "Bahnschrift", "DIN Alternate", "Segoe UI", sans-serif;
  --game-width: clamp(320px, calc(56.25svh - 167px), 440px);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  min-width: 300px;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -5%, #f9fcfa 4%, #ecf5f5 53%, transparent 78%),
    linear-gradient(150deg, #d9eced, #eaf0fc 72%, #dce9fa);
  min-height: 100svh;
}
[hidden] { display: none !important; }
button { color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #4869e6; outline-offset: 3px; }
p, h1, h2, h3 { margin: 0; }
i.icon { display: block; position: relative; width: 20px; height: 20px; flex-shrink: 0; font-style: normal; }

.masthead { background: #faffff9c; border-bottom: 1px solid #ccdcdf; box-shadow: 0 3px 18px #2947610b; }
.masthead-inner {
  max-width: calc(var(--game-width) + 24px);
  margin: auto;
  padding: 0 12px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand, .mast-actions { display: flex; align-items: center; }
.brand { min-width: 0; gap: 8px; }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  border: 1px solid #2347b8;
  border-radius: 10px;
  background: linear-gradient(145deg, #7398fd, #3458dc 58%, #2145bf);
  box-shadow: inset 0 2px 1px #ffffff83, inset 0 -3px 0 #142b8244, 0 3px 5px #2d50b43d;
}
.brand-mark::before {
  content: "";
  width: 23px;
  height: 23px;
  background: linear-gradient(150deg, #fff, #cbdcff);
  clip-path: polygon(25% 7%,75% 7%,100% 50%,75% 93%,25% 93%,0% 50%);
  transform: rotate(-14deg);
}
.brand-mark span { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #3255ce; box-shadow: inset 0 1px 2px #162e82; }
.brand h1 { font-size: 17px; line-height: 1.1; font-weight: 850; }
.mast-actions { flex-shrink: 0; gap: 6px; }
.wallet, .icon-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid #c6d7e2;
  background: linear-gradient(#fff, #edf5fa);
  box-shadow: inset 0 -2px 0 #cedee94f, 0 2px 3px #324d6a10;
}
.wallet:hover, .icon-button:hover { background: #f0f4ff; border-color: #91ade0; }
.wallet { gap: 5px; padding: 0 6px; }
.wallet strong { min-width: 22px; font: 800 16px/1 var(--number); text-align: center; }
.wallet-plus { font: 800 17px/1 var(--number); color: var(--blue); }
.coin {
  width: 19px;
  height: 19px;
  display: inline-block;
  flex: 0 0 19px;
  position: relative;
  border-radius: 50%;
  border: 1px solid #b87915;
  background: linear-gradient(145deg, #ffed9f, #ffc654 61%, #f09e23);
  box-shadow: inset 0 0 0 2px #fff0a5, 0 1px 1px #a96a413d;
}
.coin::after { content: ""; position: absolute; inset: 5px; border-radius: 2px; transform: rotate(45deg); background: #c98018; }
.icon-button { padding: 0; min-width: 34px; }
.rules-button { padding: 0 8px; color: var(--blue); font-size: 13px; font-weight: 750; }
.icon-sound::before { content: ""; position: absolute; inset: 4px 8px 4px 1px; background: currentColor; clip-path: polygon(0 33%,40% 33%,100% 0,100% 100%,40% 67%,0 67%); }
.icon-sound::after { content: ""; position: absolute; inset: 3px 1px 3px 7px; border-right: 2px solid currentColor; border-radius: 50%; }
[aria-pressed="false"] .icon-sound::after { border: 0; inset: 9px 0 auto 4px; height: 2px; background: #b05249; transform: rotate(-44deg); }

.game { container-type: inline-size; width: min(calc(100% - 12px), var(--game-width)); margin: 8px auto 18px; }
.game-head { display: flex; align-items: end; justify-content: space-between; gap: 8px; padding: 0 3px 6px; }
.level-meta { display: flex; align-items: center; gap: 7px; }
.level-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 8px 0 10px;
  border: 1px solid #a8bdea;
  border-radius: 9px;
  background: linear-gradient(#fff, #e7eeff);
  color: var(--blue);
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .045em;
  box-shadow: inset 0 -2px 0 #c1cff849;
}
.level-picker:hover:enabled { background: #deebff; border-color: #6689d5; }
.icon.icon-grid { width: 14px; height: 14px; }
.icon-grid::before { content: ""; position: absolute; top: 2px; left: 2px; width: 4px; height: 4px; border-radius: 1px; background: currentColor; box-shadow: 6px 0 currentColor, 0 6px currentColor, 6px 6px currentColor; }
.mode { padding: 4px 8px; border: 1px solid #b8dbcf; border-radius: 7px; background: #dff1e9; color: #22634d; font-size: 12px; font-weight: 760; white-space: nowrap; }
.mode[data-mode="Bonus"] { border-color: #e7c98b; background: #fff0cb; color: #845011; }
.mode[data-mode="Challenge"] { border-color: #f0b7a8; background: #fbe5de; color: #9d3a2c; }
.game-head h2 { font-size: clamp(24px, 7cqw, 30px); font-weight: 850; line-height: 1.14; margin-top: 4px; letter-spacing: .035em; }
.progress { width: min(35%, 122px); margin-bottom: 3px; }
.progress-label { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; margin-bottom: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-label strong { color: var(--ink); font: 800 14px var(--number); }
progress { appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 12px; overflow: hidden; background: #d6e2ed; color: var(--blue); }
progress::-webkit-progress-bar { background: #d6e2ed; border-radius: 12px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #5d8af0, #3055df); border-radius: 12px; }
progress::-moz-progress-bar { background: #3d62e1; border-radius: 12px; }

.machine {
  position: relative;
  isolation: isolate;
  padding: 6px 4px 7px;
  border: 1px solid #98b5bf;
  border-radius: 17px;
  background: linear-gradient(158deg, #f8feff, #e0edf1 54%, #cbdde5);
  box-shadow: inset 0 2px 1px #fff, inset 0 -5px 0 #7599a730, 0 7px 0 -3px #a2bdcb, 0 13px 29px #21456823;
}
.sorting { margin: 0 auto 6px; }
.sorting-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; max-width: 96%; margin: 0 auto 2px; color: #446075; }
.sorting-head h3 { font-size: 13px; font-weight: 780; color: #254059; }
.sorting-head span { font-size: 12px; font-weight: 690; }
.racks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 2px;
  border: 1px solid #aabfca;
  border-radius: 10px;
  background: linear-gradient(0deg, #dce8ed, #ccdce3 62%, #a3bcca);
  box-shadow: inset 0 2px 4px #46617f32, 0 1px 0 #fff9;
}
.racks[data-size="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rack-lane { min-width: 0; overflow: clip; border-radius: 8px; background: #6f8d9c22; }
.rack {
  position: relative;
  isolation: isolate;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 5px 6px;
  border: 1px solid color-mix(in srgb, var(--tone-deep), #51465d 16%);
  border-radius: 8px;
  background:
    linear-gradient(112deg, #ffffff44, transparent 44%),
    linear-gradient(180deg, var(--tone-light), var(--tone) 62%, color-mix(in srgb, var(--tone-deep), var(--tone) 63%));
  box-shadow: inset 0 2px 1px #fff9, inset 0 -4px 0 #31435b33, inset 2px 0 0 #ffffff46, 0 2px 3px #34506340;
}
.rack::before { content: ""; position: absolute; inset: 3px; border: 1px solid #ffffff6b; border-radius: 5px; pointer-events: none; z-index: -1; }
.rack.empty { --tone-light: #edf4f7; --tone: #cfdee6; --tone-deep: #849dad; color: #52677a; }
.racks[data-size="3"] .rack { flex-direction: column; justify-content: center; gap: 3px; }
.rack-label { min-width: 0; display: flex; align-items: center; gap: 5px; }
.rack-label strong { color: #1e2538; font-size: 12px; white-space: nowrap; }
.rack-marker { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 2px; border: 1px solid var(--tone-deep); background: linear-gradient(145deg, var(--tone-light), var(--tone)); box-shadow: inset 0 1px 1px #fff8; }
.rack-tally { display: none; }
.rack-tally i { width: 4px; height: 4px; border-radius: 50%; background: #24405543; }
.rack[data-count="1"] .rack-tally i:first-child,
.rack[data-count="2"] .rack-tally i:nth-child(-n + 2),
.rack[data-count="3"] .rack-tally i { background: #fff4d7; box-shadow: 0 0 3px #fff9; }
.rack-sockets, .buffer-slots { display: flex; align-items: center; gap: 4px; }
.hole {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(19px, 6cqw, 27px);
  aspect-ratio: 1;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid #7891aa;
  background: radial-gradient(circle at 48% 74%, #b9ccd9, #7a97ad 79%);
  box-shadow: inset 0 3px 5px #2239506e, 0 1px 0 #fffd;
}
.rack .hole {
  border-color: color-mix(in srgb, var(--tone-deep), #293548 24%);
  background: radial-gradient(circle at 42% 74%, color-mix(in srgb, var(--tone), var(--tone-deep) 26%), var(--tone-deep) 86%);
  box-shadow: inset 0 3px 6px #202f4f87, inset 1px 0 1px #231e5566, 0 1px 0 #fff9;
}
.rack .hole::before { content: ""; position: absolute; inset: 3px; border: 1px dashed #fff7; border-radius: 50%; pointer-events: none; }
.in-flight .fastener { visibility: hidden; }

.board-frame {
  border-radius: 12px;
  aspect-ratio: 9 / 16;
}
.board {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(#83a8b059 .85px, transparent 1px),
    radial-gradient(ellipse at 50% 46%, #faffff, #e2f0f1 65%, #cbdfe6);
  background-size: 9px 9px, 100% 100%;
  background-position: center;
  box-shadow: inset 0 0 0 1px #9fb9c4, inset 0 0 0 4px #b4ccd6, inset 0 0 14px #3e6c824a;
  touch-action: manipulation;
}
.board::before {
  position: absolute;
  content: "";
  inset: 1.25% 1.9%;
  border-radius: 8px;
  border: 1px solid #aac5caa8;
  border-bottom: 2px solid #a2bbc7;
  box-shadow: inset 1px 0 0 #fff9, 0 1px 0 #ffffffa8;
  pointer-events: none;
}
.board::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: auto 12% 3% 12%;
  height: 6%;
  border: 1px solid #97b6c0ab;
  border-bottom: 3px solid #9fbec8;
  border-radius: 10px;
  background: linear-gradient(#9fbcc65c, #ccdfe72e 82%, #a8c4cd9c);
  box-shadow: inset 0 1px 3px #4a687b22, 0 1px 0 #ffffffad;
}
.plate {
  position: absolute;
  display: block;
  border: 1px solid color-mix(in srgb, var(--plate-edge), transparent 17%);
  border-radius: 999px;
  padding: 0;
  background:
    linear-gradient(140deg, #fff9, transparent 42%),
    linear-gradient(175deg, color-mix(in srgb, var(--plate-light), transparent 38%), color-mix(in srgb, var(--plate-mid), transparent 42%) 52%, color-mix(in srgb, var(--plate-edge), transparent 37%));
  box-shadow: inset 0 2px 1px #fff9, inset 0 -2px 1px color-mix(in srgb, var(--plate-edge), transparent 45%), 0 3px 5px #20384b24;
  transform: translate(-50%,-50%) rotate(var(--angle));
  pointer-events: none;
}
.plate::before { position: absolute; content: ""; inset: 3px; border: 1px solid #fff9; border-radius: inherit; pointer-events: none; }
.plate::after { position: absolute; content: ""; top: 15%; left: 14%; right: 22%; height: 1px; background: linear-gradient(90deg, transparent, #fff9 25%, #fff9 63%, transparent); }
.plate:not(:disabled) { pointer-events: auto; cursor: crosshair; }
.plate:not(:disabled):hover { outline: 2px dashed var(--blue); outline-offset: -3px; }
.plate-port {
  position: absolute;
  z-index: 1;
  width: clamp(18px, 9cqw, 48px);
  height: auto;
  aspect-ratio: 1;
  top: 50%;
  border-radius: 100%;
  border: 1px solid color-mix(in srgb, var(--plate-edge), #385672 12%);
  background: #c3dce041;
  box-shadow: inset 0 2px 3px #183c6180, 0 1px 0 #fffb;
  transform: translate(-50%,-50%);
  pointer-events: none;
}
.screw {
  position: absolute;
  width: clamp(28px, 9.9cqw, 52px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  transform: translate(-50%,-50%);
}
.screw[data-covered="true"] { pointer-events: none; opacity: .67; filter: saturate(.72) brightness(.89); }
.screw.queued::after {
  position: absolute;
  content: "";
  inset: -2px;
  border: 2px solid #365de1;
  border-radius: 50%;
  pointer-events: none;
}
.mini-fastener.landed { animation: screw-landing .1s ease-out both; }
@keyframes screw-landing {
  from { transform: scale(1,.88); filter: brightness(1.18); }
  45% { transform: scale(.94,1.08); }
  to { transform: scale(1,1); }
}
.screw:enabled:hover .fastener { transform: scale(1.11); filter: brightness(1.07); }
.screw:enabled:active .fastener { transform: scale(.92); }
.fastener {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 83%;
  height: auto;
  aspect-ratio: 1;
  max-width: 52px;
  margin: auto;
  border: 1px solid var(--tone-deep);
  border-radius: 50%;
  background:
    conic-gradient(from -40deg, #ffffff7c, transparent 16%, #26364b15 38%, #fff4 47%, transparent 64%, #26364b22 83%, #ffffff7c),
    radial-gradient(ellipse at 34% 27%, var(--tone-light) 0%, var(--tone) 55%, var(--tone-deep) 125%);
  box-shadow: inset 0 0 0 1.5px var(--tone-light), inset 0 -3px 0 #1a233a32, 0 2px 3px #26394d81;
  transition: transform .12s, filter .12s;
}
.mini-fastener { width: 77%; box-shadow: inset 0 0 0 1px var(--tone-light), inset 0 -1px 1px #20324750, 0 1px 2px #24384c70; }
.fastener::before, .fastener::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  border-radius: 2px;
  background: var(--tone-deep);
  box-shadow: inset 0 1px 1px #2635465b, 0 1px 0 var(--tone-light);
}
.fastener::before { width: 51%; height: 15%; }
.fastener::after { width: 15%; height: 51%; }
.cut-cross::after { box-shadow: 0 1px 0 var(--tone-light); }
.cut-slash::before { transform: translate(-50%,-50%) rotate(-45deg); }
.cut-slash::after, .cut-line::after, .cut-diamond::after { display: none; }
.cut-diamond::before { width: 32%; height: 32%; transform: translate(-50%,-50%) rotate(45deg); }
.screw.suggested::after { position: absolute; content: ""; inset: -4px; border: 2px dashed #2348d0; border-radius: 50%; pointer-events: none; animation: pulse .7s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .52; inset: -7px; } }
#motion-layer { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.flying { position: absolute; max-width: none; border-width: 1px; margin: 0; will-change: transform; }

.buffer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 40px;
  margin: 4px auto 0;
  padding: 2px 3px 0;
}
.buffer h3 { font-size: 13px; color: #233c57; font-weight: 790; white-space: nowrap; }
.buffer-copy span { display: block; font-size: 10px; color: var(--muted); }
.buffer-right { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.buffer-slots {
  gap: 3px;
  padding: 3px 4px;
  border: 1px solid #a2bac5;
  border-radius: 12px;
  background: linear-gradient(#c0d4dd, #d5e5ea);
  box-shadow: inset 0 2px 3px #55798b40, 0 1px 0 #ffffffc9;
}
.buffer .hole { width: clamp(18px, 5.4cqw, 26px); }
.buffer-right strong { font: 800 12px var(--number); color: #345475; }
.buffer.danger strong { color: #9e362d; }
.buffer.danger .buffer-slots { background: #ffe4da; border-color: #daa291; }

.game-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 32px; margin: 4px 1px 2px; }
.status { display: flex; align-items: baseline; gap: 6px; font-size: 12px; line-height: 1.5; color: #38526b; }
.status-mark { width: 15px; height: 15px; flex: 0 0 15px; display: inline-grid; place-items: center; border-radius: 50%; background: #dfe9ff; color: #2e50bd; font: 800 11px/1 var(--number); }
.game-actions { display: flex; gap: 4px; }
.utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 46px;
  min-height: 30px;
  padding: 0 4px;
  border: 1px solid #bdcfdf;
  border-radius: 8px;
  background: linear-gradient(#fbfdff, #eaf3fd);
  color: var(--blue);
  font-size: 12px;
  font-weight: 790;
  white-space: nowrap;
}
.utility:hover:enabled { background: #e3ecff; border-color: #839ed6; }
.utility:disabled { opacity: .58; }
.utility span { font: 850 19px/1 var(--number); }
.utility .icon-hint { width: 16px; height: 16px; }
.icon-hint::before { content: ""; position: absolute; inset: 2px 3px 5px; border: 2px solid currentColor; border-radius: 60% 60% 44% 44%; }
.icon-hint::after { content: ""; position: absolute; width: 6px; height: 2px; left: 5px; bottom: 2px; border-radius: 4px; background: currentColor; }

.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.tool {
  position: relative;
  min-width: 0;
  min-height: 47px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 3px;
  text-align: center;
  border: 1px solid #abc1cf;
  border-radius: 11px;
  background: linear-gradient(#fbffff, #eaf3f8);
  box-shadow: inset 0 -3px 0 #aec8d557, 0 3px 4px #2947650d;
}
.tool:hover:enabled, .tool[aria-pressed="true"] { z-index: 1; border-color: #7c9ce4; background: #edf3ff; }
.tool[aria-pressed="true"] { outline: 2px solid #7393eb; }
.tool:disabled { opacity: .8; }
.tool-copy { min-width: 0; }
.tool strong { display: block; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tool small { display: none; }
.tool-icon { display: grid; place-items: center; width: 23px; height: 23px; flex: 0 0 23px; border-radius: 7px; border: 1px solid var(--tool-border); color: var(--tool-ink); background: var(--tool-bg); box-shadow: inset 0 1px 1px #fffc, inset 0 -2px 0 #40527021; }
.tool-icon .icon { scale: .86; }
.tool-counter { position: absolute; top: 4px; right: 4px; min-width: 14px; padding: 1px; border: 1px solid #bfced9; border-radius: 6px; background: #edf4fa; text-align: center; color: #3b5674; font: 800 10px/1 var(--number); }
[data-tool="drill"] { --tool-ink: #3152be; --tool-bg: #dce7ff; --tool-border: #afc4f5; }
[data-tool="hammer"] { --tool-ink: #a24c24; --tool-bg: #ffe3d1; --tool-border: #eebd9f; }
[data-tool="magnet"] { --tool-ink: #1b775f; --tool-bg: #cfefdf; --tool-border: #a3d0c3; }
[data-tool="box"] { --tool-ink: #7546a3; --tool-bg: #eee0ff; --tool-border: #d5bde9; }
.icon-drill::before { content: ""; position: absolute; inset: 2px 1px; background: currentColor; clip-path: polygon(3% 13%,72% 13%,72% 24%,98% 24%,98% 43%,71% 43%,62% 57%,47% 58%,44% 95%,22% 95%,24% 57%,3% 57%); transform: rotate(-9deg); }
.icon-hammer::before { content: ""; position: absolute; inset: 1px 2px; background: currentColor; clip-path: polygon(5% 9%,95% 9%,95% 40%,62% 40%,62% 97%,39% 97%,39% 40%,5% 40%); transform: rotate(23deg); }
.icon-magnet::before { content: ""; position: absolute; inset: 2px; border: 4px solid currentColor; border-top: 0; border-radius: 0 0 8px 8px; transform: rotate(-20deg); }
.icon-box::before { content: ""; position: absolute; inset: 5px 2px 2px; border: 2px solid currentColor; border-radius: 3px; }
.icon-box::after { content: "+"; position: absolute; inset: 0; text-align: center; font: 800 18px/20px var(--number); }

dialog { padding: 0; width: min(calc(100% - 26px), 460px); max-height: calc(100% - 24px); color: var(--ink); border: 1px solid #a4bccd; border-radius: 22px; background: linear-gradient(#faffff, #edf5fa); box-shadow: 0 22px 75px #18395356; }
dialog::backdrop { background: #1b375c70; backdrop-filter: blur(3px); }
.dialog-card { position: relative; padding: 21px; }
.close-dialog { position: absolute; top: 10px; right: 10px; min-width: 33px; min-height: 33px; font-size: 20px; }
.dialog-emblem { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(#edf3ff, #d6e3ff); color: var(--blue); border: 1px solid #afbff0; box-shadow: inset 0 1px 0 #fff; font: 820 23px var(--number); }
.dialog-card h2 { margin: 7px 0; font-size: 25px; font-weight: 850; }
#dialog-body { color: #36506a; font-size: 14px; line-height: 1.64; }
.rule-goal { color: var(--ink); font-weight: 700; }
.rule-steps { padding-left: 1.4em; margin: 10px 0 14px; }
.rule-steps li + li { margin-top: 7px; }
.rule-heading { color: var(--ink); font-size: 15px; margin-bottom: 5px; }
.rule-tools { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 11px; margin: 0; }
.rule-tools dt { font-weight: 700; color: var(--ink); }
.rule-tools dd { margin: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.primary, .secondary { min-height: 39px; padding: 5px 11px; font-size: 14px; font-weight: 770; border-radius: 9px; }
.primary { background: linear-gradient(#5279ee, #3458de); border: 1px solid #274abb; color: white; box-shadow: inset 0 1px 0 #ffffff80, inset 0 -2px 0 #2338a65e; }
.primary:hover:enabled { background: linear-gradient(#4369e4, #2446c9); }
.secondary { background: #f5f9ff; border: 1px solid #bfd2e5; }
.secondary:hover:enabled { background: #e3ecff; }
.primary:disabled, .secondary:disabled { color: #586e86; background: #e4edf5; border-color: #bfd0df; box-shadow: none; }
.shop-items { display: grid; gap: 6px; margin-top: 9px; }
.shop-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 8px; background: #e6eff6; border-radius: 9px; }
.shop-row strong { color: var(--ink); }
.shop-row small { display: block; }
.shop-row button { white-space: nowrap; }
.win-reward { margin: 7px 0; padding: 5px 9px; border-radius: 8px; background: #fceec6; color: #7a4d17; font-weight: 760; }
.level-caption { margin-bottom: 6px; }
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stage { display: flex; align-items: center; gap: 5px; min-height: 41px; padding: 3px 5px; border-radius: 8px; border: 1px solid #b8ccda; background: #f4f9fc; text-align: left; }
.stage b { font: 840 15px var(--number); }
.stage span { font-size: 12px; line-height: 1.2; overflow-wrap: anywhere; }
.stage[data-mode="Challenge"] { background: #fae6df; color: #8e3f32; border-color: #e0bfb3; }
.stage[data-mode="Bonus"] { background: #fff2d0; color: #805019; border-color: #edd5a6; }
.stage[data-cleared="true"] b::after { content: "✓"; color: #0c7555; display: block; font-size: 11px; }
.stage:disabled { opacity: .66; }
.stage[aria-current="true"] { background: #3a5bdc; border-color: #2f4aac; color: #fff; }
.stage[aria-current="true"] b::after { color: #d9ffe0; }
.no-script { margin: 15px; }

@media (max-width: 345px) {
  .brand { gap: 6px; }
  .brand h1 { font-size: 16px; }
  .mast-actions { gap: 4px; }
  .game-footer { gap: 3px; }
  .status-mark { display: none; }
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

.source-footer { margin-top: 12px; font-size: 12px; }
.source-footer a { display: inline-block; padding: 8px 0; color: var(--muted); text-underline-offset: 3px; }
.source-footer a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
