body.sheet {
  margin: 0;
  /* Let Mythlight/Assets/css/styles.css own the global look */
}

/*
  The global site stylesheet doesn't define a box-sizing model.
  Without border-box, inputs with width:100% + padding can overflow grid cells
  and visually collide (e.g., Max Mana / Mana Bonus).
*/
body.sheet *,
body.sheet *::before,
body.sheet *::after {
  box-sizing: border-box;
}

body.sheet h1,
body.sheet h2 {
  font-family: 'Cinzel', serif;
  background: linear-gradient(135deg, #ffffff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

body.sheet header {
  padding: 2rem;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.9) 100%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
}

.header-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.no-print {
  display: block;
}

body.sheet main {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 1rem;
}

/* --- Character-sheet page grid --- */
.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

/* Lane wrappers */
.sheet-left {
  grid-column: 1;
}

.sheet-right {
  grid-column: 2;
}

@media (max-width: 1200px) {
  .sheet-grid {
    grid-template-columns: 1fr;
  }
  .sheet-full,
  .sheet-left,
  .sheet-right {
    grid-column: 1;
  }
}

.sheet-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sheet-col > .card {
  margin-bottom: 0;
}

.sheet-col > .card .card {
  margin-bottom: 1rem;
}

.sheet-grid > .card .card {
  margin-bottom: 1rem;
}

/* Traits + Spells row */
.traits-spells-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1200px) {
  .traits-spells-row {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.4) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 1.25rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -1000px;
  width: 1000px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 16px 48px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.proficiency-warning {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-left: 4px solid #ef4444;
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.proficiency-warning-header {
  color: #fca5a5;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.proficiency-warning-text {
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.5;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-number {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: bold;
  color: white;
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.1rem;
  transition: all 300ms ease;
  position: relative;
}

.section-number::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

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

/* Allow grid children to shrink without overflowing into adjacent columns */
.grid > * {
  min-width: 0;
}

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

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

/* legacy class name used in markup */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 1rem;
}
.grid_4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}


input,
textarea,
button {
  font-family: inherit;
  box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

input,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(15, 23, 42, 0.6);
  color: white;
  transition: all 200ms ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(203, 213, 225, 0.55);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.8);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 0 10px rgba(99, 102, 241, 0.1);
  transform: scale(1.01);
}

select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 41, 59, 0.8);
  color: white;
}

button {
  padding: 0.5rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

button:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Small UI helpers */
.muted-label {
  font-size: 0.7rem;
  opacity: 0.8;
}

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

.inline-row.top-gap {
  margin-top: 0.5rem;
}

.input-sm {
  width: 80px;
}

/* Health Bar */
.health-bar {
  height: 22px;
  background: linear-gradient(90deg, rgba(20, 20, 20, 0.6), rgba(30, 30, 30, 0.4));
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0.5rem;
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  position: relative;
}

.health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 50%, #047857 100%);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
}

.health-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 3s infinite;
}

/* Mana Bar */
.mana-bar {
  height: 22px;
  background: linear-gradient(90deg, rgba(20, 20, 30, 0.6), rgba(30, 30, 40, 0.4));
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0.5rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  position: relative;
}

.mana-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
}

.mana-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Attributes */
.attribute-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

.attribute-card {
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  transition: all 300ms ease;
}

.attribute-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.15);
}

.attribute-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.attribute-header h3 {
  margin: 0;
}

.attribute-base-wrap {
  display: grid;
  grid-template-columns: auto 92px;
  align-items: center;
  gap: 0.5rem;
}

.attribute-base {
  width: 92px;
}

.body {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(190, 24, 93, 0.1) 100%);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.skill {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(5, 150, 105, 0.1) 100%);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.mind {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(126, 34, 206, 0.1) 100%);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.style {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(190, 24, 93, 0.1) 100%);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.skill-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px 80px 60px;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.skill-row span {
  cursor: pointer;
  color: rgba(255, 255, 255, 0.92);
}

@media (max-width: 560px) {
  .skill-row {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
  }
  .skill-row button {
    grid-column: 2;
    justify-self: end;
  }
}

.skill-desc {
  display: none;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.roll-result {
  font-size: 0.8rem;
  margin-top: 0.3rem;
  color: #a5b4fc;
}

/* Final blow resistances */
.final-blow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.final-blow label {
  width: 100%;
}

.final-blow input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Custom checkboxes (more exciting) */
body.sheet input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.6));
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 8px rgba(99, 102, 241, 0);
}

body.sheet input[type="checkbox"]::before {
  content: "✓";
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  transform: scale(0);
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.sheet input[type="checkbox"]:hover {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 12px rgba(99, 102, 241, 0.3);
  transform: scale(1.05);
}

body.sheet input[type="checkbox"]:checked {
  border-color: rgba(99, 102, 241, 0.9);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 16px rgba(99, 102, 241, 0.5);
}

body.sheet input[type="checkbox"]:checked::before {
  transform: scale(1);
}

/* Grace dice selector */
.grace-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.grace-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.2));
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.grace-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 0.875rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: none;
  filter: none;
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grace-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px) scale(1.05);
}

.grace-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4), 0 0 0 2px rgba(99, 102, 241, 0.2);
  transform: scale(1.08);
}

.grace-btn .die-inline {
  width: 40px;
  height: 40px;
}

.grace-btn:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.8);
  outline-offset: 2px;
}

/* Armor mockup layout */
.armor-slots {
  display: grid;
  gap: 1rem;
}

.armor-slot {
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.3) 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 300ms ease;
}

.armor-slot:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.armor-head {
  display: grid;
  grid-template-columns: 34px 1fr 110px;
  gap: 0.75rem;
  align-items: end;
}

.armor-icon {
  width: 40px;
  height: 40px;
  padding: 2px;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.4);
}

#inventory_grid {
  margin-bottom: 25px;
}

.armor-notes {
  margin-top: 0.65rem;
}

.armor-notes textarea {
  resize: vertical;
}

@media (max-width: 900px) {
  .armor-head {
    grid-template-columns: 34px 1fr;
  }
  .armor-value {
    grid-column: 1 / -1;
  }
}

/* Print / PDF export */
@media print {
  /* Layout: single column, keep DOM order (now numeric) */
  body.sheet main {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.sheet header {
    padding: 0.75rem 0.75rem 0.5rem !important;
  }

  .sheet-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: none !important;
    gap: 0.6rem !important;
  }

  .traits-spells-row {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  body.sheet {
    background: white !important;
    color: black !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

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

  body.sheet header {
    background: white !important;
    border-bottom: 1px solid #000 !important;
  }

  .card,
  .weapon-block,
  .armor-slot {
    background: white !important;
    border: 1px solid #000 !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
  }

  /* Prevent cards from being split across pages */
  .card,
  .weapon-block,
  .armor-slot,
  .attribute-card,
  .inventory_slot,
  .legend-item {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* Slightly tighter padding for print to reduce clipping */
  .card {
    padding: 0.85rem !important;
    margin-bottom: 0.6rem !important;
    border-radius: 0 !important;
    
  }

  .section-title {
    margin-bottom: 0.5rem !important;
  }

  .section-number {
    background: transparent !important;
    color: black !important;
    border: 1px solid #000 !important;
  }

  /* Don't print the Grace dice UI; print the numeric value */
  .grace-picker {
    display: none !important;
  }
  .grace-hidden {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    clip: auto !important;
    white-space: normal !important;
  }

  body.sheet h1,
  body.sheet h2 {
    color: black !important;
  }

  input,
  textarea,
  select {
    background: white !important;
    color: black !important;
    border: 1px solid #000 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    
  }

  input[type="checkbox"] {
    -webkit-appearance: auto !important;
    appearance: auto !important;
  }

  /* Force normally-collapsed areas visible in the PDF */
  #inventory_grid {
    display: grid !important;
  }

  #inventory_extra {
    display: block !important;
  }
}

/* Weapons */
.weapons-list {
  display: grid;
  gap: 1rem;
}

.weapon-block {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.3) 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 300ms ease;
}

.weapon-block:hover {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.weapon-grid {
  display: grid;
  grid-template-columns: 1.6fr 0.7fr 0.7fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.weapon-actions button {
  width: 100%;
  padding: 0.55rem 0.9rem;
}

.weapon-block .roll-result {
  margin-top: 0.45rem;
}

@media (max-width: 900px) {
  .weapon-grid {
    grid-template-columns: 1fr 1fr;
  }
  .weapon-actions {
    grid-column: 1 / -1;
  }
}

/* Proficiencies */
.proficiencies-grid {
  grid-template-columns: 1.25fr 0.75fr;
}

#proficiencies_section .proficiencies-grid > div > div {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 0.6rem;
  align-items: center;
  margin: 0.35rem 0;
}

#proficiencies_section input[type="checkbox"] {
  width: 18px;
  height: 18px;
  justify-self: end;
}

#proficiencies_section .proficiencies-grid label {
  font-size: 0.78rem;
  opacity: 0.9;
}

/* Remove buttons */
.remove-btn {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.2));
  border: 1px solid rgba(239, 68, 68, 0.5);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
  transition: all 200ms ease;
}

.remove-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(220, 38, 38, 0.3));
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.7);
  transform: translateY(-2px);
}

.cast-btn {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  transition: all 200ms ease;
}

.cast-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(37, 99, 235, 0.3));
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.7);
  transform: translateY(-2px);
}

/* Trait controls */
.trait-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.trait-controls input[type="text"] {
  flex: 1 1 220px;
  min-width: 220px;
}

.trait-controls select {
  flex: 1 1 260px;
  min-width: 260px;
}

/* Floating roll widget */
.roll-widget {
  position: fixed;
  right: 1rem;
  top: 11rem;
  width: min(320px, calc(100vw - 2rem));
  z-index: 999;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 1.25rem;
  padding: 1.25rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.2);
  animation: float 6s ease-in-out infinite;
  transition: all 300ms ease;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.roll-widget:hover {
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.7), 0 0 50px rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.6);
}

.roll-widget h3 {
  margin: 0 0 0.5rem 0;
  font-family: 'Cinzel', serif;
  color: white;
  font-size: 1.1rem;
}

.roll-widget .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  
}

#roll_button {
  background: none;
  display: inline-flex;
  transform: none;
}

.dice-visual-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.4) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 1rem;
  margin: 0.75rem 0;
  min-height: 60px;
  flex-wrap: wrap;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 400ms ease;
}

.die-inline {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  position: relative;
  flex: 0 0 auto;
  animation: none;
  transition: all 200ms ease;
}

.die-inline:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.die-inline.rolling {
  animation: wiggle 0.6s ease-in-out;
}

@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg) translateX(0);
  }
  25% {
    transform: rotate(-2deg) translateX(-2px);
  }
  50% {
    transform: rotate(2deg) translateX(2px);
  }
  75% {
    transform: rotate(-1deg) translateX(-1px);
  }
}

.face-1 {
  background: radial-gradient(circle at 50% 50%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

.face-2 {
  background: radial-gradient(circle at 25% 25%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 75%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

.face-3 {
  background: radial-gradient(circle at 25% 25%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 50% 50%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 75%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

.face-4 {
  background: radial-gradient(circle at 25% 25%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 25%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 25% 75%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 75%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

.face-5 {
  background: radial-gradient(circle at 25% 25%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 25%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 50% 50%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 25% 75%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 75%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

.face-6 {
  background: radial-gradient(circle at 25% 20%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 25% 50%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 25% 80%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 20%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 50%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    radial-gradient(circle at 75% 80%, #0f172a 0rem, #0f172a 0.35rem, transparent 0.36rem),
    linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: inset 0px 10px 15px -4px rgba(0,0,0,0.1);
}

/* Mini legend styling */
.legend-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}

.legend-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.3));
  transition: all 200ms ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.legend-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.4));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.legend-symbol-mini {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
  font-size: 1.25rem;
  color: #e0e7ff;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#custom_button {
  background: none;
  border: none;
  font-size: 1rem;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: none;
  cursor: pointer;
}

#tab-selector {
  display: flex;
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.8));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(99, 102, 241, 0.2);
  backdrop-filter: blur(8px);
}

.tab-button {
  width: 10em;
  background: none;
  border: none;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.75rem 1.25rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 300ms ease;
  position: relative;
  font-weight: 500;
}

.tab-button::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 1.25rem;
  right: 1.25rem;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform 300ms ease;
}

.tab-button.active {
  color: white;
  background: rgba(99, 102, 241, 0.15);
}

.tab-button.active::after {
  transform: scaleX(1);
}

.tab-button:hover {
  background: rgba(99, 102, 241, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.roll-history-entry {
  margin-bottom: 8px;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  font-size: 0.85rem;
  transition: all 200ms ease;
  animation: slideIn 300ms ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#skill-roll-history{
  background: linear-gradient(135deg, rgba(170, 177, 77, 0.25), rgba(132, 135, 50, 0.15));
  border-color: rgba(170, 177, 77, 0.4);
}

#skill-roll-history:hover {
  background: linear-gradient(135deg, rgba(170, 177, 77, 0.35), rgba(132, 135, 50, 0.25));
}

#attack-roll-history{
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(190, 24, 93, 0.15));
  border-color: rgba(239, 68, 68, 0.4);
}

#attack-roll-history:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(190, 24, 93, 0.25));
}

#manual-roll-history{
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.25), rgba(75, 85, 99, 0.15));
  border-color: rgba(107, 114, 128, 0.4);
}

#manual-roll-history:hover {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.35), rgba(75, 85, 99, 0.25));
}

#spell-roll-history{
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.15));
  border-color: rgba(59, 130, 246, 0.4);
}

#spell-roll-history:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(37, 99, 235, 0.25));
}

.identity-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 120px;
  gap: 1.25rem;
  align-items: end;
}

.identity-name input {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.section-1 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-2 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-3 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-4 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-5 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-6 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-7 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-8 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-9 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.section-10 {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.header-links {
  background: linear-gradient(270deg, rgba(99, 102, 241, 0.2), rgba(255, 255, 255, 0));
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#header_link {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 0.75rem;
  transition: all 300ms ease;
  font-weight: 500;
  position: relative;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

#header_link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
  border-radius: 0.75rem;
  opacity: 0;
  transition: opacity 300ms ease;
  z-index: -1;
}

#header_link:hover {
  color: white;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}
