:root {
  color-scheme: dark;
  --bg: #030303;
  --panel: #0b0b0c;
  --panel-2: #121214;
  --line: #28282c;
  --text: #f4f1e8;
  --muted: #a7a19a;
  --gold: #f2b84b;
  --red: #ff5a52;
  --blue: #63c5ff;
  --green: #77dd8a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Segoe UI",
    "Noto Sans KR",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.06), transparent 30rem),
    #030303;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px clamp(14px, 4vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(3, 3, 3, 0.88);
  backdrop-filter: blur(10px);
}

.nav-button,
.primary-button,
.sell-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111114;
  color: var(--text);
  cursor: pointer;
}

.nav-button {
  min-width: 72px;
  padding: 0 14px;
}

.nav-button.active {
  border-color: var(--gold);
  color: #111;
  background: var(--gold);
  font-weight: 800;
}

.wallet {
  margin-left: auto;
  min-width: 92px;
  color: var(--gold);
  font-weight: 900;
  text-align: right;
}

main {
  min-height: calc(100vh - 67px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stage {
  display: flex;
  min-height: calc(100vh - 67px);
  width: min(960px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}

.weapon-title {
  display: grid;
  gap: 6px;
  text-align: center;
}

.weapon-title span {
  color: var(--gold);
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 900;
  line-height: 1;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 48px);
  line-height: 1.1;
  font-weight: 900;
}

.image-frame {
  display: grid;
  place-items: center;
  width: min(74vw, 420px);
  aspect-ratio: 1;
}

.weapon-frame img,
.pick-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 38px rgba(242, 184, 75, 0.18));
}

.weapon-frame img.bump,
.pick-frame img.bump {
  animation: bump 240ms ease;
}

.primary-button {
  width: min(320px, 82vw);
  padding: 0 20px;
  border-color: rgba(242, 184, 75, 0.72);
  background: var(--gold);
  color: #0b0905;
  font-size: 18px;
  font-weight: 900;
}

.primary-button:active,
.sell-button:active,
.nav-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.sell-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cost-line,
.date-line,
.result-line {
  min-height: 24px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.result-line.success {
  color: var(--green);
}

.result-line.fail {
  color: var(--red);
}

.mine-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(620px, 100%);
}

.mine-status > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 20, 0.9);
  padding: 12px;
  text-align: center;
}

.label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mine-status strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 20px;
  color: var(--text);
}

.exp-track {
  overflow: hidden;
  width: min(620px, 100%);
  height: 9px;
  border-radius: 999px;
  background: #19191d;
}

#exp-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 200ms ease;
}

.pick-frame {
  width: min(62vw, 340px);
}

.latest-ore {
  display: grid;
  min-height: 110px;
  place-items: center;
}

.latest-ore-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: min(320px, 88vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(17, 17, 20, 0.92);
}

.latest-ore-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.latest-ore-card strong,
.latest-ore-card span {
  display: block;
  overflow-wrap: anywhere;
}

.latest-ore-card strong {
  font-size: 18px;
}

.latest-ore-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.shop-layout {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

.shop-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.shop-list {
  display: grid;
  gap: 10px;
}

.shop-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(17, 17, 20, 0.92);
}

.shop-row img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.ore-name {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.ore-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.price {
  color: var(--gold);
  font-weight: 900;
  white-space: nowrap;
}

.sell-actions {
  display: flex;
  gap: 8px;
}

.sell-button {
  min-width: 68px;
  padding: 0 12px;
  font-weight: 800;
}

.sell-button.all {
  border-color: rgba(99, 197, 255, 0.6);
  color: #dff4ff;
}

@keyframes bump {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.045) rotate(-1deg);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 680px) {
  .topbar {
    gap: 6px;
    padding-inline: 10px;
  }

  .nav-button {
    min-width: 58px;
    padding-inline: 10px;
  }

  .wallet {
    min-width: 70px;
    font-size: 14px;
  }

  .stage {
    min-height: calc(100vh - 67px);
    padding-inline: 16px;
  }

  .mine-status {
    grid-template-columns: 1fr 1fr;
  }

  .mine-status > div:last-child {
    grid-column: 1 / -1;
  }

  .shop-heading {
    align-items: start;
    flex-direction: column;
  }

  .shop-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .shop-row img {
    width: 54px;
    height: 54px;
  }

  .price,
  .sell-actions {
    grid-column: 2;
  }

  .sell-actions {
    width: 100%;
  }

  .sell-button {
    flex: 1;
  }
}
