/* ──────────────────────────────────────────────────────────────────────── */
/*  Conjure a Grim Contraption — ecosystem trap generator                   */
/* ──────────────────────────────────────────────────────────────────────── */

.trap-page { max-width: 1280px; margin: 0 auto; }

/* Header */
.trap-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 1.1rem; border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.trap-head-kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .25rem .7rem; border-radius: 999px;
  border: 1px solid rgba(232,160,80,.32); background: rgba(232,160,80,.07);
  color: #e8a050; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .5rem;
}
.trap-head-title h1 {
  margin: 0 0 .4rem; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 10%, #e0c29a 45%, #f0cf7d 80%, #e8a050 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.trap-head-sub { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; max-width: 640px; }
.trap-head-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* Buttons */
.trap-btn, .trapGen_rollBtn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.05rem; border-radius: 10px;
  font-size: .86rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
  border: 1px solid transparent;
  background: linear-gradient(135deg, #a589ff 0%, var(--violet) 55%, #6a4df4 100%);
  color: #fff; border-color: rgba(139,112,255,.55);
  box-shadow: 0 3px 14px rgba(139,112,255,.3);
}
.trap-btn:hover, .trapGen_rollBtn:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(139,112,255,.45); }
.trap-btn-ghost {
  background: transparent; color: var(--muted); border-color: var(--border); box-shadow: none;
}
.trap-btn-ghost:hover { color: var(--text); border-color: var(--gold); background: rgba(214,178,87,.06); transform: none; }
.trap-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* Controls panel */
.trapGen_controls {
  display: flex; flex-wrap: wrap; gap: 1rem 1.2rem;
  padding: 1rem 1.15rem; border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26,26,45,.65), rgba(19,19,33,.65));
  margin-bottom: 1.25rem; align-items: flex-end;
}
.trapGen_field { display: flex; flex-direction: column; gap: .35rem; min-width: 160px; flex: 1 1 170px; }
.trapGen_field-checkbox { justify-content: flex-end; flex: 1 1 170px; padding-bottom: .3rem; }
.trapGen_field-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.trapGen_select, .trapGen_levelInput {
  padding: .55rem .75rem;
  background: rgba(8,8,14,.65); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-size: .88rem; font-family: inherit; outline: none;
  transition: border-color .15s ease; width: 100%;
}
.trapGen_select:focus, .trapGen_levelInput:focus { border-color: var(--gold); }
.trapGen_switch { display: inline-flex; align-items: center; gap: .55rem; font-size: .86rem; color: var(--muted); cursor: pointer; user-select: none; padding: .4rem 0; }
.trapGen_switch input { display: none; }
.trapGen_switch-track { width: 34px; height: 18px; border-radius: 999px; background: rgba(8,8,14,.6); border: 1px solid var(--border); position: relative; transition: background .2s, border-color .2s; flex-shrink: 0; }
.trapGen_switch-track::after { content: ''; position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.trapGen_switch input:checked + .trapGen_switch-track { background: rgba(139,112,255,.18); border-color: rgba(139,112,255,.55); }
.trapGen_switch input:checked + .trapGen_switch-track::after { transform: translateX(16px); background: var(--gold-hi); }

/* Output grid */
.trapGen_outputRow { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .trapGen_outputRow { grid-template-columns: 1fr 1fr; } }

/* Result + stats cards */
.trapGen_result, .trapGen_stats {
  background: linear-gradient(180deg, var(--panel-top), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  display: flex; flex-direction: column;
}
.trapGen_resultHeader, .trapGen_statsHeader {
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-soft);
}
.trapGen_resultHeader .small, .trapGen_statsHeader .small {
  font-size: .7rem; color: var(--gold); letter-spacing: .1em; font-weight: 700;
  text-transform: uppercase;
}
.trapGen_name {
  font-family: var(--display);
  color: var(--gold-hi);
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  letter-spacing: .02em;
  margin: 0;
  line-height: 1.2;
}

.trapGen_badgeWrap { display: inline-flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.trapGen_badge-severity, .trapGen_badge-level {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap; border: 1px solid;
}
.trapGen_badge-severity {
  color: #e8a050; background: rgba(232,160,80,.08); border-color: rgba(232,160,80,.4);
}
.trapGen_badge-level {
  color: #b29cff; background: rgba(139,112,255,.1); border-color: rgba(139,112,255,.4);
}

.trapGen_tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.trapGen_tags .trapGen_tag,
.trapGen_tags .badge {
  display: inline-flex; align-items: center;
  padding: .2rem .55rem; border-radius: 6px;
  font-size: .7rem; font-weight: 600;
  background: rgba(255,255,255,.04); color: var(--muted);
  border: 1px solid var(--border-soft);
}
.trapGen_tags .tag-mechanical { color: #8ac4d6; border-color: rgba(100,160,200,.4); background: rgba(100,160,200,.08); }
.trapGen_tags .tag-magical    { color: #b29cff; border-color: rgba(139,112,255,.4); background: rgba(139,112,255,.08); }
.trapGen_tags .tag-hybrid     { color: #f3a6ff; border-color: rgba(240,140,255,.4); background: rgba(240,140,255,.08); }
.trapGen_tags .tag-complex    { color: #f0d97a; border-color: rgba(214,178,87,.4); background: rgba(214,178,87,.08); }

.card-body {
  padding: 1.15rem 1.25rem 1.25rem;
  display: flex; flex-direction: column; gap: .7rem;
  flex: 1 1 auto;
}
.trapGen_summary {
  color: var(--text); line-height: 1.65; font-size: .92rem;
  margin: 0 0 .5rem;
}

/* Fact/stat lists */
.trapGen_factlist, .trapGen_statlist {
  display: flex; flex-direction: column; gap: 0;
  margin: 0; padding: 0;
}
.trapGen_factrow, .trapGen_statrow {
  display: grid; grid-template-columns: 150px 1fr;
  gap: .75rem; align-items: baseline;
  padding: .55rem 0; border-bottom: 1px solid var(--border-soft);
  margin: 0;
}
.trapGen_factrow:last-of-type, .trapGen_statrow:last-of-type { border-bottom: none; }
.trapGen_factrow dt, .trapGen_statrow dt {
  color: var(--gold); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  margin: 0;
}
.trapGen_factrow dd, .trapGen_statrow dd {
  color: var(--text); line-height: 1.55; font-size: .9rem; margin: 0;
}
.trapGen_saveType { color: var(--muted); font-size: .78rem; }

.trapGen_rulesNote {
  color: var(--muted); line-height: 1.55; font-size: .82rem;
  padding: .55rem .75rem; border-radius: 8px;
  background: rgba(214,178,87,.05);
  border: 1px solid rgba(214,178,87,.18);
}
.trapGen_gmNotes {
  color: var(--faint); line-height: 1.55; font-size: .78rem; font-style: italic;
  margin: 0;
}

/* Toast */
.trap-toast-host { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; max-width: calc(100vw - 32px); }
.trap-toast { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.05rem; border-radius: 10px; background: linear-gradient(180deg, rgba(26,26,45,.97), rgba(19,19,33,.97)); border: 1px solid var(--border); color: var(--text); font-size: .86rem; box-shadow: 0 10px 28px rgba(0,0,0,.5); pointer-events: auto; animation: trap-toast-in .22s ease-out; max-width: 440px; }
.trap-toast i { font-size: .9rem; flex-shrink: 0; }
.trap-toast.is-info i { color: var(--violet); }
.trap-toast.is-warn { border-color: rgba(232,160,80,.5); }
.trap-toast.is-warn i { color: #e8a050; }
.trap-toast.is-error { border-color: rgba(233,69,96,.55); }
.trap-toast.is-error i { color: #e94560; }
.trap-toast.is-out { opacity: 0; transform: translateY(-6px); transition: all .2s ease-in; }
@keyframes trap-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 720px) {
  .trap-head { align-items: stretch; }
  .trap-head-actions { justify-content: flex-start; }
  .trapGen_factrow, .trapGen_statrow { grid-template-columns: 110px 1fr; }
}

/* Print */
@media print {
  body { background: #fff !important; color: #1b1b20; }
  .topbar, .footer, .trap-head-actions, .page-back, .trapGen_controls, .trap-toast-host { display: none !important; }
  .trapGen_result, .trapGen_stats { background: #fff; border-color: #ccc; box-shadow: none; color: #1b1b20; }
  .trapGen_name, .trap-head-title h1, .trapGen_factrow dt, .trapGen_statrow dt, .trapGen_resultHeader .small, .trapGen_statsHeader .small { color: #1b1b20 !important; -webkit-text-fill-color: #1b1b20 !important; background: none !important; }
  .trapGen_factrow dd, .trapGen_statrow dd, .trapGen_summary { color: #2a2a30 !important; }
}
