/* ==========================================================================
   Ficha D&D 3.5 — identidade preto e branco fiel à ficha oficial (barras
   pretas com texto branco em caixa alta, grades de caixas calculadas em
   cinza), com o polimento de um app mobile nativo: navegação por chips
   roláveis, cantos levemente arredondados nos controles interativos,
   sombras discretas em escala de cinza e uma escala tipográfica confortável.
   Paleta estritamente monocromática: preto, branco e cinza. Sem cores.
   ========================================================================== */

:root {
  --ink: #000000;
  --paper: #ffffff;
  --line: #000000;
  --line-soft: #cfcfcf;
  --fill-computed: #e6e6e6;
  --fill-header-alt: #f4f4f4;
  --muted: #5a5a5a;
  --radius: 0px;
  --radius-control: 10px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-bar: 0 -2px 10px rgba(0, 0, 0, 0.08);
  --tab-bar-height: 60px;
  --header-height: 56px;
  --font-sans: 'Segoe UI', Arial, Helvetica, -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2f2f2;
    --paper: #0c0c0c;
    --line: #f2f2f2;
    --line-soft: #3a3a3a;
    --fill-computed: #262626;
    --fill-header-alt: #1a1a1a;
    --muted: #b3b3b3;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-bar: 0 -2px 14px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-y: contain;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-sans);
}

.app-root {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
}

@media (min-width: 721px) {
  .app-root {
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
  }
}

.muted {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.4;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: var(--header-height);
  padding: 0 0.85rem;
  background: var(--ink);
  color: var(--paper);
  flex-shrink: 0;
  z-index: 5;
}

.app-header h1 {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.app-header--sheet .app-header__title {
  flex: 1;
  font-size: 0.98rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__level {
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--paper);
  border-radius: var(--radius-control);
  padding: 0.3rem 0.6rem;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-sans);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: background-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  background: var(--ink);
  color: var(--paper);
}

.app-header .btn--icon {
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--paper);
  background: transparent;
}

.app-header .btn--icon:active {
  background: var(--paper);
  color: var(--ink);
}

.btn--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 1.15rem;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn--primary:active {
  opacity: 0.75;
}

.btn--secondary {
  border-style: dashed;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
}

.btn--ghost:active {
  background: var(--fill-computed);
  color: var(--ink);
}

.btn--danger {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn--xs {
  min-height: auto;
  padding: 0.3rem 0.6rem;
  font-size: 0.74rem;
  border-radius: var(--radius-control);
}

.btn--block {
  width: 100%;
}

/* ---------- Layout scaffolding ---------- */
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem 0.85rem calc(var(--tab-bar-height) + 1.1rem);
  -webkit-overflow-scrolling: touch;
}

.screen--list {
  padding-top: 0.85rem;
}

/* ---------- Quick stats bar (sempre visível na ficha) ---------- */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 4;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: var(--paper);
  border: none;
  padding: 0.55rem 0.15rem;
  font-family: var(--font-sans);
  color: var(--ink);
  min-width: 0;
}

.stat-box__value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-box__label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

/* ---------- Tab bar: grade fixa de 8 colunas iguais, ícone + rótulo ----------
   Sem rolagem e sem nenhum cálculo em JS: 8 células de largura igual sempre
   cabem na tela, então a barra nunca deixa de caber, em nenhuma largura de
   celular. O rótulo usa fonte minúscula e corte seguro (nowrap + ellipsis)
   como rede de segurança em telas muito estreitas. */
.tab-bar {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
  flex-shrink: 0;
  height: var(--tab-bar-height);
  box-shadow: var(--shadow-bar);
  z-index: 5;
}

.tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  background: none;
  border: none;
  color: var(--ink);
  padding: 0.3rem 0.1rem;
  min-width: 0;
}

.tab-bar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.tab-bar__icon svg {
  width: 19px;
  height: 19px;
  display: block;
}

.tab-bar__item.is-active .tab-bar__icon {
  background: var(--ink);
  color: var(--paper);
}

.tab-bar__label {
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Sections (accordions) ---------- */
.sheet-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  margin-bottom: 0.85rem;
  background: var(--paper);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.sheet-section__title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  list-style: none;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sheet-section__title::-webkit-details-marker {
  display: none;
}

.sheet-section__title::after {
  content: '▸';
  font-size: 0.7rem;
  flex-shrink: 0;
}

.sheet-section[open] > .sheet-section__title::after {
  content: '▾';
}

.sheet-section__body {
  padding: 0.9rem;
}

/* ---------- Fields ---------- */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

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

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  min-width: 0;
}

.field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.field__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 700;
}

.field__input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
  min-height: 42px;
  font-family: var(--font-sans);
}

.field__input:focus,
.skill-row input:focus,
.ability-row__field input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.field__input--small {
  min-height: 38px;
  padding: 0.4rem;
}

.field__textarea {
  min-height: 110px;
  font-family: var(--font-sans);
  resize: vertical;
  line-height: 1.45;
}

/* ---------- Formula strip (imita "TOTAL = BASE + MOD + MOD" da ficha original) ---------- */
.formula {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.formula__cell {
  flex: 1 1 0;
  min-width: 3.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  border-right: 1px solid var(--line-soft);
  text-align: center;
}

.formula__cell:last-child {
  border-right: none;
}

.formula__cell--op {
  flex: 0 0 auto;
  min-width: 1.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
}

.formula__cell--total {
  background: var(--fill-computed);
  flex: 1.3 1 0;
}

.formula__cell--button {
  border-left: 1px solid var(--line-soft);
  cursor: pointer;
  font-family: var(--font-sans);
}

.formula__value {
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  background: none;
  border: none;
  color: var(--ink);
  width: 100%;
  text-align: center;
}

.formula__value--input {
  border-bottom: 1px solid var(--line);
}

.formula__label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 700;
  margin-top: 0.15rem;
}

.formula__cell--total .formula__label {
  color: var(--ink);
}

/* ---------- Ability scores ---------- */
.ability-table {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.ability-row {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr) 3.4rem 3.8rem;
  border-top: 1px solid var(--line-soft);
}

.ability-row:first-child {
  border-top: none;
}

.ability-row__label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem;
  border-right: 1px solid var(--line-soft);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
}

.ability-row__label small {
  font-weight: 400;
  text-transform: none;
  color: var(--muted);
  font-size: 0.65rem;
}

.ability-row__field {
  border-right: 1px solid var(--line-soft);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ability-row__field input {
  width: 100%;
  border: none;
  background: none;
  color: var(--ink);
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  min-height: 38px;
  border-radius: 0;
}

.ability-row__base-temp {
  display: flex;
  padding: 0;
}

.ability-row__base-temp input {
  flex: 1 1 0;
  min-width: 0;
}

.ability-row__base-temp input:last-child {
  border-left: 1px solid var(--line-soft);
  font-weight: 400;
  font-size: 0.85rem;
}

.ability-row__mod {
  background: var(--fill-computed);
  border: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ability-table-header {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr) 3.4rem 3.8rem;
  background: var(--fill-header-alt);
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.ability-table-header span {
  padding: 0.4rem 0.25rem;
  border-right: 1px solid var(--line-soft);
  text-align: center;
}

.ability-table-header span:first-child {
  text-align: left;
  padding-left: 0.5rem;
}

.ability-table-header span:last-child {
  border-right: none;
}

/* ---------- Saves ---------- */
.save-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.save-block__title {
  background: var(--fill-header-alt);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
}

.save-block .formula {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
}

/* ---------- Skills ---------- */
.skills-table {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.skills-header,
.skill-row {
  display: grid;
  grid-template-columns: 1.2rem 1.4rem minmax(0, 1fr) 2.7rem 2.7rem 3.6rem;
  column-gap: 0.35rem;
  align-items: center;
}

.skills-header {
  font-size: 0.62rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  padding: 0.45rem 0.5rem;
  background: var(--fill-header-alt);
  border-bottom: 1px solid var(--line-soft);
}

.skills-header span:nth-child(4),
.skills-header span:nth-child(5),
.skills-header span:nth-child(6) {
  text-align: center;
}

.skill-row__favorite {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  color: var(--line-soft);
}

.skill-row__favorite.is-favorite {
  color: var(--ink);
}

.skill-row {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.84rem;
}

.skill-row:last-child {
  border-bottom: none;
}

.skill-row--unusable .skill-row__name {
  color: var(--muted);
}

.skill-row__class-mark {
  text-align: center;
  font-size: 0.75rem;
}

.skill-row__name {
  font-size: 0.82rem;
  line-height: 1.25;
}

.skill-row__name .tag-trained {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.56rem;
  font-weight: 700;
  padding: 0 0.3rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  text-transform: uppercase;
}

.skill-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  padding: 0.35rem 0.1rem;
  font-size: 0.85rem;
  min-height: 34px;
  background: var(--paper);
  color: var(--ink);
}

/* ---------- Pills / valores tocáveis ---------- */
.stat-pill {
  border: 1px solid var(--line);
  background: var(--fill-computed);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  text-align: center;
}

.tag {
  display: inline-block;
  font-size: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.35rem;
  text-transform: uppercase;
  font-weight: 700;
}

/* ---------- Feats ---------- */
.feat-card,
.weapon-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.75rem;
  margin-bottom: 0.7rem;
  background: var(--paper);
  box-shadow: var(--shadow-card);
}

.feat-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.feat-card__title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.feat-card__actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.custom-effect-form {
  display: none;
  margin-top: 0.6rem;
  border-top: 1px dashed var(--line-soft);
  padding-top: 0.6rem;
}

.custom-effect-form.is-open {
  display: block;
}

.custom-effect-list {
  margin: 0.4rem 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.82rem;
}

.custom-effect-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--fill-header-alt);
}

.weapon-card__totals {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.repeat-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.repeat-row .field__input {
  flex: 1;
  min-width: 0;
}

.repeat-row--item .field__input:nth-child(2),
.repeat-row--item .field__input:nth-child(3) {
  flex: 0 0 3.4rem;
}

.trait-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.stat-line {
  font-size: 0.9rem;
}

.section-divider {
  border: none;
  border-top: 1px dashed var(--line-soft);
  margin: 0.9rem 0;
}

/* ---------- Base de talentos (biblioteca extensível) ---------- */
.feat-library {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feat-library-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  padding: 0.5rem 0.65rem;
}

.feat-library-item__name {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------- Spells ---------- */
.spell-level-group__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0.7rem 0 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line-soft);
}

.spell-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.82rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--fill-header-alt);
}

.spell-row__info p {
  margin: 0.15rem 0 0;
}

/* ---------- Character list ---------- */
.character-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.85rem;
  margin-bottom: 0.7rem;
  background: var(--paper);
  box-shadow: var(--shadow-card);
}

.character-card__thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-control);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}

.character-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-card__main h2 {
  font-size: 1rem;
  font-weight: 700;
}

.character-card__actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  margin-top: 4rem;
  padding: 0 1rem;
}

.empty-state p:first-child {
  font-size: 1rem;
  font-weight: 600;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.modal.is-open {
  display: flex;
}

.modal__panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom: none;
  width: 100%;
  max-width: 720px;
  max-height: 75vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  position: sticky;
  top: 0;
  border-radius: 16px 16px 0 0;
}

.modal__title {
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

.modal__header .btn--icon {
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--paper);
  background: transparent;
}

.modal__header .btn--icon:active {
  background: var(--paper);
  color: var(--ink);
}

.modal__body {
  padding: 0.9rem;
}

.breakdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.breakdown-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--fill-header-alt);
  font-size: 0.88rem;
}

.breakdown-list li.is-shadowed {
  color: var(--muted);
  text-decoration: line-through;
}

/* ---------- Galeria de imagens do personagem ---------- */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.image-gallery__item {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--fill-header-alt);
}

.image-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.image-gallery__remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

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

.image-add-row .field__input {
  flex: 1;
}

/* A galeria usa fundo escuro fixo (não segue o tema) — convenção universal de
   visualizadores de imagem, para dar contraste às fotos em claro ou escuro. */
.modal__panel--gallery {
  background: #0b0b0b;
  color: #f2f2f2;
  border-radius: 16px 16px 0 0;
  max-height: 90vh;
  border-color: #0b0b0b;
}

.modal__panel--gallery .modal__header {
  background: #0b0b0b;
  color: #f2f2f2;
  border-radius: 16px 16px 0 0;
}

.modal__panel--gallery .btn--icon {
  border-color: rgba(255, 255, 255, 0.55);
  color: #f2f2f2;
}

.gallery-modal__counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f2f2f2;
}

.gallery-modal__body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 45vh;
  padding: 0.5rem;
}

.gallery-modal__image {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 6px;
}

.gallery-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.35);
  color: var(--paper);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal__nav--prev {
  left: 0.5rem;
}

.gallery-modal__nav--next {
  right: 0.5rem;
}

.gallery-modal__caption {
  text-align: center;
  font-size: 0.82rem;
  color: #f2f2f2;
  padding: 0 1rem 1rem;
  min-height: 1.2rem;
}

@media (min-width: 480px) {
  .field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
