:root {
  --paper: #f4f0e7;
  --panel: #fbf9f3;
  --ink: #263437;
  --muted: #75807c;
  --line: #d9d5ca;
  --teal: #42a89a;
  --gold: #e2b852;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  background: #dedacf;
  color: var(--ink);
}
button,
a {
  font: inherit;
}
.shell {
  width: min(1410px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  background: var(--paper);
  border: 1px solid rgba(38, 52, 55, 0.12);
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  grid-template-rows: 74px 1fr;
  box-shadow: 0 22px 65px rgba(38, 52, 55, 0.13);
}
.game-head {
  grid-column: 1/3;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  background: rgba(251, 249, 243, 0.9);
}
.game-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 320px;
  letter-spacing: 0.14em;
}
.game-head > div b {
  font-size: 14px;
}
.game-head > div small {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.dot {
  width: 10px;
  height: 10px;
  background: var(--teal);
  border-radius: 50%;
}
.stats {
  display: flex;
  height: 100%;
  margin-left: auto;
}
.stats > span {
  min-width: 100px;
  padding: 16px 20px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.stats small,
.level-copy span,
.panel-title span,
dialog > small,
.card > span {
  font-size: 8px;
  letter-spacing: 0.16em;
  font-weight: 900;
  color: var(--muted);
}
.stats b {
  font-size: 18px;
}
.stats i {
  font-style: normal;
}
.wallet b {
  color: #b78920;
}
.game-head nav {
  display: flex;
  gap: 7px;
  margin-left: 18px;
}
.game-head nav button {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #faf8f1;
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}
.game-head nav button:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.play {
  position: relative;
  min-height: 650px;
  padding: 25px 30px 20px;
  background: repeating-linear-gradient(
    var(--paper) 0,
    var(--paper) 48px,
    rgba(88, 111, 122, 0.09) 49px
  );
}
.level-copy {
  text-align: center;
}
.level-copy h1 {
  font-size: 30px;
  margin: 4px 0 3px;
}
.level-copy p {
  font-size: 12px;
  margin: 0;
  color: var(--muted);
}
.board {
  position: relative;
  min-height: 505px;
  padding: 34px 20px 18px;
  display: flex;
  align-content: center;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 34px 25px;
}
.tube {
  position: relative;
  width: 92px;
  height: 190px;
  border: 3px solid #465255;
  border-radius: 13px 13px 18px 18px;
  background: linear-gradient(
    135deg,
    #536064 0 9%,
    #293639 10% 82%,
    #1f2a2c 83%
  );
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.09),
    inset -4px -5px 0 rgba(0, 0, 0, 0.16),
    0 10px 16px rgba(38, 52, 55, 0.15);
  padding: 0;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    filter 0.22s ease,
    border-color 0.22s ease;
  transform-origin: 50% 15px;
  z-index: 2;
  overflow: visible;
}
.tube:before {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  top: 31px;
  height: 1px;
  background: rgba(255, 255, 255, 0.11);
}
.tube:hover {
  transform: translateY(-7px) rotate(-1deg);
}
.tube.selected {
  transform: translateY(-18px) rotate(1deg);
  filter: drop-shadow(0 9px 8px rgba(66, 168, 154, 0.26));
  border-color: var(--teal);
}
.tube.hint {
  animation: hint 1s ease-in-out 3;
}
.tube.extra {
  border-style: dashed;
}
.cartridge-cap {
  position: absolute;
  width: 37px;
  height: 17px;
  left: 27px;
  top: -14px;
  border: 3px solid #465255;
  border-bottom: 0;
  border-radius: 7px 7px 2px 2px;
  background: repeating-linear-gradient(90deg, #263235 0 4px, #3d494c 4px 7px);
}
.cartridge-cap:after {
  content: "";
  position: absolute;
  width: 13px;
  height: 6px;
  left: 9px;
  top: -7px;
  border-radius: 4px 4px 0 0;
  background: #465255;
}
.cartridge-label {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #e9e5da;
  letter-spacing: 0.11em;
}
.cartridge-label b {
  font-size: 10px;
}
.cartridge-label small {
  font-size: 7px;
  opacity: 0.58;
}
.cartridge-window {
  position: absolute;
  left: 13px;
  right: 13px;
  top: 41px;
  bottom: 18px;
  padding: 4px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  overflow: hidden;
  border: 3px solid #697477;
  border-radius: 7px 7px 12px 12px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.22),
      transparent 28% 72%,
      rgba(255, 255, 255, 0.12)
    ),
    #e9e8e1;
  box-shadow: inset 0 0 12px rgba(25, 35, 37, 0.25);
}
.cartridge-foot {
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: -7px;
  height: 8px;
  border-radius: 0 0 6px 6px;
  background: #465255;
}
.layer {
  width: 100%;
  height: 31px;
  flex: none;
  border-radius: 5px 5px 7px 7px;
  position: relative;
  box-shadow:
    inset 7px 5px 9px rgba(255, 255, 255, 0.18),
    inset -5px -6px 8px rgba(0, 0, 0, 0.1);
}
.tube.receiving {
  animation: receiveInk 0.9s ease-in-out;
}
.pour-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  overflow: visible;
  pointer-events: none;
}
.pour-arc {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 95;
  stroke-dashoffset: 95;
  opacity: 0;
  filter: drop-shadow(0 2px 2px rgba(37, 50, 53, 0.18));
}
.pour-arc.flowing {
  animation: liquidFlow 0.48s ease-out forwards;
}
.pour-drop {
  opacity: 0;
  animation: dropletVisible 0.36s ease 0.25s 2 alternate;
}
@keyframes receiveInk {
  0%,
  100% {
    filter: none;
  }
  36%,
  76% {
    filter: drop-shadow(0 7px 10px rgba(66, 168, 154, 0.32));
    transform: translateY(3px) scale(1.025);
  }
}
@keyframes liquidFlow {
  0% {
    opacity: 0;
    stroke-dashoffset: 95;
  }
  28%,
  76% {
    opacity: 0.9;
    stroke-dashoffset: 0;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: -25;
  }
}
@keyframes dropletVisible {
  from {
    opacity: 0;
  }
  35%,
  100% {
    opacity: 0.95;
  }
}
.layer:after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 4px;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}
.message {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  min-height: 22px;
}
.power-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 23px 16px;
}
.panel-title {
  padding: 2px 5px 13px;
}
.panel-title span,
.panel-title small {
  display: block;
}
.panel-title small {
  font-size: 10px;
  margin-top: 5px;
  color: var(--muted);
}
.power-panel > button,
.power-panel > a {
  width: 100%;
  min-height: 69px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  margin-bottom: 9px;
  padding: 10px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.power-panel > button:hover,
.power-panel > a:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}
.power-panel button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}
.power-panel button > i {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e4f2ef;
  color: var(--teal);
  font-style: normal;
  font-weight: 900;
}
.power-panel span b,
.power-panel span small {
  display: block;
}
.power-panel span b {
  font-size: 10px;
}
.power-panel span small {
  font-size: 8px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.25;
}
.power-panel em {
  font-size: 9px;
  color: #b78920;
  font-style: normal;
  font-weight: 900;
}
.power-panel > a {
  margin-top: 18px;
  background: linear-gradient(145deg, #251a0f, #050505);
  color: white;
  border-color: #5c4212;
}
.power-panel > a img {
  width: 38px;
  max-height: 31px;
  object-fit: contain;
}
.power-panel > a span small {
  color: #c5b487;
}
.power-panel > a em {
  color: #f1c53d;
}
.sponsor-note {
  text-align: center;
  font-size: 8px;
  color: var(--muted);
}
dialog {
  width: min(900px, 92vw);
  max-height: 85vh;
  border: 0;
  border-radius: 22px;
  padding: 28px;
  background: #faf8f1;
  color: var(--ink);
  box-shadow: 0 30px 90px #17202266;
}
dialog::backdrop {
  background: #263437aa;
  backdrop-filter: blur(5px);
}
dialog h2 {
  font-size: 32px;
  margin: 5px 0;
}
dialog p {
  color: var(--muted);
  font-size: 12px;
}
.close {
  position: absolute;
  right: 18px;
  top: 15px;
  border: 0;
  background: none;
  font-size: 28px;
  cursor: pointer;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
  margin-top: 22px;
}
.level-grid button {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  position: relative;
}
.level-grid button.done {
  background: #e4f2ef;
  color: #267d72;
}
.level-grid button.current {
  outline: 2px solid var(--gold);
}
.level-grid button:disabled {
  opacity: 0.3;
}
.level-grid button small {
  display: block;
  font-size: 6px;
  color: var(--muted);
}
.overlay {
  position: fixed;
  inset: 0;
  background: #263437b8;
  display: grid;
  place-items: center;
  z-index: 20;
  backdrop-filter: blur(7px);
}
.overlay.hidden {
  display: none;
}
.card {
  width: min(430px, 90vw);
  padding: 35px;
  border-radius: 24px;
  background: #faf8f1;
  text-align: center;
  box-shadow: 0 30px 90px #10171866;
}
.card h1 {
  font-size: 68px;
  line-height: 0.78;
  letter-spacing: -0.07em;
  margin: 16px 0 23px;
}
.card h2 {
  font-size: 36px;
  margin: 12px 0;
}
.card p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.card button {
  display: block;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  margin-top: 18px;
  cursor: pointer;
}
.card button.quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  margin-top: 8px;
}
.card > small {
  display: block;
  font-size: 8px;
  color: var(--muted);
  margin-top: 12px;
}
.reward {
  background: #f2ead2;
  border-radius: 16px;
  padding: 14px;
}
.reward small,
.reward b {
  display: block;
}
.reward small {
  font-size: 8px;
  letter-spacing: 0.15em;
}
.reward b {
  font-size: 30px;
  color: #b78920;
}
.reward i {
  font-style: normal;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  transform: translate(-50%, 20px);
  background: #263437;
  color: white;
  border-radius: 30px;
  padding: 10px 18px;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 40;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@keyframes hint {
  50% {
    transform: translateY(-13px);
    box-shadow: 0 0 0 6px rgba(226, 184, 82, 0.25);
  }
}
@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .game-head {
    grid-column: 1;
  }
  .power-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .power-panel .panel-title,
  .power-panel > a,
  .sponsor-note {
    grid-column: 1/4;
  }
  .power-panel > button {
    margin: 0;
  }
  .stats > span {
    min-width: 75px;
    padding: 17px 10px;
  }
  .game-head > div {
    min-width: auto;
  }
  .game-head > div small {
    display: none;
  }
}
@media (max-width: 620px) {
  .shell {
    width: 100%;
    margin: 0;
    border-radius: 0;
  }
  .game-head {
    padding: 0 8px;
  }
  .game-head > div b {
    font-size: 10px;
  }
  .stats > span:nth-child(2) {
    display: none;
  }
  .game-head nav {
    margin-left: 5px;
  }
  .game-head nav button {
    width: 32px;
    height: 32px;
  }
  .play {
    padding: 18px 5px;
  }
  .board {
    gap: 26px 13px;
    padding: 22px 4px;
  }
  .tube {
    width: 70px;
    height: 154px;
  }
  .cartridge-cap {
    left: 20px;
  }
  .cartridge-window {
    left: 9px;
    right: 9px;
  }
  .layer {
    height: 24px;
  }
  .power-panel {
    padding: 14px 8px;
  }
  .power-panel > button {
    grid-template-columns: 28px 1fr;
  }
  .power-panel button > i {
    width: 27px;
    height: 27px;
  }
  .power-panel button em {
    display: none;
  }
  .level-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
