:root {
  --bg: #2a2118;
  --bg-2: #1c150f;
  --paper: #d8c7a3;
  --paper-2: #cbb58c;
  --ink: #2b1f15;
  --ink-soft: #4b3a2a;
  --accent: #7a4a24;
  --accent-2: #9c6a38;
  --accent-3: #5d2f1b;
  --border: #8a6a45;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --success: #516b3b;
  --danger: #8a3f2f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255,235,200,0.06), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.hero {
  padding: 2.5rem 1.5rem 2rem;
  border-bottom: 2px solid rgba(216,199,163,0.15);
}

.hero-inner {
  max-width: 1250px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 3rem;
  color: var(--paper);
  letter-spacing: 0.02em;
}

.hero p {
  margin: 0;
  color: rgba(216,199,163,0.9);
  font-size: 1.1rem;
  max-width: 850px;
}

.coin-box {
  min-width: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.coin {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: #4a2e12;
  background:
    radial-gradient(circle at 30% 30%, #f8e4a8 0%, #d4a940 55%, #8e6320 100%);
  border: 3px solid #f0d080;
  box-shadow: 0 0 0 4px rgba(240,208,128,0.15), var(--shadow);
}

.layout {
  max-width: 1250px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 280px 1fr 270px;
  gap: 1rem;
}

.full-width {
  grid-column: 1 / -1;
}

.panel {
  background:
    linear-gradient(180deg, rgba(216,199,163,0.98), rgba(203,181,140,0.97));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.12), transparent 20%),
    radial-gradient(circle at 80% 70%, rgba(120,70,30,0.08), transparent 25%);
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--accent-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(90,55,30,0.18);
  padding-bottom: 0.4rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  width: 100%;
  margin-bottom: 0.35rem;
  font-weight: 700;
  color: var(--ink-soft);
}

input, select, button {
  width: 100%;
  display: block;
  font: inherit;
}

input, select {
  margin-bottom: 0.9rem;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(90,55,30,0.25);
  background: rgba(255,248,230,0.55);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

input:focus, select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(156,106,56,0.15);
  transform: translateY(-1px);
}

button {
  border: 1px solid rgba(90,55,30,0.18);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(180deg, #b98a4d, #996832);
  color: #fff7e6;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 10px rgba(90,55,30,0.18);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:active {
  transform: translateY(1px);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.filter-btn {
  width: auto;
  background: rgba(255,248,230,0.5);
  color: var(--ink-soft);
  border: 1px solid rgba(90,55,30,0.18);
  box-shadow: none;
}

.filter-btn.active {
  background: linear-gradient(180deg, #8f5a2f, #6e4122);
  color: #f8ecd1;
  border-color: #6e4122;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.item-card {
  background: rgba(255,248,230,0.45);
  border: 1px solid rgba(90,55,30,0.18);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.item-card h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--accent-3);
}

.item-card p {
  margin: 0;
}

.tag {
  display: inline-block;
  width: fit-content;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(122,74,36,0.12);
  color: var(--accent-3);
  font-size: 0.85rem;
  font-weight: 700;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
}

.card-footer button {
  width: auto;
  min-width: 110px;
  padding-inline: 1rem;
}

.cart-item,
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px dashed rgba(90,55,30,0.28);
}

.cart-item:last-child,
.history-item:last-child {
  border-bottom: none;
}

.item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.gold-box,
.cart-summary {
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 10px;
  background: rgba(255,248,230,0.42);
  border: 1px solid rgba(90,55,30,0.16);
}

.buy-btn {
  margin-top: 1rem;
  background: linear-gradient(180deg, #6f8a49, #4f6533);
  border-color: rgba(50,70,30,0.35);
}

.message {
  min-height: 1.4rem;
  margin-top: 0.8rem;
  font-weight: 700;
}

.muted {
  color: rgba(43,31,21,0.7);
}

.success {
  color: var(--success);
}

.error {
  color: var(--danger);
}

.help-panel p {
  margin: 0;
}

.coin-spin {
  animation: coinSpin 0.8s cubic-bezier(.2,.8,.2,1);
}

.purchase-pop {
  animation: purchasePop 0.52s ease;
}

.row-drop {
  animation: rowDrop 0.42s ease;
}

.flash {
  animation: flashMessage 0.65s ease;
}

@keyframes coinSpin {
  0% { transform: rotateY(0deg) translateY(0) scale(1); }
  30% { transform: rotateY(360deg) translateY(-6px) scale(1.06); }
  60% { transform: rotateY(720deg) translateY(0) scale(1); }
  100% { transform: rotateY(1080deg) translateY(0) scale(1); }
}

@keyframes purchasePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes rowDrop {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes flashMessage {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero-inner,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
