/* ──────────────────────────────────────────────────────────────────────── */
/*  Raise A House of Knives — ecosystem thieves' guild generator            */
/* ──────────────────────────────────────────────────────────────────────── */

.tg-page { max-width: 1300px; margin: 0 auto; }

/* Header */
.tg-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;
}
.tg-head-kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .25rem .7rem; border-radius: 999px;
  border: 1px solid rgba(200, 60, 60, .3); background: rgba(200, 60, 60, .07);
  color: #ff9ba8; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .5rem;
}
.tg-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%, #e5daff 45%, #f0cf7d 80%, #ff9ba8 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.tg-head-sub { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; max-width: 640px; }
.tg-head-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* Buttons (tg-* for header; tg_* inside modules to match ported markup) */
.tg-btn, .tg_btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; border-radius: 10px;
  font-size: .84rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
  border: 1px solid transparent;
  background: transparent; color: var(--muted); border-color: var(--border);
}
.tg-btn:hover, .tg_btn:hover { color: var(--text); border-color: var(--gold); background: rgba(214,178,87,.06); }
.tg-btn-primary, .tg_btn.primary {
  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);
}
.tg-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(139,112,255,.45); }
.tg_btn.secondary { color: var(--muted); }
.tg-btn:disabled, .tg_btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* Context controls */
.tg-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;
}
.tg-field { display: flex; flex-direction: column; gap: .35rem; min-width: 160px; flex: 1 1 180px; }
.tg-field-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.tg-select {
  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%;
}
.tg-select:focus { border-color: var(--gold); }

/* Cards (shared by all sections) */
.tg_card {
  background: linear-gradient(180deg, var(--panel-top), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.4rem 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  margin-bottom: 1.25rem;
}
.tg_cardBorder { border-left: 3px solid rgba(214,178,87,.4); }
.tg_title { font-family: var(--display); font-size: 1.15rem; color: var(--gold-hi); letter-spacing: .02em; }
.tg_varText { color: var(--gold); }
.tg_indent5 { padding-left: 1.25rem; }
.tg_small { font-size: .8rem; }
.tg_subtle { color: var(--faint); }
.tg_note { color: var(--muted); font-style: italic; }

.tg_guildTitle {
  font-family: var(--display); font-size: clamp(1.5rem, 2.4vw, 2rem);
  color: var(--gold-hi); letter-spacing: .02em; margin: 0 0 .4rem;
  line-height: 1.15;
}

/* Identity row: heraldry + overview */
.tg_identity { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.tg_identity-symbol { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: .6rem; min-width: 200px; }
.tg_identity-body   { flex: 1 1 500px; min-width: 0; }

.heraldry_wrap { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.heraldry_frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.02);
  display: inline-block;
}
.heraldry_frame .hs_inner { position: relative; display: block; }
.heraldry_frame .heraldry_banner { display: block; max-width: 100%; height: auto; }
.heraldry_frame .heraldry_emblem { pointer-events: none; }
.heraldry_reroll {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .85rem; border-radius: 8px;
  font-size: .78rem; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); background: rgba(255,255,255,.02);
  font-family: inherit; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.heraldry_reroll:hover { color: var(--gold); border-color: var(--gold); background: rgba(214,178,87,.06); }

/* Tables */
.tg_table { width: 100%; border-collapse: collapse; }
.tg_table td { padding: .5rem .55rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; font-size: .88rem; }
.tg_table tr:last-child td { border-bottom: none; }
.tg_tableLabel { width: 200px; color: var(--gold); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.tg_tableData  { color: var(--text); line-height: 1.55; }
.tg_ovTable .tg_tableLabel { width: 200px; }
.tg_hcTable th, .tg_hcTable td { padding: .45rem .55rem; border-bottom: 1px solid var(--border-soft); }
.tg_hcTable th { text-align: left; font-size: .7rem; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; }
.tg_hcTable td { font-size: .85rem; color: var(--text); }

/* Grid layouts */
.tg_grid { display: grid; gap: 1rem; }
.tg_grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tg_grid2, .tg_grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem; }
.tg_grid.officers { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Rank & officer cards (inside .tg_grid) */
.tg_grid .tg_card {
  padding: .9rem 1rem 1rem;
  margin: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.015);
  border-color: var(--border-soft);
  box-shadow: none;
}
.tg_grid .tg_card:hover { border-color: rgba(214,178,87,.3); }
.tg_role {
  font-size: .7rem; font-weight: 700;
  color: var(--gold); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: .4rem;
}
.tg_officerBorder {
  padding: .35rem 0 .5rem;
  border-left: 2px solid rgba(214,178,87,.4);
  margin-left: 0; padding-left: 1rem;
}
.tg_officerNameLine { font-weight: 700; color: var(--text); font-size: .98rem; }
.tg_officerRace { color: var(--muted); font-size: .82rem; }
.tg_officerDetails { color: var(--muted); line-height: 1.55; padding-left: 1rem; }
.tg_officerDetails b { color: var(--gold); font-weight: 700; }

.tg_columnHeader {
  font-family: var(--display); font-size: 1.02rem; color: var(--gold); letter-spacing: .02em;
  border-bottom: 1px solid var(--border-soft); padding-bottom: .4rem; margin-bottom: .6rem;
}

.tg_structureNote { font-size: .85rem; color: var(--muted); line-height: 1.55; margin-bottom: .8rem; }

.tg_quests { margin: 0; padding-left: 1.2rem; color: var(--text); }
.tg_quests li { margin: .4rem 0; line-height: 1.55; font-size: .88rem; }

.tg_spinner { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .82rem; }
.tg_spinner::before {
  content: ''; width: 14px; height: 14px;
  border: 2px solid rgba(139,112,255,.25);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: tg-spin .7s linear infinite;
}
@keyframes tg-spin { to { transform: rotate(360deg); } }
.tg_err { color: #ff9ba8; font-size: .82rem; padding: .6rem .9rem; border: 1px solid rgba(233,69,96,.35); background: rgba(233,69,96,.05); border-radius: 10px; }

/* Toast */
.tg-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); }
.tg-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: tg-toast-in .22s ease-out; max-width: 440px; }
.tg-toast i { font-size: .9rem; flex-shrink: 0; }
.tg-toast.is-info i { color: var(--violet); }
.tg-toast.is-warn { border-color: rgba(232,160,80,.5); }
.tg-toast.is-warn i { color: #e8a050; }
.tg-toast.is-error { border-color: rgba(233,69,96,.55); }
.tg-toast.is-error i { color: #e94560; }
.tg-toast.is-out { opacity: 0; transform: translateY(-6px); transition: all .2s ease-in; }
@keyframes tg-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 720px) {
  .tg-head { align-items: stretch; }
  .tg-head-actions { justify-content: flex-start; }
  .tg_identity { flex-direction: column; }
  .tg_tableLabel { width: 140px; }
}

/* Print: keep the full-color screen layout but remove chrome */
@media print {
  body { background: #fff !important; color: #1b1b20; }
  .topbar, .footer, .tg-head-actions, .page-back, .tg-controls, .heraldry_reroll, #tg_reroll_names, .tg-toast-host { display: none !important; }
  .tg_card { background: #fff; border-color: #ccc; box-shadow: none; color: #1b1b20; }
  .tg_guildTitle, .tg_title, .tg_varText, .tg_role, .tg_tableLabel, .tg_columnHeader { color: #1b1b20 !important; -webkit-text-fill-color: #1b1b20 !important; background: none !important; }
  .tg_tableData, .tg_officerDetails, .tg_quests li { color: #2a2a30 !important; }
  .tg_grid .tg_card { border: 1px solid #ccc; }
}
