:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #0f172a;
  background-color: #0b1120;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.app-root {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b 0, #020617 55%);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
}

.top-bar {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.4rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #9ca3af;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-text {
  font-size: 0.8rem;
  color: #a5f3fc;
}

.tabs {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.25rem 0.5rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.tab {
  border: none;
  background: #1f2937;
  color: #e5e7eb;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-active {
  background: #facc15;
  color: #111827;
  font-weight: 600;
}

.main-content {
  flex: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.25rem 1.25rem 1.5rem;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.subheading {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.field-input,
.field-textarea {
  width: 100%;
  border-radius: 0.55rem;
  border: 1px solid #4b5563;
  background: #020617;
  padding: 0.5rem 0.6rem;
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
}

.field-input:focus,
.field-textarea:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.field-textarea {
  resize: none;
  min-height: 5rem;
  overflow-y: hidden;
}

.compact-pair {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.compact-pair-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.compact-pair-max-btn {
  font-size: 0.7rem;
  padding-inline: 0.6rem;
  padding-block: 0.15rem;
}



.compact-pair-row {
  display: flex;
  gap: 0.4rem;
}

.compact-pair-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.compact-pair-sub {
  font-size: 0.7rem;
  color: #9ca3af;
}

.resources-grid {
  display: grid;
  gap: 0.75rem;
}

.resources-deflect {
  grid-column: 1 / -1;
}

@media (min-width: 700px) {
  .resources-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: flex-start;
  }
}


.btn {
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  border: 1px solid transparent;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary {
  background: #111827;
  border-color: #4b5563;
  color: #e5e7eb;
}

.btn-secondary:hover {
  background: #020617;
}

.btn-primary {
  background: #facc15;
  color: #111827;
  border-color: #facc15;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(0.95);
}

.helper-text {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.btn-inline {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}


.combat-resource-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

.combat-resource {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.9rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.combat-resource-label {
  font-weight: 600;
  line-height: 1.3;
}

.combat-resource-values {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.combat-resource-input {
  width: 4.5rem;
}

.combat-resource-max {
  width: 4.5rem;
  min-width: 3rem;
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-weight: 600;
  text-align: center;
}

.combat-resource-separator {
  color: #9ca3af;
  font-weight: 600;
}

.combat-resource-bar {
  height: 0.5rem;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.combat-resource-fill {
  height: 100%;
  background: #22c55e;
  transition: width 0.2s ease;
}

.fill-health {
  background: #f87171;
}

.fill-focus {
  background: #60a5fa;
}

.fill-investiture {
  background: #a78bfa;
}

.combat-resource-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.combat-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.combat-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}

.combat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.combat-weapon-select {
  max-width: 240px;
}

.combat-weapon-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.combat-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.combat-stat-label {
  font-size: 0.8rem;
  color: #9ca3af;
}

.combat-stat-value {
  font-weight: 600;
  font-size: 1rem;
}

.combat-stat-note {
  margin-top: 0.25rem;
  color: #cbd5e1;
  font-size: 0.82rem;
}

.combat-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.combat-action {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.combat-action summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.combat-action summary::-webkit-details-marker {
  display: none;
}

.combat-action-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.combat-action-summary-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}

.combat-action-title {
  font-weight: 700;
}

.combat-action-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.combat-action-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.combat-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.combat-action-roll,
.combat-action-pill {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.combat-action-pill {
  font-weight: 600;
}

.combat-action-pill-muted {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.combat-action-chevron {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
  border-right: 2px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.combat-action[open] .combat-action-chevron {
  transform: rotate(225deg);
}

.combat-action-body {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.combat-action-text {
  margin-top: 0.35rem;
  line-height: 1.35;
}

.combat-action-filter {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.combat-action-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.combat-action-filter-list {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.35rem;
  display: grid;
  gap: 0.35rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-height: 260px;
  overflow: auto;
}

.combat-action-filter-list-inline {
  max-height: none;
}

.combat-action-filter-types {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.combat-action-filter-subheading {
  font-weight: 700;
}

.combat-action-filter-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.5rem;
  transition: background 0.15s ease;
}

.combat-action-filter-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.combat-action-filter-name {
  font-weight: 600;
}

.combat-action-filter-meta {
  margin-left: auto;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
  backdrop-filter: blur(2px);
}

.modal {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 0.9rem;
  width: min(960px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.modal-header {
  padding: 1rem 1rem 0.4rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.modal-title-group h3 {
  margin: 0;
}

.modal-body {
  padding: 0 1rem 1rem 1rem;
  overflow: auto;
  max-height: calc(85vh - 3.25rem);
}

.combat-status-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.combat-status-item {
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(148, 163, 184, 0.4);
}

@media (min-width: 700px) and (max-width: 1050px) {
  .combat-resource-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .combat-resource { 
    height: 100%;
  }

  .combat-resource-actions {
    justify-content: flex-start;
  }

  .combat-resource-values {
    flex-wrap: nowrap;
  }
}

@media (min-width: 1024px) {
  .combat-stat-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .combat-panels {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    grid-auto-flow: row;
  }

  .combat-panel-actions {
    grid-column: span 2;
  }
}

.footer {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 1.25rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

#file-input {
  display: none;
}

.skills-layout {
  display: flex;
  flex-wrap: wrap;
  column-gap: 2rem;
  row-gap: 1.25rem;
}

.skills-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 260px;
  min-width: 260px;
}

.two-col-layout {
  display: grid;
  gap: 1rem;
}

.stack-vertical {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 700px) {
  .two-col-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-bar-actions {
    align-self: stretch;
    justify-content: flex-start;
  }

  .card {
    padding: 0.8rem;
  }
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-pips {
  display: flex;
  gap: 0.3rem;
}

.skill-pip {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  border: 1px solid #6b7280;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.skill-pip-permanent {
  background: #facc15;
  border-color: #facc15;
}

.skill-pip-temporary {
  background: repeating-linear-gradient(
    135deg,
    #facc15,
    #facc15 2px,
    #020617 2px,
    #020617 4px
  );
  border-color: #facc15;
}

/* Goals table styling */
.goals-table {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.goals-header {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) auto;
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid #1f2937;
}

.goals-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.goals-textarea {
  width: 100%;
  border-radius: 0.55rem;
  border: 1px solid #4b5563;
  background: #020617;
  padding: 0.35rem 0.55rem;
  color: #e5e7eb;
  font-size: 0.85rem;
  outline: none;
  resize: none;
  overflow: hidden;
  min-height: 1.9rem;
}

.goals-textarea:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.goals-pips {
  display: flex;
  gap: 0.25rem;
}

.goal-pip {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  border: 1px solid #6b7280;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.goal-pip-filled {
  background: #facc15;
  border-color: #facc15;
}

.goals-completed-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.goals-completed-checkbox {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: #facc15;
  cursor: pointer;
}

.goals-add-row {
  align-self: flex-end;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  padding-inline: 0.7rem;
  padding-block: 0.25rem;
}

/* Spheres table */
.spheres-table {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.spheres-total {
  text-align: right;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.spheres-header {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(0, 0.7fr));
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid #1f2937;
}

.spheres-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(0, 0.7fr));
  gap: 0.5rem;
  align-items: center;
}

.spheres-gem-label {
  font-size: 0.85rem;
}

.spheres-number-input {
  width: 100%;
  border-radius: 0.55rem;
  border: 1px solid #4b5563;
  background: #020617;
  padding: 0.35rem 0.55rem;
  color: #e5e7eb;
  font-size: 0.85rem;
  outline: none;
}

.spheres-number-input:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

/* Weapons – shared styles */
.weapons-input {
  width: 100%;
  border-radius: 0.55rem;
  border: 1px solid #4b5563;
  background: #020617;
  padding: 0.3rem 0.5rem;
  color: #e5e7eb;
  font-size: 0.8rem;
  outline: none;
}

.weapons-input:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.weapons-textarea {
  min-height: 1.9rem;
  resize: none;
  overflow: hidden;
}

.weapons-equipped-checkbox {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: #facc15;
  cursor: pointer;
}

.weapons-add-row {
  align-self: flex-end;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  padding-inline: 0.7rem;
  padding-block: 0.25rem;
}
.armor-add-row {
  align-self: flex-end;
}
.weapons-remove-row,
.armor-remove-row {
  align-self: flex-end;
  justify-self: end;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  padding-inline: 0.6rem;
  padding-block: 0.2rem;
}



/* Desktop / wide: table layout */
.weapons-table-wrapper {
  width: 100%;
  overflow-x: hidden;
}

.weapons-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.talents-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.weapons-table col.col-type    { width: 17%; }
.weapons-table col.col-damage  { width: 8%; }
.weapons-table col.col-range   { width: 8%; }
.weapons-table col.col-traits  { width: 14%; }
.weapons-table col.col-expert  { width: 14%; }
.weapons-table col.col-skill   { width: 14%; }
.weapons-table col.col-weight  { width: 6%;  }
.weapons-table col.col-value   { width: 8%;  }
.weapons-table col.col-equip   { width: 8%;  }
.weapons-table col.col-remove  { width: 3%;  }
.talents-table col.col-talent     { width: 34%; }
.talents-table col.col-heroic     { width: 28%; }
.talents-table col.col-activation { width: 24%; }
.talents-table col.col-info       { width: 6%;  }
.talents-table col.col-remove     { width: 8%;  }
.armor-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.armor-table col.col-type    { width: 24%; }
.armor-table col.col-deflect { width: 9%; }
.armor-table col.col-traits  { width: 19%; }
.armor-table col.col-expert  { width: 19%; }
.armor-table col.col-weight  { width: 8%;  }
.armor-table col.col-value   { width: 9%;  }
.armor-table col.col-equip   { width: 8%;  }
.armor-table col.col-remove  { width: 4%;  }


.weapons-table th,
.weapons-table td,
.talents-table th,
.talents-table td {
  padding: 0.25rem 0.5rem;
}

.weapons-table th,
.talents-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  text-align: left;
  border-bottom: 1px solid #1f2937;
  white-space: normal;
  overflow-wrap: break-word;
}

.weapons-table td,
.talents-table td {
  vertical-align: top;
}

/* Tighten the remove button so it never forces overflow */
.weapons-table .weapons-remove-row,
.armor-table .armor-remove-row,
.weapons-table .equipment-remove-row,
.armor-table .equipment-remove-row {
  padding: 0.1rem 0.3rem;
  margin: 0;
  min-width: 1.6rem;
}

.weapons-table td:last-child,
.armor-table td:last-child,
.talents-table td:last-child {
  white-space: nowrap;
  text-align: center;
}

/* Make armor/equipment tables match weapons table header/cell styles */
.armor-table th,
.armor-table td,
.talents-table th,
.talents-table td {
  padding: 0.25rem 0.5rem;
}

.armor-table th,
.talents-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  text-align: left;
  border-bottom: 1px solid #1f2937;
  white-space: normal;
  overflow-wrap: break-word;
}

.armor-table td,
.talents-table td {
  vertical-align: top;
}

.talent-info-header {
  text-align: center;
}

.talent-info-cell {
  text-align: center;
}

.talent-info-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  border: 1px solid #1f2937;
  background: #0b1120;
  color: #94a3b8;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.talent-info-toggle:hover,
.talent-info-toggle:focus {
  border-color: #374151;
  color: #f9fafb;
  background: #111827;
}

.talent-info-toggle[aria-expanded="true"] {
  border-color: #3b82f6;
  background: #1e293b;
  color: #e0f2fe;
}

.talent-details {
  margin-top: 0.4rem;
  display: grid;
  gap: 0.75rem;
}

.talent-detail-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.talent-detail-effect {
  grid-column: 1 / -1;
}

.talent-detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.talent-detail-heading {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5f5;
  text-decoration: underline;
}

.talent-details-popover {
  min-width: 300px;
}

.talent-details-body {
  padding: 0.65rem 0.75rem 0.75rem;
}

.talent-details-body .talent-details {
  margin-top: 0;
}

.talent-details-popover .talent-detail-section input,
.talent-details-popover .talent-detail-section textarea {
  width: 100%;
}

.radiant-order-panel {
  margin-top: 0.4rem;
  padding: 0.75rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(45, 212, 191, 0.08));
}

.radiant-order-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a5f3fc;
  font-weight: 600;
}

.radiant-order-grid {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.radiant-order-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bae6fd;
}

.radiant-order-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0f2fe;
}

.radiant-order-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.radiant-order-chip {
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  border: 1px solid rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.15);
  font-size: 0.75rem;
  color: #bfdbfe;
}

.radiant-order-philosophy,
.radiant-order-empty {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: #cffafe;
  line-height: 1.4;
}

.radiant-order-empty {
  color: #fcd34d;
}

/* Compact layout (tablet / mobile): cards with expandable details */
.weapons-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.weapon-card {
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  background: #020617;
  padding: 0.6rem 0.7rem;
}

.weapon-card-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
  gap: 0.4rem;
  align-items: center;
}
.talent-card-main {
  grid-template-columns: 1.3rem minmax(0, 1fr) auto;
}
.equipment-card-main {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1.6fr) minmax(0, 0.6fr) minmax(0, 0.5fr) minmax(0, 0.8fr) minmax(0, 0.8fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.armor-card-main {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 1.1fr) minmax(0, 1.1fr) auto;
  gap: 0.4rem;
  align-items: center;
}


.weapon-toggle {
  border: none;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.25rem;
  width: 1.3rem;
  text-align: center;
}

.weapon-toggle:focus {
  outline: 1px solid #facc15;
  border-radius: 999px;
}

.weapon-card-main-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.weapon-equipp-cell {
  display: flex;
  justify-content: center;
}

.weapon-card-main .weapons-remove-row,
.weapon-card-main .armor-remove-row,
.weapon-card-main .equipment-remove-row {
  grid-column: 1 / -1;
  justify-self: end;
}

/* Details section under each weapon in compact mode */
.weapon-card-details {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.4rem;
}
.talent-effect-field {
  grid-column: 1 / -1;
}

.talent-activation-field {
  grid-column: 1 / -1;
}

.weapon-detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.weapon-detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

/* Trait chips + tooltips */
.trait-chips {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.trait-chip {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid #4b5563;
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.2;
  cursor: help;
}

.trait-chips-field {
  min-height: 1.9rem;
  display: flex;
  align-items: center;
  position: relative;
  justify-content: space-between;
  border: 1px solid #4b5563;
  background: #020617;
  border-radius: 0.55rem;
  padding: 0.3rem 0.5rem;
}

.trait-chips-click {
  flex: 1 1 auto;
  min-width: 0;
}

.trait-chips-field:hover {
  border-color: rgba(250, 204, 21, 0.7);
}

.trait-chips-field:focus-within {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.trait-chips-placeholder {
  color: #9ca3af;
  font-size: 0.8rem;
}

.trait-chip-editor {
  width: 100%;
}

.trait-info-btn {
  flex: 0 0 auto;
  margin-left: 0.4rem;
  border: 1px solid #4b5563;
  background: #111827;
  color: #e5e7eb;
  border-radius: 999px;
  width: 1.3rem;
  height: 1.3rem;
  font-size: 0.85rem;
  line-height: 1.1rem;
  text-align: center;
  cursor: pointer;
}

.trait-info-btn:hover {
  border-color: #facc15;
}

.trait-info-popover {
  /* now positioned via inline fixed styles from portal */
  z-index: 2000;
  max-height: 50vh;
  overflow: auto;
  background: #0b1120;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 0.6rem;
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
}

.trait-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #1f2937;
  font-size: 0.85rem;
  color: #9ca3af;
}

.trait-info-close {
  border: 1px solid #4b5563;
  background: #111827;
  color: #e5e7eb;
  border-radius: 6px;
  width: 1.3rem;
  height: 1.3rem;
  cursor: pointer;
}

.trait-info-list {
  padding: 0.4rem 0.6rem 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.trait-info-item {}

.trait-info-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.trait-info-desc {
  font-size: 0.8rem;
  color: #cbd5e1;
}



.no-print {}

.print-only {
  display: none;
}

.sheet-page {
  width: 210mm;
  height: 297mm;
  margin: 0 auto 6mm;
  padding: 7mm 9mm;
  box-sizing: border-box;
  background: #ffffff;
  color: #0f172a;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 10pt;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.sheet-grid {
  display: grid;
  gap: 2mm;
  height: 100%;
}

.sheet-grid-summary-one {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 1fr 1fr 1fr;
  grid-template-areas:
    "banner banner"
    "identity identity"
    "attributes defenses"
    "resources resources"
    "conditions expertises";
  align-content: start;
}

.sheet-grid-mechanics-fixed {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "columns"
    "spheres";
  align-content: start;
}

.sheet-grid-summary-three {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr;
  align-content: start;
}

.sheet-grid-story-fixed {
  grid-template-columns: 1fr;
  grid-template-rows: 32mm 1fr;
  grid-template-areas:
    "talents"
    "story";
  align-content: start;
}

.sheet-columns-fixed {
  grid-area: columns;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2mm;
  height: 100%;
}

.sheet-column {
  display: flex;
  flex-direction: column;
  gap: 2mm;
  padding: 12px;
  box-sizing: border-box;
  min-height: 0;
}

.sheet-column-left {
  border-right: 1px solid transparent;
}

.sheet-column-right {
  display: flex;
  flex-direction: column;
  gap: 2mm;
  min-height: 0;
}

.sheet-story-columns-fixed {
  grid-area: story;
  display: flex;
  flex-direction: column;
  gap: 1.5mm;
  height: 100%;
  min-height: 0;
}

.sheet-grid-gear {
  grid-template-columns: 1fr;
  grid-template-rows: 12% 30% 22% 36%;
  grid-template-areas:
    "banner"
    "weapons"
    "armor"
    "equipment";
}

.sheet-grid-goals {
  grid-template-columns: 1fr;
  grid-template-rows: 12% 88%;
  grid-template-areas:
    "banner"
    "goals";
}

.sheet-grid-talent {
  grid-template-columns: 1fr;
  grid-template-rows: 12% 88%;
  grid-template-areas:
    "banner"
    "talents";
}

.sheet-grid-story {
  grid-template-columns: 1fr;
  grid-template-rows: 12% 32% 28% 28%;
  grid-template-areas:
    "banner"
    "appearance"
    "backstory"
    "connections";
}

.sheet-grid-notes {
  grid-template-columns: 1fr;
  grid-template-rows: 12% 46% 42%;
  grid-template-areas:
    "banner"
    "notes"
    "gallery";
}

.sheet-area-banner { grid-area: banner; }
.sheet-area-identity { grid-area: identity; }
.sheet-area-attributes { grid-area: attributes; }
.sheet-area-defenses { grid-area: defenses; }
.sheet-area-resources { grid-area: resources; }
.sheet-area-conditions { grid-area: conditions; }
.sheet-area-expertises { grid-area: expertises; }
.sheet-area-custom { grid-area: custom; }
.sheet-area-skills { grid-area: skills; }
.sheet-area-talents { grid-area: talents; }
.sheet-area-weapons { grid-area: weapons; }
.sheet-area-armor { grid-area: armor; }
.sheet-area-equipment { grid-area: equipment; }
.sheet-area-spheres { grid-area: spheres; }
.sheet-area-appearance { grid-area: appearance; }
.sheet-area-backstory { grid-area: backstory; }
.sheet-area-goals { grid-area: goals; }
.sheet-area-connections { grid-area: connections; }
.sheet-area-notes { grid-area: notes; }
.sheet-area-gallery { grid-area: gallery; }
.sheet-area-gear { grid-area: gear; }

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #0f172a;
  padding-bottom: 3mm;
  gap: 6mm;
}

.sheet-header-bar {
  border-bottom: 1px solid #0f172a;
  padding: 1.4mm 0;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sheet-header-bar-text {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sheet-banner-left {
  display: flex;
  flex-direction: column;
  gap: 1.5mm;
}

.sheet-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72em;
  color: #4b5563;
}

.sheet-title {
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1.05;
}

.sheet-subtitle {
  font-size: 0.95em;
  color: #111827;
}

.sheet-header-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3mm;
  align-items: start;
}

.sheet-meta-block {
  border: 1px solid #0f172a;
  background: #f5f5f5;
  padding: 1.2mm 1.6mm;
  display: flex;
  flex-direction: column;
  gap: 1mm;
  font-size: 0.82em;
}

.sheet-meta-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7em;
  color: #4b5563;
}

.sheet-box {
  border: 1px solid #0f172a;
  padding: 2mm;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1.6mm;
  box-sizing: border-box;
  min-height: 0;
  page-break-inside: avoid;
}

.sheet-box-tight {
  padding: 1.6mm;
  gap: 1.2mm;
}

.sheet-box-fill {
  flex: 1;
  min-height: 0;
}

.sheet-box-panel {
  background: #f3f4f6;
}

.sheet-box-title {
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin: 0;
}

.sheet-box-subtitle {
  font-size: 0.82em;
  font-weight: 700;
  margin: 1mm 0;
  letter-spacing: 0.04em;
}

.sheet-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34mm, 1fr));
  gap: 1.5mm 3mm;
}

.sheet-field {
  display: flex;
  flex-direction: column;
  gap: 1mm;
}

.sheet-label {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
}

.sheet-value,
.sheet-attribute-value,
.sheet-resource-value,
.sheet-stat-value,
.sheet-skill-value,
.sheet-custom-value {
  font-weight: 700;
}

.sheet-attribute-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5mm;
}

.sheet-attribute {
  border: 1px solid #0f172a;
  background: #ffffff;
  padding: 2mm;
  display: flex;
  flex-direction: column;
  gap: 1mm;
  text-align: center;
}

.sheet-attribute-value {
  font-size: 1.05em;
}

.sheet-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5mm;
}

.sheet-stat {
  background: #e5e7eb;
  border: 1px solid #0f172a;
  padding: 1.8mm;
  text-align: center;
}

.sheet-stat-value {
  font-size: 1em;
}

.sheet-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5mm;
}

.sheet-resource {
  border: 1px solid #0f172a;
  padding: 1.6mm;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1mm;
}

.sheet-box-content {
  flex: 1;
  min-height: 0;
}

.print-fit {
  width: 100%;
  height: 100%;
  overflow: hidden;
  white-space: pre-wrap;
  line-height: 1.25;
}

.sheet-text {
  color: #0f172a;
  font-size: 0.9em;
}

.sheet-text-block {
  margin-bottom: 2mm;
}

.sheet-custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(55mm, 1fr));
  gap: 1.5mm;
}

.sheet-custom-row {
  border: 1px solid #0f172a;
  padding: 2mm;
  display: flex;
  flex-direction: column;
  gap: 1.5mm;
}

.sheet-custom-compact .sheet-custom-head {
  margin-bottom: 0.5mm;
}

.sheet-custom-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2mm;
}

.sheet-custom-meta {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  align-items: center;
}

.sheet-pips {
  font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.12em;
}

.sheet-skills-body {
  height: 100%;
}

.sheet-skill-table-wrapper {
  height: 100%;
}

.sheet-skill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.sheet-skill-table-compact th,
.sheet-skill-table-compact td {
  padding: 0.55mm 0.75mm;
}

.sheet-skill-table thead th {
  text-align: left;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72em;
  padding: 0.85mm 1mm;
}

.sheet-skill-table th,
.sheet-skill-table td {
  border: 1px solid #0f172a;
  padding: 0.9mm 1mm;
  text-align: left;
}

.sheet-skill-group-row td {
  background: #f3f4f6;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1mm;
}

.sheet-skill-group-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sheet-skill-fit {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sheet-skill-table-fixed {
  flex: 1;
  min-height: 0;
}

.sheet-skill-attr-value {
  color: #4b5563;
  font-size: 0.85em;
}

.sheet-skill-line td {
  border-top: 1px solid #0f172a;
}

.sheet-skill-attr {
  width: 14mm;
  text-align: center;
  font-weight: 700;
}

.sheet-skill-name {
  font-weight: 600;
}

.sheet-skill-pips-cell {
  width: 26mm;
  text-align: center;
  font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.1em;
}

.sheet-skill-total {
  width: 12mm;
  text-align: right;
  font-weight: 700;
}

.sheet-list {
  display: grid;
  gap: 2mm;
}

.sheet-list-row {
  border: 1px solid #0f172a;
  padding: 2mm;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1mm;
}

.sheet-list-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5mm;
  font-weight: 700;
}

.sheet-list-title {
  font-weight: 700;
}

.sheet-list-body {
  font-size: 0.9em;
}

.sheet-goal-list {
  display: grid;
  gap: 0.6mm;
}

.sheet-goals-compact {
  line-height: 1.25;
}

.sheet-goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6mm;
  padding: 0.7mm 1mm;
  border: 1px solid #0f172a;
}

.sheet-goal-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.sheet-goal-meta {
  display: flex;
  align-items: center;
  gap: 2mm;
  white-space: nowrap;
}

.sheet-muted {
  color: #6b7280;
  font-size: 0.9em;
}

.sheet-carry-row {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  font-weight: 700;
  margin-top: 2mm;
}

.sheet-carry-row-tight {
  margin-top: 1mm;
  font-size: 0.9em;
}

.sheet-gear-note {
  margin-top: 1mm;
  font-size: 0.85em;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  page-break-inside: avoid;
}

.sheet-table-compact {
  font-size: 0.82em;
}

.sheet-table-compact th,
.sheet-table-compact td {
  padding: 0.5mm 0.75mm;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid #0f172a;
  padding: 1.2mm;
  text-align: center;
}

.sheet-gear-table th:first-child,
.sheet-gear-table td:first-child {
  text-align: left;
}

.sheet-gear-notes {
  text-align: left;
}

.sheet-gear-table-wrapper {
  height: 100%;
}

.sheet-table-total {
  text-align: right;
  font-weight: 700;
}

.sheet-gear-stack {
  display: flex;
  flex-direction: column;
  gap: 1.6mm;
  height: 100%;
}

.sheet-gear-fit {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sheet-area-spheres.sheet-box {
  gap: 1mm;
}

.sheet-area-spheres-fixed {
  grid-area: spheres;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.sheet-spheres-fit {
  display: flex;
  flex-direction: column;
  height: auto;
}

.sheet-spheres-table {
  font-size: 0.7em;
}

.sheet-spheres-table th,
.sheet-spheres-table td {
  padding: 0.55mm;
}

.sheet-narrative-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2mm;
  height: 100%;
  align-content: start;
}

.sheet-narrative-col {
  display: flex;
  flex-direction: column;
  gap: 2mm;
  min-height: 0;
}

.sheet-talents-fixed {
  grid-area: talents;
  min-height: 32mm;
  max-height: 32mm;
  display: flex;
  flex-direction: column;
}

.sheet-talents-fit {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sheet-story-box {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sheet-appearance {
  display: grid;
  grid-template-columns: 26mm 1fr;
  gap: 2mm;
  height: 100%;
}

.sheet-portrait {
  width: 100%;
  height: 100%;
  border: 1px solid #0f172a;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-portrait-placeholder {
  font-size: 0.8em;
  color: #6b7280;
  text-align: center;
}

.sheet-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40mm, 1fr));
  gap: 2mm;
  align-content: start;
}

.sheet-gallery img {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid #0f172a;
}

.sheet-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2mm;
}

.sheet-row-story,
.sheet-row-notes {
  width: 100%;
}

.sheet-connections-body {
  display: flex;
  flex-direction: column;
  gap: 1.4mm;
  height: 100%;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .sheet-page {
    box-shadow: none;
    margin: 0;
    height: 297mm;
    page-break-after: always;
  }

  .sheet-page:last-child {
    page-break-after: auto;
  }
}

.ink-mode .weapons-input,
.ink-mode .spheres-number-input,
.ink-mode .trait-chip-editor {
  padding: 0.45rem 0.65rem;
  font-size: 0.95rem;
}

.ink-mode .weapons-textarea {
  min-height: 2.6rem;
}

.ink-mode .trait-chips-field {
  min-height: 2.6rem;
}

.ink-mode .trait-info-btn {
  width: 1.6rem;
  height: 1.6rem;
}
