/* ===== Role & Roll v5 ===== */

:root {
  color-scheme: only light;
  --page: #eef0e8;
  --paper: #fffdf7;
  --paper-strong: #ffffff;
  --ink: #171717;
  --muted: #696f69;
  --line: #d6d1c5;
  --line-strong: #a9a291;
  --field: #f8f6ef;
  --field-focus: #fffaf0;
  --brand: #23545a;
  --brand-dark: #173a3f;
  --brand-soft: #dcebea;
  --gold: #b4873e;
  --gold-soft: #f2e3c5;
  --green: #537b46;
  --green-soft: #e8f2e1;
  --red: #a64d43;
  --red-soft: #f7e1db;
  --blue: #375f8e;
  --shadow: 0 18px 42px rgba(25, 28, 22, 0.12);
  --shadow-soft: 0 8px 22px rgba(25, 28, 22, 0.08);
  --radius: 8px;
  --radius-sm: 6px;
  --tap: 42px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(35, 84, 90, 0.10), transparent 38%),
    linear-gradient(315deg, rgba(180, 135, 62, 0.12), transparent 34%),
    var(--page);
}

body {
  margin: 0;
  padding: 22px clamp(14px, 2.4vw, 30px) 18px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.42;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.56;
  background-image:
    linear-gradient(rgba(23, 23, 23, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 23, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: var(--tap);
  margin-top: 0;
  padding: 0.52rem 0.82rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-strong);
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  line-height: 1;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
}

button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(35, 84, 90, 0.32);
  outline-offset: 2px;
}

input[type="number"],
input[type="text"],
textarea {
  min-width: 0;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(23, 23, 23, 0.04);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--brand);
  background: var(--field-focus);
}

label {
  font-weight: 720;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

code {
  padding: 0.05rem 0.28rem;
  border: 1px solid rgba(35, 84, 90, 0.18);
  border-radius: 5px;
  background: rgba(35, 84, 90, 0.07);
  color: var(--brand-dark);
}

.hidden {
  display: none !important;
}

/* ===== App frame ===== */

.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "left title right"
    "tabs tabs tabs";
  gap: 0.75rem 1rem;
  align-items: center;
  max-width: 1500px;
  margin: 0 auto 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(35, 84, 90, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.page-header h1 {
  grid-area: title;
  margin: 0;
  text-align: center;
  color: var(--brand-dark);
  font-size: clamp(1.1rem, 2.4vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0;
}

.page-header-left-actions,
.page-header-right-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.page-header-left-actions {
  grid-area: left;
}

.page-header-right-actions {
  grid-area: right;
  justify-self: end;
}

.manual-guide-link,
.tip-me-btn,
.header-icon-btn,
.version-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.manual-guide-link {
  border: 1px solid rgba(35, 84, 90, 0.30);
  background: var(--brand-soft);
  color: var(--brand-dark);
  text-decoration: none;
}

.manual-guide-link:hover,
.header-icon-btn:hover {
  background: #cfe1df;
}

.tip-me-btn {
  border-color: rgba(180, 135, 62, 0.45);
  background: var(--gold-soft);
  color: #5b451e;
}

.tip-me-btn:hover {
  border-color: var(--gold);
  background: #f4ddab;
}

.header-icon-btn {
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
  border-color: rgba(35, 84, 90, 0.30);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.9rem;
}

.version-badge {
  border: 1px solid rgba(180, 135, 62, 0.45);
  background: var(--gold-soft);
  color: #5b451e;
}

.page-header-tools {
  grid-area: tabs;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.sheet-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sheet-tab {
  flex: 0 0 auto;
  min-width: 138px;
  max-width: 230px;
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  border-color: rgba(35, 84, 90, 0.22);
  border-radius: 999px;
  background: rgba(248, 246, 239, 0.92);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-tab.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 7px 14px rgba(35, 84, 90, 0.20);
}

.sheet-tab-add,
.help-icon,
.history-toggle,
.result-modal-close,
.icon-action-btn,
.item-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--tap);
  min-width: var(--tap);
  height: var(--tap);
  padding: 0;
}

.sheet-tab-add {
  border-color: rgba(180, 135, 62, 0.60);
  border-radius: 50%;
  background: var(--gold);
  color: #fffaf0;
  font-size: 1.15rem;
}

.layout {
  display: block;
  max-width: 1260px;
  margin: 0 auto;
}

.left-column {
  display: contents;
}

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

.lower-sheet-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 1rem;
  align-items: stretch;
}

.dice-panel,
.items-panel,
.extra-skill-panel,
.notes-panel,
.sheet-card {
  border: 1px solid rgba(35, 84, 90, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow-soft);
}

.dice-panel,
.items-panel,
.extra-skill-panel,
.notes-panel {
  padding: 1rem;
}

.inventory-stack,
.lower-sheet-layout .items-panel,
.lower-sheet-layout .notes-panel,
.progression-card {
  min-width: 0;
}

.inventory-stack {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 0.68fr);
  gap: 1rem;
  height: 465px;
  min-height: 0;
}

.inventory-stack .items-panel {
  display: grid;
  min-height: 0;
}

.inventory-stack .items-panel .items-block {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.inventory-stack .items-panel .item-list {
  min-height: 0;
  overflow-y: auto;
}

.inventory-stack .notes-panel {
  display: grid;
  min-height: 0;
}

.notes-block {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
}

.manual-roll-toggle {
  position: fixed;
  left: 12px;
  top: 46vh;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-color: rgba(35, 84, 90, 0.36);
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 1.6rem;
  line-height: 1;
  transform: translateY(-50%);
}

.manual-roll-toggle:hover,
.manual-roll-toggle[aria-expanded="true"] {
  background: var(--brand-dark);
  color: #ffffff;
}

.manual-roll-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  min-width: var(--tap);
  height: var(--tap);
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
}

.dice-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(20, 24, 18, 0.26);
  backdrop-filter: blur(1px);
}

.dice-panel {
  position: fixed;
  top: 112px;
  left: 76px;
  z-index: 80;
  width: min(370px, calc(100vw - 88px));
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  transform: translateX(calc(-100% - 92px));
  transition: transform 180ms ease, box-shadow 180ms ease;
  will-change: transform;
}

body.dice-drawer-open .dice-panel {
  transform: translateX(0);
  box-shadow: 0 24px 70px rgba(25, 28, 22, 0.30);
}

.dice-panel-header {
  position: sticky;
  top: -1rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -1rem -1rem 0.9rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(35, 84, 90, 0.14);
  background: rgba(255, 253, 247, 0.96);
  backdrop-filter: blur(10px);
}

.dice-panel-header h2 {
  margin: 0;
}

.sheet-panel.sheet-column {
  min-width: 0;
}

.sheet-card {
  padding: 1rem;
}

.character-info-card {
  border-color: rgba(35, 84, 90, 0.28);
  box-shadow: var(--shadow);
}

.site-footer {
  max-width: 1500px;
  margin: 1.2rem auto 0;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(35, 84, 90, 0.16);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.site-footer p {
  margin-bottom: 0;
}

/* ===== Dice panel ===== */

.dice-panel h2,
.character-info-header h2 {
  margin-bottom: 0.75rem;
  color: var(--brand-dark);
}

/* Dice Tabs */
.dice-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid rgba(35, 84, 90, 0.14);
  padding-bottom: 0;
}

.dice-tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  border-radius: 0.375rem 0.375rem 0 0;
}

.dice-tab:hover {
  background: rgba(35, 84, 90, 0.06);
  color: var(--text);
}

.dice-tab:focus {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.dice-tab.active {
  background: rgba(35, 84, 90, 0.08);
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.dice-tab[aria-selected="true"] {
  background: rgba(35, 84, 90, 0.08);
}

/* Tab Content */
.dice-tab-content {
  display: none;
}

.dice-tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Standard Dice Result Styling */
.standard-dice-result,
.coin-flip-result {
  background: rgba(35, 84, 90, 0.04);
  border: 1px solid rgba(35, 84, 90, 0.12);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 0.5rem 0;
}

.standard-dice-result p,
.coin-flip-result p {
  margin: 0.25rem 0;
}

.standard-dice-result p:last-child,
.coin-flip-result p:last-child {
  margin-bottom: 0;
}

.standard-dice-result strong,
.coin-flip-result strong {
  color: var(--brand-dark);
}

/* 3D Dice Container */
.dice-3d-container {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(35, 84, 90, 0.02);
  border-radius: 0.75rem;
  border: 1px solid rgba(35, 84, 90, 0.08);
}

.dice-3d-stage {
  display: block;
  min-height: 120px;
  perspective: 1000px;
  padding: 0;
}

#three-dice-canvas {
  display: block;
  width: 100%;
  height: clamp(220px, 32vh, 360px);
}

.dice-credit {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(35, 84, 90, 0.6);
  margin-top: 1rem;
  padding: 0.5rem;
  border-top: 1px solid rgba(35, 84, 90, 0.1);
}

/* 3D Coin Container */
.coin-3d-container {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(35, 84, 90, 0.02);
  border-radius: 0.75rem;
  border: 1px solid rgba(35, 84, 90, 0.08);
}

.coin-3d-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  min-height: 120px;
  perspective: 1000px;
  padding: 1rem;
}

/* 3D Coin Base Styles */
.coin-3d {
  width: 80px;
  height: 80px;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: transform 0.1s;
}

.coin-3d.flipping {
  animation: flip 600ms ease-out;
}

.coin-3d .face {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  backface-visibility: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.coin-3d .heads {
  background: linear-gradient(145deg, #ffd700, #ffed4e);
  border: 3px solid #d4af37;
  color: #8b7355;
  transform: rotateY(0deg) translateZ(4px);
}

.coin-3d .tails {
  background: linear-gradient(145deg, #c0c0c0, #e8e8e8);
  border: 3px solid #a0a0a0;
  color: #555;
  transform: rotateY(180deg) translateZ(4px);
}

@keyframes flip {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(1800deg);
  }
}

/* Show coin faces */
.coin-3d.show-heads { transform: rotateY(0deg); }
.coin-3d.show-tails { transform: rotateY(180deg); }

/* 3D Dice Base Styles */
.dice-3d {
  width: 60px;
  height: 60px;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: none;
}

.dice-3d.rolling {
  animation: roll 2s ease-out;
}

.dice-3d.in-tray {
  box-shadow:
    0 10px 20px rgba(0,0,0,0.3),
    0 6px 6px rgba(0,0,0,0.2);
}

.dice-3d.d6 {
  transform-style: preserve-3d;
}

.dice-3d.d4,
.dice-3d.d20 {
  transform-style: preserve-3d;
}

/* D6 Cube Faces */
.dice-3d.d6 .face {
  position: absolute;
  width: 60px;
  height: 60px;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 2px solid #333;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.dice-3d.d6 .face.front { transform: rotateY(0deg) translateZ(30px); }
.dice-3d.d6 .face.back { transform: rotateY(180deg) translateZ(30px); }
.dice-3d.d6 .face.right { transform: rotateY(90deg) translateZ(30px); }
.dice-3d.d6 .face.left { transform: rotateY(-90deg) translateZ(30px); }
.dice-3d.d6 .face.top { transform: rotateX(90deg) translateZ(30px); }
.dice-3d.d6 .face.bottom { transform: rotateX(-90deg) translateZ(30px); }

/* D6 Number faces - fixed correlation */
.dice-3d.d6 .face.front::after { content: "1"; }
.dice-3d.d6 .face.back::after { content: "6"; }
.dice-3d.d6 .face.right::after { content: "4"; }
.dice-3d.d6 .face.left::after { content: "3"; }
.dice-3d.d6 .face.top::after { content: "2"; }
.dice-3d.d6 .face.bottom::after { content: "5"; }

.dice-3d.d4,
.dice-3d.d20 {
  width: 72px;
  height: 72px;
}

.dice-3d.d4 .face,
.dice-3d.d20 .face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fffdf7;
  font-size: 26px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(23, 23, 23, 0.42);
  backface-visibility: hidden;
  box-shadow:
    inset 0 2px 7px rgba(255, 255, 255, 0.2),
    inset 0 -8px 14px rgba(23, 23, 23, 0.22);
}

.dice-3d.d4 .face {
  clip-path: polygon(50% 4%, 8% 94%, 92% 94%);
  background: linear-gradient(145deg, #d5a353, #8a6127);
  border: 2px solid rgba(73, 47, 17, 0.72);
}

.dice-3d.d4 .face.result { transform: rotateX(-14deg) translateZ(24px); }
.dice-3d.d4 .face.facet-a { transform: rotateY(120deg) rotateX(24deg) translateZ(20px); filter: brightness(0.9); }
.dice-3d.d4 .face.facet-b { transform: rotateY(-120deg) rotateX(24deg) translateZ(20px); filter: brightness(0.78); }
.dice-3d.d4 .face.facet-c { transform: rotateX(106deg) translateZ(17px); filter: brightness(0.68); }
.dice-3d.d4 .face.facet-d,
.dice-3d.d4 .face.facet-e,
.dice-3d.d4 .face.facet-f { display: none; }

.dice-3d.d20 .face {
  clip-path: polygon(50% 3%, 4% 84%, 96% 84%);
  background: linear-gradient(145deg, #4c83bd, #1f4d7d);
  border: 2px solid rgba(19, 53, 86, 0.78);
}

.dice-3d.d20 .face.result { transform: rotateX(-8deg) translateZ(30px); }
.dice-3d.d20 .face.facet-a { transform: rotateY(72deg) rotateX(18deg) translateZ(24px); filter: brightness(0.92); }
.dice-3d.d20 .face.facet-b { transform: rotateY(-72deg) rotateX(18deg) translateZ(24px); filter: brightness(0.78); }
.dice-3d.d20 .face.facet-c { transform: rotateY(144deg) rotateX(-10deg) translateZ(18px); filter: brightness(0.7); }
.dice-3d.d20 .face.facet-d { transform: rotateY(-144deg) rotateX(-10deg) translateZ(18px); filter: brightness(0.62); }
.dice-3d.d20 .face.facet-e { transform: rotateX(72deg) translateZ(18px); filter: brightness(1.08); }
.dice-3d.d20 .face.facet-f { transform: rotateX(-72deg) translateZ(18px); filter: brightness(0.68); }

.dice-3d.d4.show-1,
.dice-3d.d20.show-1 { transform: rotateX(0deg) rotateY(0deg); }
.dice-3d.d20.show-2 { transform: rotateX(0deg) rotateY(60deg); }
.dice-3d.d20.show-3 { transform: rotateX(0deg) rotateY(120deg); }
.dice-3d.d20.show-4 { transform: rotateX(0deg) rotateY(180deg); }
.dice-3d.d20.show-5 { transform: rotateX(0deg) rotateY(240deg); }
.dice-3d.d20.show-6 { transform: rotateX(0deg) rotateY(300deg); }

/* Dynamic D20 face value display */
.dice-3d.d20 .face[data-value]::after {
  content: attr(data-value);
}

/* Roll Animation */
@keyframes roll {
  0% {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  25% {
    transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg);
  }
  50% {
    transform: rotateX(1080deg) rotateY(720deg) rotateZ(360deg);
  }
  75% {
    transform: rotateX(1440deg) rotateY(1080deg) rotateZ(540deg);
  }
  100% {
    transform: rotateX(var(--final-x)) rotateY(var(--final-y)) rotateZ(var(--final-z));
  }
}

/* Show faces for specific values - fixed correlation */
.dice-3d.d6.show-1 { transform: rotateX(0deg) rotateY(0deg); }
.dice-3d.d6.show-2 { transform: rotateX(-90deg) rotateY(0deg); }
.dice-3d.d6.show-3 { transform: rotateX(0deg) rotateY(90deg); }
.dice-3d.d6.show-4 { transform: rotateX(0deg) rotateY(-90deg); }
.dice-3d.d6.show-5 { transform: rotateX(90deg) rotateY(0deg); }
.dice-3d.d6.show-6 { transform: rotateX(0deg) rotateY(180deg); }

/* D20 Show classes - match triangular face positions */
.dice-3d.d20.show-1  { transform: rotateY(0deg) rotateX(0deg); }
.dice-3d.d20.show-2  { transform: rotateY(-72deg) rotateX(0deg); }
.dice-3d.d20.show-3  { transform: rotateY(-144deg) rotateX(0deg); }
.dice-3d.d20.show-4  { transform: rotateY(-216deg) rotateX(0deg); }
.dice-3d.d20.show-5  { transform: rotateY(-288deg) rotateX(0deg); }
.dice-3d.d20.show-6  { transform: rotateX(-60deg) rotateY(0deg); }
.dice-3d.d20.show-7  { transform: rotateX(-60deg) rotateY(-72deg); }
.dice-3d.d20.show-8  { transform: rotateX(-60deg) rotateY(-144deg); }
.dice-3d.d20.show-9  { transform: rotateX(-60deg) rotateY(-216deg); }
.dice-3d.d20.show-10 { transform: rotateX(-60deg) rotateY(-288deg); }
.dice-3d.d20.show-11 { transform: rotateX(60deg) rotateY(0deg); }
.dice-3d.d20.show-12 { transform: rotateX(60deg) rotateY(-72deg); }
.dice-3d.d20.show-13 { transform: rotateX(60deg) rotateY(-144deg); }
.dice-3d.d20.show-14 { transform: rotateX(60deg) rotateY(-216deg); }
.dice-3d.d20.show-15 { transform: rotateX(60deg) rotateY(-288deg); }
.dice-3d.d20.show-16 { transform: rotateX(-180deg) rotateY(0deg); }
.dice-3d.d20.show-17 { transform: rotateX(-180deg) rotateY(-72deg); }
.dice-3d.d20.show-18 { transform: rotateX(-180deg) rotateY(-144deg); }
.dice-3d.d20.show-19 { transform: rotateX(-180deg) rotateY(-216deg); }
.dice-3d.d20.show-20 { transform: rotateX(-180deg) rotateY(-288deg); }

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .dice-3d {
    width: 50px;
    height: 50px;
  }

  .dice-3d.d4,
  .dice-3d.d20 {
    width: 58px;
    height: 58px;
  }

  .dice-3d.d6 .face {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .dice-3d.d4 .face,
  .dice-3d.d20 .face {
    font-size: 22px;
  }

  .dice-3d.d6 .face.front { transform: rotateY(0deg) translateZ(25px); }
  .dice-3d.d6 .face.back { transform: rotateY(180deg) translateZ(25px); }
  .dice-3d.d6 .face.right { transform: rotateY(90deg) translateZ(25px); }
  .dice-3d.d6 .face.left { transform: rotateY(-90deg) translateZ(25px); }
  .dice-3d.d6 .face.top { transform: rotateX(90deg) translateZ(25px); }
  .dice-3d.d6 .face.bottom { transform: rotateX(-90deg) translateZ(25px); }

  .dice-3d.d20 .face.front { transform: rotateY(0deg) translateZ(25px); }
  .dice-3d.d20 .face.back { transform: rotateY(180deg) translateZ(25px); }
  .dice-3d.d20 .face.right { transform: rotateY(90deg) translateZ(25px); }
  .dice-3d.d20 .face.left { transform: rotateY(-90deg) translateZ(25px); }
  .dice-3d.d20 .face.top { transform: rotateX(90deg) translateZ(25px); }
  .dice-3d.d20 .face.bottom { transform: rotateX(-90deg) translateZ(25px); }
}

#dice-form {
  display: grid;
  gap: 0.75rem;
}

.field {
  display: grid;
  grid-template-columns: minmax(95px, 0.42fr) minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
}

.field label {
  width: auto;
  color: #34403e;
  font-size: 0.86rem;
}

.field input {
  min-width: 0;
}

.special-dice-builder {
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem;
  border: 1px solid rgba(35, 84, 90, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.special-dice-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #34403e;
  font-size: 0.88rem;
  font-weight: 850;
}

.special-preview {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
  text-align: right;
}

.special-dice-list {
  display: grid;
  gap: 0.5rem;
}

.special-dice-empty {
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 1px dashed rgba(35, 84, 90, 0.22);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.84rem;
}

.special-die-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem;
  border: 1px solid rgba(35, 84, 90, 0.14);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.special-die-card-faces,
.special-die-editor {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  flex-wrap: nowrap;
}

.special-die-card-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.25rem;
}

.special-die-card-actions .icon-action-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  font-size: 0.88rem;
}

.special-die-face,
.special-die-editor-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  min-width: 27px;
  height: 27px;
  min-height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
}

.special-die-editor {
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.special-die-editor-face {
  width: 50px;
  min-width: 50px;
  height: 50px;
  min-height: 50px;
  font-size: 1.25rem;
}

.special-die-editor-hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.special-die-editor-face:disabled {
  cursor: default;
  opacity: 1;
}

.special-die-face.is-point,
.special-die-editor-face.is-point {
  border-color: rgba(35, 84, 90, 0.26);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.special-die-face.is-reroll,
.special-die-editor-face.is-reroll {
  border-color: rgba(180, 135, 62, 0.42);
  background: var(--gold-soft);
  color: #5b451e;
}

.special-die-face.is-plus,
.special-die-editor-face.is-plus {
  border-color: rgba(83, 123, 70, 0.34);
  background: var(--green-soft);
  color: var(--green);
}

.special-die-face.is-minus,
.special-die-editor-face.is-minus {
  border-color: rgba(166, 77, 67, 0.34);
  background: var(--red-soft);
  color: var(--red);
}

.add-special-die-btn {
  width: 100%;
  border-color: rgba(180, 135, 62, 0.40);
  background: var(--gold-soft);
  color: #5b451e;
}

.special-die-modal-panel {
  width: min(520px, 100%);
}

#dice-form > button[type="submit"],
.open-result-modal,
.equipment-roll-btn,
.stat-roll-btn,
.equipment-add-btn,
.mini-add-btn,
.equipment-form-actions button[type="submit"],
#save-equipment-dependency-btn,
#save-extra-skill-dependency-btn,
#save-status-btn,
#save-item-btn,
#save-extra-skill-btn,
#save-special-die-btn {
  border-color: transparent;
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(35, 84, 90, 0.17);
}

#dice-form > button[type="submit"]:hover,
.open-result-modal:hover,
.equipment-roll-btn:hover,
.stat-roll-btn:hover,
.equipment-add-btn:hover,
.mini-add-btn:hover,
.equipment-form-actions button[type="submit"]:hover,
#save-equipment-dependency-btn:hover,
#save-extra-skill-dependency-btn:hover,
#save-status-btn:hover,
#save-item-btn:hover,
#save-extra-skill-btn:hover,
#save-special-die-btn:hover {
  background: var(--brand-dark);
}

#dice-form > button[type="submit"] {
  width: 100%;
}

.help-icon {
  border-radius: 50%;
  border-color: rgba(180, 135, 62, 0.55);
  background: var(--gold-soft);
  color: #5b451e;
  font-size: 1rem;
}

.result-actions {
  margin-top: 0.85rem;
}

.open-result-modal {
  width: 100%;
}

#result {
  min-height: 3rem;
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.role-roll-chat {
  display: grid;
  gap: 0.5rem;
}

.role-roll-header {
  color: var(--brand-dark);
}

.role-roll-dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.role-roll-die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid #30352f;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: inset 0 -2px 0 rgba(23, 23, 23, 0.08);
  font-size: 1rem;
  font-weight: 900;
}

.role-roll-face-point {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.role-roll-face-reroll {
  border-width: 2px;
  border-color: var(--gold);
  background: var(--gold-soft);
}

.role-roll-face-plus {
  border-color: var(--green);
  color: var(--green);
}

.role-roll-face-minus {
  border-color: var(--red);
  color: var(--red);
}

.role-roll-face-blank {
  color: #acaaa1;
}

#summary {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

#summary > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(214, 209, 197, 0.75);
}

.total-highlight {
  color: var(--red);
  font-size: 1.25rem;
  font-weight: 950;
}

/* ===== Manual and history ===== */

.manual,
.history {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: #30352f;
  font-size: 0.9rem;
}

.manual-header,
.history-title,
.history-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.manual-header h3,
.history-title {
  margin: 0;
}

.manual-lang {
  display: inline-flex;
  gap: 0.25rem;
}

.lang-btn {
  min-height: 32px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.lang-btn.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.manual-page {
  margin-top: 0.55rem;
}

.manual ul {
  padding-left: 1.15rem;
}

.manual li + li {
  margin-top: 0.45rem;
}

.history-title {
  margin-top: 1rem;
  color: var(--brand-dark);
  font-size: 1.05rem;
}

.history-toggle {
  border-radius: 50%;
  background: var(--paper-strong);
}

.history {
  max-height: 290px;
  overflow-y: auto;
}

.history-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(214, 209, 197, 0.9);
}

.history-item:last-child {
  border-bottom: 0;
}

.history-time,
.history-row,
.history-empty,
.equipment-empty,
.equipment-dependency-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.history-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.history-total {
  color: var(--red);
  font-weight: 900;
}

/* ===== Character top ===== */

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

.character-info-header h2 {
  margin-bottom: 0;
}

.character-info-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(35, 84, 90, 0.14);
}

.character-info-tab,
.progression-tab {
  flex: 0 0 auto;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 0.45rem 0.8rem;
  border-color: rgba(35, 84, 90, 0.20);
  border-radius: 999px;
  background: rgba(248, 246, 239, 0.88);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1;
}

.character-info-tab.is-active,
.progression-tab.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 7px 14px rgba(35, 84, 90, 0.16);
}

.character-info-panel {
  min-width: 0;
  height: auto;
  max-height: none;
  overflow-y: visible;
  padding-right: 0.2rem;
}

.delete-character-btn,
.confirm-delete-btn,
.delete-equipment-btn,
.delete-status-btn,
.equipment-remove-btn {
  border-color: rgba(166, 77, 67, 0.35);
  background: var(--red-soft);
  color: #71362e;
}

.delete-character-btn:hover,
.confirm-delete-btn:hover,
.delete-equipment-btn:hover,
.delete-status-btn:hover,
.equipment-remove-btn:hover {
  border-color: var(--red);
  background: #efcfc7;
}

.sheet-header {
  padding: 0;
  border: 0;
  margin: 0;
}

.sheet-top-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.character-image-frame {
  position: relative;
  width: min(100%, 220px);
  justify-self: end;
}

.character-image-picker {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px dashed rgba(35, 84, 90, 0.30);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(35, 84, 90, 0.08), transparent 54%),
    rgba(248, 246, 239, 0.86);
  overflow: hidden;
  cursor: pointer;
}

.character-image-picker:hover {
  border-color: var(--brand);
  background:
    linear-gradient(135deg, rgba(35, 84, 90, 0.12), transparent 54%),
    rgba(248, 246, 239, 0.96);
}

.character-image-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.char-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-image-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(35, 84, 90, 0.24);
  border-radius: 50%;
  background: #ffffff;
  color: var(--brand);
  font-size: 1.8rem;
  font-weight: 850;
}

.clear-char-image-btn {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-color: rgba(166, 77, 67, 0.30);
  border-radius: 50%;
  background: rgba(247, 225, 219, 0.92);
  color: #71362e;
  box-shadow: 0 6px 14px rgba(25, 28, 22, 0.12);
  font-size: 1rem;
  line-height: 1;
}

.clear-char-image-btn:hover {
  background: var(--red-soft);
  border-color: var(--red);
}

.sheet-top-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.65rem;
}

.sheet-row {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: 0.35rem 0.55rem;
  align-items: center;
  min-width: 0;
}

.sheet-row:first-child,
.sheet-row:has(.mental-hearts) {
  grid-column: 1 / -1;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
}

.sheet-row:has(#char-health) {
  grid-column: 1 / span 5;
}

.sheet-row:has(#char-defense) {
  grid-column: 1 / span 5;
}

.sheet-row:has(#char-willpower) {
  grid-column: 1 / span 6;
}

.sheet-row > label {
  width: auto;
  color: #34403e;
  font-size: 0.86rem;
}

.sheet-row > label.sheet-inline-label {
  margin-left: 0;
}

.computed-field-note {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.15;
  text-align: left;
}

.inline-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  border-color: rgba(35, 84, 90, 0.32);
  background: #ffffff;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 950;
}

.sheet-row input#char-name.char-name-input {
  width: 100%;
  flex: none;
}

.sheet-row input#char-level,
.sheet-row input#char-defense,
.sheet-row input#char-willpower,
.sheet-row input#char-health,
.sheet-row input#char-health-max,
.sheet-row input#char-exp,
.sheet-row input#char-exp-max {
  width: 100%;
}


.sheet-row:has(#char-level):not(.sheet-row-identity),
.sheet-row:has(#char-health) {
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto minmax(0, 1fr) auto;
}


.sheet-row:has(#char-willpower) {
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
}

.sheet-row:has(#char-defense) {
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto;
}

#char-defense[readonly] {
  border-style: dashed;
  border-color: rgba(35, 84, 90, 0.22);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(35, 84, 90, 0.045) 0,
      rgba(35, 84, 90, 0.045) 8px,
      rgba(255, 255, 255, 0.42) 8px,
      rgba(255, 255, 255, 0.42) 16px
    ),
    rgba(248, 246, 239, 0.72);
  color: var(--muted);
  cursor: default;
}

.sheet-row-identity {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(180px, 1fr) auto 72px auto 78px auto 78px !important;
  align-items: center;
}

.sheet-row span {
  font-weight: 900;
  text-align: center;
}

.mental-control {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  min-width: 0;
}

.mental-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  color: #34403e;
  font-size: 0.86rem;
  font-weight: 900;
}

.mental-summary span {
  text-align: center;
}

#mental-max {
  width: 54px;
  padding: 0.22rem 0.32rem;
  text-align: center;
}

.attribute-points-help {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  border-color: rgba(35, 84, 90, 0.34);
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.68rem;
}

.mental-hearts {
  display: grid;
  grid-template-columns: repeat(6, 28px);
  grid-auto-rows: 28px;
  gap: 0.22rem;
  width: max-content;
  max-width: 100%;
}

.mental-heart {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--red);
  font-size: 1.35rem;
  line-height: 1;
}

.mental-heart:hover {
  background: transparent;
  transform: scale(1.08);
}

.mental-heart::before {
  content: "♥";
}

.mental-heart.off {
  color: #252525;
}

.basic-status-row {
  grid-column: 7 / -1;
  grid-row: 2 / span 2;
  grid-template-columns: minmax(118px, 118px) minmax(0, 1fr);
  align-items: start;
}

.basic-gear-row {
  grid-column: 7 / -1;
  grid-row: 4;
  grid-template-columns: minmax(118px, 118px) minmax(0, 1fr);
  align-items: start;
}

.basic-status-label {
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  text-align: center;
}

.basic-status-label small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.15;
}

.basic-status-tags,
.basic-gear-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.4rem;
  min-width: 0;
  min-height: 100%;
  padding-top: 0.1rem;
}

.basic-status-empty {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.basic-status-tag,
.basic-gear-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  width: auto;
  min-height: 30px;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.15;
}

/* 🔥 Hide edit buttons completely (revert to click tag to edit) */
.basic-gear-edit-btn,
.status-tag-edit-btn {
  display: none !important;
}

.basic-gear-roll-btn {
  width: auto;
  min-height: 22px;
  padding: 0.12rem 0.42rem;
  border-color: rgba(35, 84, 90, 0.25);
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 950;
}

.basic-gear-roll-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.basic-status-turns {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.7rem;
  font-weight: 950;
}

.basic-status-tag-buff {
  border-color: rgba(83, 123, 70, 0.35);
  background: var(--green-soft);
  color: #31522f;
}

.basic-status-tag-debuff {
  border-color: rgba(166, 77, 67, 0.35);
  background: var(--red-soft);
  color: #71362e;
}

.basic-gear-tag {
  border-color: rgba(180, 135, 62, 0.36);
  background: var(--gold-soft);
  color: #5b451e;
}

.floating-tooltip {
  position: fixed;
  z-index: 3000;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 0.62rem 0.72rem;
  border: 1px solid rgba(35, 84, 90, 0.18);
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: var(--shadow);
  color: #22241f;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
  pointer-events: none;
  text-align: left;
  white-space: pre-line;
}

.floating-tooltip-action {
  margin-top: 0.28rem;
  color: #8f2f25;
  font-weight: 950;
}

.status-block-top {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.profile-panel {
  display: grid;
  grid-template-columns: minmax(620px, 1.35fr) minmax(300px, 0.65fr);
  gap: 0.9rem;
  align-items: start;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.profile-summary {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.75rem;
  align-items: start;
  align-content: start;
}

.profile-image-picker {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  justify-self: end;
  width: 220px;
  aspect-ratio: 3 / 4;
  border: 1px dashed rgba(35, 84, 90, 0.30);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(35, 84, 90, 0.08), transparent 54%),
    rgba(248, 246, 239, 0.86);
  overflow: hidden;
  cursor: pointer;
}

.profile-image-picker:hover {
  border-color: var(--brand);
}

.profile-field {
  display: grid;
  gap: 0.35rem;
  width: auto;
  color: #34403e;
  font-size: 0.88rem;
  font-weight: 820;
}

.profile-field span {
  width: auto;
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  align-self: start;
}

.profile-name-field,
.profile-detail-grid {
  grid-column: 2;
}

.profile-background-field {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
  min-height: 0;
}

.profile-notes {
  height: 100%;
  min-height: 0;
}

/* ===== Sections, lists, cards ===== */

.sheet-section-title,
.equipment-title {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--brand-dark);
  font-size: 1rem;
  font-weight: 900;
}

.sheet-subtitle {
  margin: 0.25rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.equipment-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.extra-skill-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
}

.extra-skill-points-box {
  min-height: 34px;
  padding: 0.28rem 0.55rem;
  font-size: 0.76rem;
}

.equipment-block > .equipment-header .equipment-title-row {
  justify-content: flex-end;
}

.equipment-add-btn {
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.84rem;
  white-space: nowrap;
}

.equipment-block,
.items-block,
.status-block {
  margin: 0;
}

.equipment-layout {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.equipment-hands {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}

.equipment-hand-card,
.equipment-wearing {
  display: grid;
  gap: 0.55rem;
  align-content: start;
  min-width: 0;
  min-height: 0;
  padding: 0.72rem;
  border: 1px solid rgba(35, 84, 90, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.equipment-hand-header,
.equipment-wearing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.equipment-hand-header {
  display: grid;
  justify-items: center;
  justify-content: center;
}

.equipment-hand-header h4,
.equipment-wearing-header h4 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.92rem;
  font-weight: 950;
}

.equipment-slot-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  border-color: rgba(180, 135, 62, 0.40);
  background: var(--gold-soft);
  color: #5b451e;
  font-size: 1.2rem;
  font-weight: 950;
}

.equipment-slot-add-btn:hover {
  border-color: var(--gold);
  background: #f4ddab;
}

.equipment-slot-list {
  display: grid;
  gap: 0.65rem;
}

.equipment-list,
.status-list,
.item-list,
.extra-skill-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.progression-extra-skill-panel .extra-skill-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.18rem;
}

.equipment-layout .equipment-list {
  margin-top: 0;
}

.status-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.status-column {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  align-content: start;
  min-height: 160px;
  padding: 0.72rem;
  border: 1px solid rgba(35, 84, 90, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.status-column h4 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.95rem;
  font-weight: 950;
}

.equipment-empty {
  margin: 0;
  padding: 0.85rem;
  border: 1px dashed rgba(35, 84, 90, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
}

.equipment-item,
.status-item,
.item-card,
.extra-skill-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.82rem;
  border: 1px solid rgba(35, 84, 90, 0.16);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(25, 28, 22, 0.05);
}

.progression-extra-skill-panel .extra-skill-card {
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

.progression-extra-skill-panel .extra-skill-actions {
  justify-content: flex-start;
  width: 100%;
}

.progression-extra-skill-panel .equipment-dependency-preview {
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.05rem;
  scrollbar-width: thin;
}

.progression-extra-skill-panel .equipment-dependency-preview .dependency-chip,
.progression-extra-skill-panel .equipment-dependency-preview .equipment-dependency-empty {
  flex: 0 0 auto;
}

.progression-extra-skill-panel .equipment-dependency-preview .dependency-chip {
  min-height: 22px;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
}

.status-item-buff {
  border-color: rgba(83, 123, 70, 0.28);
  background: var(--green-soft);
}

.status-item-debuff {
  border-color: rgba(166, 77, 67, 0.30);
  background: var(--red-soft);
}

.equipment-item-info,
.item-main {
  min-width: 0;
  flex: 1 1 auto;
}

.equipment-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.equipment-name {
  color: #22241f;
  font-weight: 900;
}

.equipment-preview,
.status-preview,
.extra-skill-meta-row,
.equipment-dependency-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.equipment-item-actions,
.status-item-actions,
.extra-skill-actions,
.item-inline-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.equipment-roll-btn {
  min-height: 38px;
  padding: 0.42rem 0.72rem;
}

.icon-action-btn,
.item-inline-btn {
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.equipment-number-inline,
.status-duration-inline,
.item-amount-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: auto;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

.equipment-number-inline input[type="number"],
.status-duration-inline input[type="number"],
.item-amount-input {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  padding: 0.34rem 0.45rem;
}

.item-amount-row {
  margin-top: 0.15rem;
}

.item-amount-control {
  display: inline-flex;
}

.extra-skill-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.extra-skill-level-display,
.extra-skill-profession-badge,
.dependency-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
}

.extra-skill-level-display,
.dependency-chip {
  border: 1px solid rgba(35, 84, 90, 0.18);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.extra-skill-profession-badge {
  border: 1px solid rgba(83, 123, 70, 0.28);
  background: var(--green-soft);
  color: #395b31;
}

/* ===== Stats ===== */

.attributes-card {
  display: grid;
  gap: 0.95rem;
}

.progression-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.progression-tab {
  width: auto;
}

.progression-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.95rem;
  height: 465px;
  min-width: 0;
  overflow: hidden;
}

.progression-extra-skill-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
  height: 100%;
}

.progression-extra-skill-panel .items-block {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.attribute-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.attribute-tab-header .sheet-subtitle {
  margin: 0;
}

.attribute-points-box {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  min-height: 38px;
  padding: 0.38rem 0.68rem;
  border: 1px solid rgba(35, 84, 90, 0.18);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.attribute-points-box strong {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  min-height: 26px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-dark);
}

.attribute-points-divider {
  color: var(--muted);
}

.stat-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.progression-panel > .stat-section {
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.18rem;
}

.attribute-group-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 0.75rem;
}

.attribute-group {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.attribute-group-title {
  margin: 0;
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 950;
}

.attribute-group .stat-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.attribute-group .stat-dots {
  flex-wrap: wrap;
  grid-column: 1;
}

.attribute-group .stat-bonus {
  grid-column: 2;
  grid-row: 2;
  justify-content: center;
  align-self: center;
}

.attribute-group .stat-roll-btn {
  grid-column: 1 / -1;
}

.sheet-roll-context,
.sheet-roll-note,
.sheet-roll-number-row,
.sheet-roll-special-builder {
  grid-column: 1 / -1;
}

.sheet-roll-context {
  display: grid;
  gap: 0.2rem;
  padding: 0.72rem;
  border: 1px solid rgba(35, 84, 90, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.66);
}

.sheet-roll-context strong {
  color: var(--brand-dark);
  font-size: 1.05rem;
}

.sheet-roll-context span,
.sheet-roll-note {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.sheet-roll-note {
  margin: 0;
}

.sheet-roll-number-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}

.sheet-roll-special-builder {
  display: grid;
  gap: 0.55rem;
  padding: 0.72rem;
  border: 1px solid rgba(35, 84, 90, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.66);
}

.sheet-roll-special-list {
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.18rem;
}

.sheet-roll-special-die-card .special-die-card-faces {
  flex: 1 1 auto;
}

.mental-penalty-die-card {
  border-color: rgba(166, 77, 67, 0.38);
  background: var(--red-soft);
}

.mental-penalty-label {
  color: #8f2f25;
  font-size: 0.8rem;
  font-weight: 950;
  white-space: nowrap;
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) auto auto auto;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  padding: 0.62rem;
  border: 1px solid rgba(35, 84, 90, 0.13);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.70);
}

.stat-label {
  min-width: 0;
  color: #2e332d;
  font-weight: 850;
}

.stat-dots {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.22rem;
}

.stat-dot {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 2px solid var(--brand) !important;
  border-radius: 50%;
  background: #ffffff !important;
  forced-color-adjust: none;
}

.stat-dot:hover {
  background: var(--brand-soft) !important;
}

.stat-dot.active::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand) !important;
}

.stat-bonus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  overflow: hidden;
  font-size: 0;
}

.ability-grid .stat-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.ability-grid .stat-dots {
  grid-column: 1;
}

.ability-grid .stat-controls {
  display: contents;
}

.ability-grid .stat-bonus {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
}

.ability-grid .stat-roll-btn {
  grid-column: 1 / -1;
}

.stat-bonus input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--gold);
}

.stat-roll-btn {
  min-height: 34px;
  padding: 0.36rem 0.62rem;
  font-size: 0.82rem;
}

.ga-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.progression-panel[data-progression-panel="general-ability"] .ga-columns {
  align-items: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.18rem;
}

.ability-section {
  min-width: 0;
}

.ga-title {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 950;
}

.ability-grid {
  display: grid;
  gap: 0.5rem;
}

.ability-grid .stat-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
}

.ability-grid .stat-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
}

.stat-name {
  min-width: 0;
  font-size: 0.9rem;
}

.stat-tag {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
}

.stat-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ability-grid .stat-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.ability-grid .stat-dots {
  grid-column: 1;
}

.ability-grid .stat-controls {
  display: contents;
}

.ability-grid .stat-bonus {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
}

.ability-grid .stat-roll-btn {
  grid-column: 1 / -1;
}

.items-panel .item-list {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.18rem;
}

.note-card {
  display: grid;
  gap: 0.65rem;
  min-height: 0;
  margin-top: 0.75rem;
}

.note-empty-button {
  width: 100%;
  min-height: 100%;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
  line-height: 1.35;
}

.note-preview-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.75rem;
  min-height: 0;
  height: 100%;
  padding: 0.82rem;
  border: 1px solid rgba(35, 84, 90, 0.16);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(25, 28, 22, 0.05);
}

.note-preview-text {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.note-action-btn {
  min-height: 34px;
  padding: 0.4rem 0.65rem;
}

.note-content-field,
.note-form {
  grid-column: 1 / -1;
}

.note-content-field textarea {
  min-height: 300px;
}

.note-content-field textarea[readonly] {
  background: #ffffff;
  color: var(--ink);
}

/* ===== Forms and modals ===== */

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.result-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 18, 0.58);
  backdrop-filter: blur(4px);
}

.result-modal-panel {
  position: relative;
  z-index: 1;
  width: min(700px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border: 1px solid rgba(35, 84, 90, 0.22);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.equipment-modal-panel {
  width: min(620px, 100%);
}

.delete-character-modal-panel {
  width: min(430px, 100%);
}

.header-message-modal-panel {
  width: min(560px, 100%);
}

.developer-message-content {
  min-height: 130px;
  color: #34403e;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tip-me-body {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}

.tip-me-body p {
  margin: 0;
  color: #34403e;
}

.buy-coffee-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.65rem 0.95rem;
  border: 1px solid rgba(180, 135, 62, 0.50);
  border-radius: 999px;
  background: var(--gold-soft);
  color: #5b451e;
  font-weight: 900;
  text-decoration: none;
}

.buy-coffee-link:hover {
  border-color: var(--gold);
  background: #f4ddab;
}

.contact-intro {
  margin-bottom: 1rem;
  color: #34403e;
  font-weight: 800;
}

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.contact-details-field,
.contact-form .equipment-form-actions,
.contact-form-message {
  grid-column: 1 / -1;
}

.contact-form-message {
  min-height: 1.2rem;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.contact-form-message.is-success {
  color: #395b31;
}

.contact-form-message.is-error {
  color: #8f2f25;
}

.result-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(35, 84, 90, 0.14);
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(10px);
}

.result-modal-header h2,
.result-modal-body h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 1.05rem;
  font-weight: 950;
}

.result-modal-close {
  border-radius: 50%;
  font-size: 1.25rem;
}

.result-modal-body {
  padding: 1rem;
}

.result-modal-body h3 {
  margin-top: 1rem;
}

.result-modal-body h3:first-child {
  margin-top: 0;
}

.equipment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.equipment-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: auto;
  color: #34403e;
  font-size: 0.9rem;
  font-weight: 780;
}

.equipment-field[for="equipment-name"],
.equipment-field[for="equipment-description"],
.equipment-slot-field,
.equipment-stats-field,
.equipment-field[for="item-name"],
.equipment-field[for="item-details"],
.equipment-field[for="extra-skill-name"],
.equipment-field[for="extra-skill-details"],
.equipment-field[for="status-name"],
.equipment-field[for="status-details"],
.status-first-page-field,
.equipment-dependency-field,
.status-type-field,
.status-duration-field,
.status-temporary-options,
.profession-field,
.extra-skill-level-field,
.extra-skill-points-field {
  grid-column: 1 / -1;
}

.status-turns-field {
  margin-top: 0.15rem;
}

.status-checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  min-height: var(--tap);
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  font-weight: 850;
}

.status-checkbox-option input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--brand);
}

.equipment-field span,
.equipment-field label,
.equipment-field > span {
  width: auto;
}

.equipment-dependency-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mini-add-btn {
  min-height: 32px;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.equipment-dependency-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 34px;
}

.equipment-stat-options {
  display: grid;
  gap: 0.55rem;
}

.equipment-stat-option {
  display: grid;
  grid-template-columns: auto minmax(86px, auto) minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  width: auto;
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(35, 84, 90, 0.16);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.equipment-stat-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--brand);
}

.equipment-stat-option input[type="text"],
.equipment-stat-option input[type="number"] {
  width: 100%;
  min-width: 0;
}

.equipment-stat-option input:disabled {
  opacity: 0.45;
}

.equipment-empty-inline {
  padding: 0.5rem 0.65rem;
}

.equipment-form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.dependency-options {
  display: grid;
  gap: 1rem;
}

.dependency-group h3 {
  margin: 0 0 0.5rem;
}

.dependency-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.dependency-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(35, 84, 90, 0.16);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-weight: 750;
}

.dependency-option input {
  margin: 0;
  accent-color: var(--brand);
}

.status-type-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.status-type-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  width: auto;
  min-height: var(--tap);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  font-weight: 850;
}

.status-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.status-type-buff {
  background: var(--green-soft);
  border-color: rgba(83, 123, 70, 0.25);
}

.status-type-debuff {
  background: var(--red-soft);
  border-color: rgba(166, 77, 67, 0.25);
}

.status-type-option:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(35, 84, 90, 0.14);
}

.status-type-buff:has(input:checked) {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(83, 123, 70, 0.18);
}

.status-type-debuff:has(input:checked) {
  border-color: var(--red);
  box-shadow: inset 0 0 0 2px rgba(166, 77, 67, 0.16);
}

.profession-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  width: auto;
}

.profession-toggle input {
  accent-color: var(--green);
}

.delete-character-copy,
.delete-character-name {
  margin: 0;
}

.delete-character-name {
  margin-top: 0.35rem;
  color: var(--red);
  font-size: 1.15rem;
  font-weight: 950;
}

/* ===== Responsive ===== */

@media (max-width: 1180px) {
  .layout {
    max-width: 980px;
  }

  .sheet-top-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .character-image-frame {
    width: min(100%, 220px);
  }

  .ga-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    padding-inline: 10px;
  }

  .page-header {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title title"
      "left right"
      "tabs tabs";
  }

  .page-header h1 {
    text-align: left;
  }

  .page-header-left-actions,
  .page-header-right-actions {
    justify-self: start;
    flex-wrap: wrap;
  }

  .manual-guide-link {
    width: max-content;
  }

  .sheet-top-layout,
  .sheet-top-fields,
  .lower-sheet-layout,
  .attribute-tab-header,
  .profile-panel,
  .profile-summary,
  .stat-section,
  .ga-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .attribute-tab-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-stack {
    height: auto;
  }

  .inventory-stack .items-panel {
    flex-basis: auto;
    max-height: none;
  }

  .inventory-stack .items-panel .item-list {
    max-height: 320px;
  }

  .inventory-stack .notes-panel {
    flex-basis: auto;
    min-height: 180px;
    max-height: none;
  }

  .profile-image-picker {
    width: min(100%, 220px);
    grid-row: auto;
  }

  .profile-name-field,
  .profile-detail-grid {
    grid-column: auto;
  }

  .field {
    grid-template-columns: minmax(0, 1fr);
  }

  .field .help-icon {
    justify-self: start;
  }

  .manual-roll-toggle {
    left: 8px;
    top: auto;
    bottom: 18px;
    width: 52px;
    height: 52px;
    padding: 0;
    font-size: 1.6rem;
    transform: none;
  }

  .dice-panel {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .equipment-item,
  .status-item,
  .item-card,
  .extra-skill-card {
    flex-direction: column;
  }

  .status-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .equipment-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .progression-extra-skill-panel .extra-skill-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .progression-panel {
    height: 465px;
  }

  .equipment-item-actions,
  .status-item-actions,
  .extra-skill-actions,
  .item-inline-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .equipment-form,
  .contact-form,
  .sheet-roll-number-row,
  .dependency-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .character-info-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .profile-panel {
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .page-header {
    padding: 0.7rem;
  }

  .sheet-card,
  .dice-panel,
  .items-panel,
  .notes-panel,
  .extra-skill-panel {
    padding: 0.8rem;
  }

  .character-info-header,
  .equipment-title-row,
  .extra-skill-header-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .extra-skill-header-actions {
    margin-left: 0;
  }

  .sheet-row,
  .basic-status-row,
  .basic-gear-row,
  .sheet-row:has(#char-level):not(.sheet-row-identity),
  .sheet-row:has(#char-health),
  .sheet-row:has(#char-defense),
  .sheet-row:has(#char-willpower) {
    grid-column: 1 / -1;
    grid-row: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet-row-identity {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(120px, 1fr) auto 62px auto 66px auto 66px !important;
  }

  .sheet-row span {
    text-align: left;
  }

  .mental-hearts {
    grid-template-columns: repeat(6, 28px);
  }

  .stat-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-dots {
    flex-wrap: wrap;
  }

  .stat-controls {
    flex-wrap: wrap;
  }
}

@media print {
  html,
  body {
    background: #ffffff !important;
  }

  body::before,
  .page-header,
  .site-footer,
  .left-column,
  .equipment-add-btn,
  .stat-roll-btn,
  .equipment-roll-btn,
  .icon-action-btn,
  .delete-character-btn {
    display: none !important;
  }

  .layout,
  .sheet-top-layout,
  .stat-section,
  .ga-columns {
    display: block;
  }

  .sheet-card,
  .status-block-top,
  .equipment-item,
  .status-item,
  .item-card,
  .extra-skill-card,
  .stat-row {
    break-inside: avoid;
    box-shadow: none !important;
  }

  .stat-dot,
  .mental-heart {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


.number-control {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.number-control button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  font-weight: 900;
}
