﻿@import url("https://fonts.googleapis.com/css2?family=Changa+One&family=ZCOOL+KuaiLe&family=Noto+Sans+SC:wght@400;700&display=swap");

:root {
  --bg: #f4f1e8;
  --bg-2: #fbe7d2;
  --ink: #2d2a26;
  --accent: #ff8a3d;
  --accent-2: #3b82f6;
  --accent-3: #18a999;
  --danger: #e24f4f;
  --panel: #fff7eb;
  --panel-edge: #f1d7ba;
  --shadow: 0 12px 28px rgba(33, 30, 26, 0.18);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "ZCOOL KuaiLe", "Microsoft Yahei", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #dff4ff 0%, #e5f9f0 45%, #f7fff5 100%);
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 12px;
  padding: 16px 18px 20px;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(120deg, #e9f7ff, #ecf9f1);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 2px solid #cfe8ea;
}

.topRow {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand.compact {
  gap: 8px;
}

.logo {
  font-size: 28px;
}

.title {
  font-family: "Changa One", "ZCOOL KuaiLe", cursive;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 10px;
  opacity: 0.7;
}

.metaBar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  border-radius: 14px;
  padding: 0;
}

.gradeTag {
  font-weight: 700;
  font-size: 14px;
  color: #5a3a16;
  background-image: url("./assets/img/badge.png?v=0.9.45");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 8px 18px;
  min-width: 110px;
  text-align: center;
}

.coinTag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #5a3a16;
  background-image: url("./assets/img/coinbag.png?v=0.9.45");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 8px 16px 8px 42px;
  min-width: 130px;
}

.coinTag .coinIcon {
  width: 22px;
  height: 22px;
  display: none;
}

.controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

.shopLine {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  padding: 6px 0;
  border-radius: 0;
  border: none;
  background: transparent;
}

.shopListLine,
.itemListLine {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.itemListLine {
  margin-left: auto;
  gap: 8px;
}

.shopToken,
.itemToken {
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 2px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.itemToken {
  border-color: transparent;
  background: transparent;
}

.itemToken.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.7);
}

.shopToken.dragging,
.itemToken.dragging {
  opacity: 0.8;
  transform: scale(1.03);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.shopToken.active,
.itemToken.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.tokenIcon,
.coinIcon {
  width: 64px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shopToken .coinIcon,
.itemToken .coinIcon {
  width: 18px;
  height: 18px;
}

.tokenIcon svg,
.coinIcon svg,
.slotIcon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tokenIcon img,
.coinIcon img,
.slotIcon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.tokenPrice {
  position: absolute;
  left: 30%;
  top: 47%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: 10px;
  color: #4b2e12;
  background: none;
  padding: 0;
  border-radius: 6px;
  pointer-events: none;
}

.shopToken .tokenPrice {
  left: 40%;
}

.itemToken .tokenPrice {
  font-size: 9px;
  color: #111827;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff;
}

.modeMenu {
  position: relative;
}

.menu {
  position: absolute;
  top: 36px;
  right: 0;
  background: #fff;
  border: 1px solid #f1d7ba;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  padding: 6px;
  z-index: 10;
}

.menuItem {
  background: #fff;
  border: 1px solid #f1d7ba;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.menuItem:hover {
  background: #fff3e2;
}


.playfield {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.leftZone {
  position: relative;
  display: grid;
  grid-template-columns: 230px 150px;
  gap: 12px;
  min-height: 560px;
  align-items: stretch;
}

.tray {
  background: #f5fbff;
  border: none;
  border-radius: 20px;
  padding: 12px 10px;
  box-shadow: none;
  display: grid;
  gap: 10px;
  height: 100%;
}

.trayTitle {
  font-size: 14px;
  font-weight: 700;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  overflow-y: auto;
  padding-right: 6px;
}

.card {
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 18px;
  cursor: grab;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  position: relative;
  touch-action: none;
  width: 100%;
  min-height: 56px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("./assets/img/card.png?v=0.9.45");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: 62% 50%;
  box-shadow: none;
}

.card::before {
  content: "";
  position: absolute;
  inset: 8px 44px 8px 32px;
  background: linear-gradient(180deg, #fff8e3, #ffeccc);
  border-radius: 14px;
  border: 1px solid #f4c48a;
  z-index: 0;
}

.cardText {
  position: relative;
  z-index: 1;
  font-weight: 700;
  color: #5a3a16;
  display: block;
  max-width: 68%;
  white-space: nowrap;
  line-height: 1.1;
  text-align: center;
  margin: 0 auto;
}

.cardText.wrap {
  white-space: normal;
  line-height: 1.05;
}

.card.dragging {
  opacity: 0.85;
  cursor: grabbing;
  box-shadow: none;
  transform: scale(1.04);
  z-index: 20;
}

.card.selected {
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.4),
    0 10px 16px rgba(40, 60, 70, 0.18);
}

.slotsColumn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  background: #f5fbff;
  border: none;
  border-radius: 20px;
  padding: 8px;
  box-shadow: none;
}

.leftZone.xray-active .tray,
.leftZone.xray-active .slotsColumn {
  filter: grayscale(1) contrast(1.05);
}

.xrayOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 22px;
  overflow: hidden;
  mix-blend-mode: screen;
  z-index: 4;
}

.xrayOverlay::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(125, 211, 252, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  filter: blur(2px);
  opacity: 0.8;
}

.xrayOverlay.scan::before {
  animation: xray-sweep 3s ease-in-out forwards;
}

@keyframes xray-sweep {
  from {
    transform: translateX(0%);
  }
  to {
    transform: translateX(220%);
  }
}

.xrayLines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  width: 100%;
  height: 100%;
}

.xrayLine {
  stroke: rgba(56, 189, 248, 0.9);
  stroke-width: 3;
  stroke-dasharray: 8 6;
  filter: drop-shadow(0 2px 4px rgba(14, 116, 144, 0.35));
}

.slot {
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 18px;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  min-height: 70px;
  position: relative;
  pointer-events: auto;
  flex: 1;
  overflow: visible;
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 100% 100%;
}

.slot.has-pen {
  background-color: transparent;
}

.slot.selected {
  border-color: transparent;
  box-shadow: none;
}

.slotTop {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slotLevelBadge {
  display: none;
}

.slotMeta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hearts {
  display: flex;
  gap: 2px;
  position: absolute;
  left: 6px;
  top: 4px;
}

.heart {
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-7-4.3-9.5-8.6C.8 9.2 2.6 6 6 6c2 0 3.2 1.2 4 2.4C10.8 7.2 12 6 14 6c3.4 0 5.2 3.2 3.5 6.4C19 16.7 12 21 12 21z' fill='%23ef4444'/></svg>");
  background-size: cover;
}

.heart.off {
  filter: grayscale(1);
  opacity: 0.3;
}

.comboWrap {
  display: flex;
  align-items: center;
}

.comboIcon {
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2l2.5 5L20 6l-3 4 5 1-4 3 2 6-6-3-2 5-2-5-6 3 2-6-4-3 5-1-3-4 5.5 1L12 2z' fill='%23f97316'/></svg>");
  background-size: cover;
  position: relative;
}

.comboNum {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: #111827;
}

.iconTile.dragging {
  opacity: 0.8;
  transform: scale(1.03);
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.2);
}

.slot.filled {
  border-style: none;
  border-color: transparent;
}

.slot.exhausted {
  background: rgba(255, 235, 225, 0.9);
  border-color: var(--danger);
}

.slot.overheated {
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
  filter: brightness(0.85) grayscale(0.25);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: 50% 50%;
}

.slot .penName {
  font-weight: 700;
  font-size: 12px;
}

.slot .prompt {
  position: absolute;
  left: 19.2%;
  top: 35.7%;
  width: 38.5%;
  height: 21.4%;
  transform: none;
  font-size: 11px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 6px;
  border-radius: 8px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.slot .health {
  font-size: 11px;
  opacity: 0.6;
}

.ammoBlocks {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
}

.ammoBlock {
  width: 8px;
  height: 6px;
  background: #ffb35c;
  border-radius: 2px;
}

.slot .revive {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 11px;
  background: var(--accent-3);
  color: #fff;
  border: none;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
}

#arena {
  position: relative;
  background: linear-gradient(160deg, #e7f6ff 0%, #dff4f0 60%, #cfeee5 100%);
  border-radius: calc(var(--radius) + 6px);
  border: 3px solid #b9e0e4;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 560px;
}

#field {
  width: 100%;
  height: 100%;
  display: block;
  background: radial-gradient(circle at 75% 20%, rgba(255, 255, 255, 0.6), transparent 70%);
}

.banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 10px 18px;
  font-weight: 700;
  border: 2px solid #f1c89a;
  box-shadow: var(--shadow);
}

.waveInfo {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: 14px;
  color: #1f3d3c;
}

.toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 35, 30, 0.9);
  color: #fff;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 12px;
}

.versionTag {
  position: absolute;
  right: 10px;
  bottom: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #f1c89a;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 11px;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: transform 0.2s ease;
}

.topbar .btn {
  padding: 4px 10px;
  font-size: 12px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 2px solid #cfe8ea;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.6);
  display: grid;
  place-items: center;
  z-index: 30;
}

.modalCard {
  background: #fff;
  padding: 20px 26px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-width: 320px;
  text-align: center;
}


.statsWrap {
  position: relative;
}

.tooltip {
  position: absolute;
  top: 36px;
  right: 0;
  background: #fff;
  border: 1px solid #cfe8ea;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 12;
}

.slot.fire {
  animation: slotShake 0.25s ease-in-out 2;
}

@keyframes slotShake {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

.wheelCard {
  background: #fff;
  padding: 24px 28px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  width: min(92vw, 820px);
  text-align: center;
}

.wheelWrap {
  position: relative;
  width: min(70vmin, 560px);
  height: min(70vmin, 560px);
  margin: 14px auto;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow: inset 0 0 0 6px #cfe8ea;
  transition: transform 3.2s cubic-bezier(0.15, 0.75, 0.2, 1);
}

.wheelPointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid #ef4444;
  z-index: 2;
}

.wheelResult {
  font-size: 14px;
  margin-bottom: 12px;
}

@media (max-width: 1200px) {
  .playfield {
    grid-template-columns: 1fr;
  }

  .leftZone {
    grid-template-columns: 1fr;
  }

  .slotsColumn {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .slot {
    min-width: 120px;
    flex: 1 1 120px;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}
