/* ============================================================
   TTRPG LOOT GENERATOR — tool-specific styles
   Loads after tool-page.css
   ============================================================ */

/* Ambient mood — gold/crimson */
body::after {
  background:
    radial-gradient(ellipse 130% 55% at 50% -8%,  rgba(200,140,30,0.20) 0%,  transparent 60%),
    radial-gradient(ellipse 55%  45% at  4% 95%,  rgba(180,60,30,0.12)  0%,  transparent 55%),
    radial-gradient(ellipse 45%  40% at 96% 88%,  rgba(120,80,200,0.08) 0%,  transparent 55%),
    radial-gradient(ellipse 70%  35% at 50% 110%, rgba(200,160,40,0.07) 0%,  transparent 50%);
}

/* ---- Tool section wrapper (matches books) ---- */
.tool-section { width: 100%; padding: 0; }

/* ---- Loot grid — flex wrapping centered, identical to book-grid ---- */
.loot-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  width: 100%;
  padding: 0 10px;
}

/* ---- Loot card — matches .book-card exactly ---- */
.loot-card {
  width: clamp(260px, 22vw, 420px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 6px 28px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.055),
    inset 0 -1px 0 rgba(0,0,0,.3);
  transition: transform .38s cubic-bezier(.34,1.56,.64,1), box-shadow .28s ease;
  position: relative;
  font-size: clamp(13px, 0.85vw, 20px);
  display: flex;
  flex-direction: column;
}
.loot-card:hover {
  transform: translateY(-12px) scale(1.018);
  box-shadow:
    0 24px 60px rgba(0,0,0,.7),
    0 0 0 1.5px var(--loot-accent),
    0 0 30px color-mix(in srgb, var(--loot-accent) 25%, transparent),
    inset 0 1px 0 rgba(255,255,255,.07);
}
/* Tier-colored top accent bar */
.loot-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--loot-accent);
  z-index: 2;
  box-shadow: 0 0 14px var(--loot-accent), 0 0 4px rgba(255,255,255,.4);
}

/* Canvas */
.loot-canvas-wrap { width: 100%; background: #080408; position: relative; }
.loot-canvas-wrap canvas { display: block; width: 100%; height: auto; }

/* Info area */
.loot-info {
  padding: 0.9em 1.1em 1.15em;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  flex: 1;
  background: inherit;
}

/* Header row */
.loot-header   { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.loot-title    { font-family: var(--font-d); font-size: 1.02rem; font-weight: 600; color: var(--loot-text, var(--text)); line-height: 1.3; }
.loot-subtitle { font-size: .78rem; color: var(--muted); font-style: italic; }
.loot-total    { font-size: .9rem; font-weight: 700; color: var(--loot-accent, var(--accent)); }

/* Tier badge */
.loot-tier-badge {
  flex-shrink: 0; font-size: .6rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: .18rem .55rem; border-radius: 20px;
  border: 1px solid currentColor; white-space: nowrap; margin-top: 2px;
  line-height: 1.4;
}

/* Item sections */
.loot-section       { background: var(--bg4); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .75rem; }
.loot-section-label { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; font-weight: 700; }
.loot-items         { display: flex; flex-direction: column; gap: .25rem; }
.loot-item          { display: flex; justify-content: space-between; gap: .4rem; font-size: .8rem; line-height: 1.45; }
.loot-item-name     { color: var(--text2); flex: 1; min-width: 0; }
.loot-item-val      { color: var(--muted); flex-shrink: 0; font-size: .75rem; white-space: nowrap; }

/* Special row highlights */
.loot-item.magic    { background: rgba(168,85,247,.10);  border-radius: 4px; padding: 2px 4px; margin: 0 -4px; }
.loot-item.magic    .loot-item-name { color: #c084fc; }
.loot-item.cursed   { background: rgba(220,38,38,.10);   border-radius: 4px; padding: 2px 4px; margin: 0 -4px; }
.loot-item.cursed   .loot-item-name { color: #f87171; }
.loot-item.stolen   { background: rgba(245,158,11,.10);  border-radius: 4px; padding: 2px 4px; margin: 0 -4px; }
.loot-item.stolen   .loot-item-name { color: #fbbf24; }
.loot-item.blessed  { background: rgba(212,175,55,.10);  border-radius: 4px; padding: 2px 4px; margin: 0 -4px; }
.loot-item.blessed  .loot-item-name { color: #fde68a; }
.loot-item.peculiar { background: rgba(20,184,166,.10);  border-radius: 4px; padding: 2px 4px; margin: 0 -4px; }
.loot-item.peculiar .loot-item-name { color: #5eead4; }

/* ---- Card entrance animation (identical to bookIn) ---- */
@keyframes lootIn {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
.loot-card.anim { animation: lootIn .48s cubic-bezier(.34,1.56,.64,1) both; }

/* ---- Print ---- */
@media print {
  .loot-grid { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 1rem; justify-content: unset !important; }
  .loot-card { background: #fff !important; border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
  .loot-title, .loot-item-name, .loot-item-val { color: #000 !important; }
  .loot-total { color: #8a6a00 !important; }
  .loot-section { background: #f8f8f0 !important; border-color: #ccc !important; }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .loot-grid { flex-direction: column; align-items: center; }
  .loot-card { width: 90vw; max-width: 380px; font-size: 14px; }
}
