/* ===== DnD Fight Tracker — Grimoire Fantasy Theme ===== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&display=swap');

* {
  box-sizing: border-box;
}

:root {
  /* --- Parchment (light) palette --- */
  --bg:           #2b2433;
  --bg-surface:   #352e3f;
  --bg-panel:     #3d354a;
  --bg-input:     #2b2433;
  --bg-table:     #352e3f;
  --bg-table-alt: #2f2839;
  --bg-table-head:#4a3f5c;
  --bg-active:    rgba(212,168,67,0.18);

  --text:         #e8dcc8;
  --text-secondary: #a99e8a;
  --text-heading: #f0e6d3;
  --text-muted:   #7a6f60;

  --border:       #4d4460;
  --border-light: #3d354a;
  --border-accent:#7a6840;

  --accent:       #c9952b;
  --accent-light: #d4a843;
  --accent-glow:  rgba(201,149,43,0.25);
  --accent-dim:   #8b6914;

  --danger:       #c0392b;
  --danger-light: #e74c3c;

  --hp-ok:        #4ade80;
  --hp-low:       #f59e0b;
  --hp-dead:      #ef4444;

  --shadow-soft:  0 12px 40px rgba(0,0,0,0.45);
  --shadow-panel: 0 6px 20px rgba(0,0,0,0.3);
  --shadow-btn:   0 4px 12px rgba(0,0,0,0.3);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 24px 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* subtle parchment-like noise via repeating gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,149,43,0.03) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 20%, rgba(139,105,20,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.container {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px 26px 30px;
  width: 1140px;
  max-width: 95vw;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* decorative top border accent */
.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-light), var(--accent), transparent);
}

h1 {
  margin: 0;
  text-align: left;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 1.5rem;
  color: var(--accent-light);
  font-family: 'Cinzel', 'Georgia', serif;
  font-weight: 700;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.header-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 0.85rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.badge-label {
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.theme-control {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

/* ===== Combat Actions Bar ===== */
.combat-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.combat-actions-secondary {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.next-turn-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.next-turn-btn .ico {
  width: 16px;
  height: 16px;
}

/* Layout principal : formulaire + des en haut, tableau en bas */
.top-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .top-layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
}

/* ===== Collapsible sections ===== */
.section-details {
  border: none;
  margin: 0;
}

.section-details summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-details summary::-webkit-details-marker { display: none; }
.section-details summary::marker { display: none; content: ''; }

.section-details summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid var(--accent);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.section-details[open] > summary::before {
  transform: rotate(90deg);
}

.section-details summary:hover {
  opacity: 0.85;
}

/* ===== Form groups ===== */
.form-group {
  margin-top: 10px;
  padding: 8px 10px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.03);
}

.form-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.form-submit-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.form-submit-row .primary {
  padding: 10px 28px;
  font-size: 0.92rem;
}

/* Formulaire */
.form-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 6px;
  font-family: 'Cinzel', 'Georgia', serif;
  font-weight: 600;
  padding: 4px 0;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.form-row label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.form-row label span {
  margin-bottom: 2px;
}

input[type="text"],
input[type="number"],
select {
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  min-width: 120px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  font-size: 0.85rem;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 42px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  overflow: hidden;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: var(--radius-pill); }
input[type="color"]::-moz-color-swatch { border: none; border-radius: var(--radius-pill); }

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-input);
}

select {
  border-radius: var(--radius-md);
}

/* ===== Buttons ===== */
button {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: transform 0.05s ease-out, box-shadow 0.1s ease-out, background 0.15s, filter 0.15s;
  font-family: inherit;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn);
  filter: brightness(1.08);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #1a1520;
  font-weight: 700;
  border: 1px solid var(--accent-light);
  text-shadow: 0 1px 0 rgba(255,255,255,0.15);
}

button.secondary {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
}

button.danger {
  background: linear-gradient(135deg, var(--danger), #a93226);
  color: #fef2f2;
  border: 1px solid var(--danger-light);
}

button.small {
  padding: 4px 10px;
  font-size: 0.75rem;
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Conditions selects */
.condition-select {
  width: 100%;
  margin-top: 3px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.8rem;
}

.conditions-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.8rem;
}

.conditions-input::placeholder {
  color: var(--text-muted);
}

.stat-input {
  width: 72px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.8rem;
  margin-right: 4px;
}

/* Controles globaux */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 8px;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Dice Panel ===== */
.dice-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: 'Cinzel', 'Georgia', serif;
  font-weight: 600;
}

.dice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dice-buttons button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.dice-buttons button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-light);
  box-shadow: 0 0 12px var(--accent-glow);
}

.dice-result {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text);
}

.dice-result-value {
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 42px;
  text-align: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(201,149,43,0.2), rgba(201,149,43,0.1));
  border: 1px solid var(--accent);
  color: var(--accent-light);
}

.dice-rolling {
  animation: dice-pop 0.4s ease-out;
}

@keyframes dice-pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.dice-history {
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-height: 92px;
  overflow-y: auto;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-panel);
}

.dice-history::-webkit-scrollbar {
  width: 6px;
}

.dice-history::-webkit-scrollbar-track {
  background: var(--bg-panel);
  border-radius: var(--radius-pill);
}

.dice-history::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}

.dice-history::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.dice-history-entry {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
}

/* ===== Initiative Table ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-table);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: none;
  box-shadow: none;
}

th,
td {
  border-bottom: 1px solid var(--border-light);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.85rem;
  vertical-align: middle;
}

th {
  background: var(--bg-table-head);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--accent);
  font-family: 'Cinzel', 'Georgia', serif;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ===== Turn table extras: token color + hide ===== */
th.col-n { width: 44px; }
th.col-hide { width: 118px; }

.token-color-row {
  margin-top: 6px;
}

.token-color-input {
  width: 32px;
  height: 28px;
  border-radius: var(--radius-sm);
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
}

/* cell with 2 small icon buttons (hide token, hide name) */
.turn-hide-tools {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.table-icon-btn {
  width: 34px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  color: var(--text);
}
.table-icon-btn:hover { filter: brightness(1.1); }
.table-icon-btn.is-active {
  outline: 2px solid var(--accent-glow);
  outline-offset: 1px;
  border-color: var(--accent);
}

tbody tr:nth-child(even) {
  background: var(--bg-table-alt);
}

tbody tr:nth-child(odd) {
  background: var(--bg-table);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Row hover */
tbody tr:hover {
  background: rgba(201,149,43,0.06);
}

/* Tour actif */
tr.active {
  background: var(--bg-active) !important;
  box-shadow: inset 0 0 0 2px rgba(201,149,43,0.5);
  position: relative;
}

tr.active td {
  font-weight: 600;
  color: var(--accent-light);
}

.turn-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #1a1520;
  font-size: 0.8rem;
  margin-right: 4px;
  animation: pulse 1.1s infinite;
  border: 1px solid var(--accent-light);
  font-weight: 800;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(201,149,43,0.7);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(201,149,43,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(201,149,43,0);
  }
}

.hp-value {
  font-weight: 700;
  margin-right: 6px;
  font-size: 0.85rem;
}

.hp-ok {
  color: var(--hp-ok);
}

.hp-low {
  color: var(--hp-low);
}

.hp-dead {
  color: var(--hp-dead);
  text-decoration: line-through;
}

.hp-controls button {
  margin-right: 3px;
}

.hp-temp-wrapper {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.hp-bar {
  margin-top: 4px;
  width: 150px;
  max-width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--border-light);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}

.hp-bar-current {
  height: 100%;
  background: linear-gradient(to right, var(--hp-ok), #22c55e);
  transition: width 0.3s ease;
}

.hp-bar-temp {
  height: 100%;
  background: linear-gradient(to right, #fde047, var(--hp-low));
  transition: width 0.3s ease;
}

.hp-advanced {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.hp-advanced input {
  font-size: 0.75rem;
}

.empty {
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-panel);
}

/* Concentration */
.concentration-toggle {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.concentration-toggle input {
  accent-color: var(--hp-ok);
}

.concentration-badge {
  display: inline-flex;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(74,222,128,0.15);
  font-size: 0.72rem;
  color: var(--hp-ok);
  border: 1px solid rgba(74,222,128,0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 700px) {
  th:nth-child(1),
  td:nth-child(1) {
    display: none;
  }
}

/* ===== Battlemap ===== */
.map-section { margin-top: 16px; }
.map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.map-header h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--accent-light);
  font-family: 'Cinzel', 'Georgia', serif;
  font-weight: 700;
}
.map-header .subtitle { margin-top: 4px; opacity: .9; }
.map-chips { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Online players list (presence) */
.online-players { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.online-players-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.online-players-list--sidebar { justify-content: flex-start; }
.player-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: .88rem;
  line-height: 1;
  color: var(--text);
}
.player-color { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255,255,255,.15); flex: 0 0 auto; }
.player-name { white-space: nowrap; }
.muted { opacity: .75; font-size: .85rem; }

.map-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 980px) { .map-layout { grid-template-columns: 1fr; } }

/* MJ: map pleine largeur + outils au-dessus (layout empile) */
.map-layout.map-layout--stack {
  grid-template-columns: 1fr;
  align-items: stretch;
}
.map-layout.map-layout--stack .map-controls,
.map-layout.map-layout--stack .map-canvas {
  width: 100%;
}

.map-controls-title {
  font-weight: 700;
  margin: 2px 0 8px;
  color: var(--accent);
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.85rem;
  padding: 4px 0;
}
.map-controls input[type="file"] {
  padding: 6px 7px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}
.map-controls input[type="range"] { width: 100%; }
.map-controls .form-row { margin-top: 6px; }

.inline-check { display: flex; flex-direction: column; }
.inline-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}
.inline-check-row input { transform: scale(1.1); }

.map-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  opacity: .95;
}

.map-canvas { padding: 10px; }
#map {
  touch-action: none;
  border: 1px solid var(--border);
  width: 100%;
  height: 680px;
  display: block;
  border-radius: var(--radius-lg);
  background: var(--bg);
}
@media (max-width: 980px) { #map { touch-action: none; height: 560px; } }

/* === Supabase realtime controls === */
.inline-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.inline-row > input {
  flex: 1;
}
.map-realtime {
  margin-top: 6px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: var(--bg-input);
}

hr.sep { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* Toggle button state */
button.is-active {
  box-shadow: inset 0 0 0 2px rgba(201,149,43,0.6);
  border-color: var(--accent);
}

/* ===== Icon toolbar (MJ & Player) ===== */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 8px 0 2px;
}

.tool-buttons {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.icon-btn {
  width: 38px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  color: var(--text);
}

.icon-btn:hover {
  filter: brightness(1.1);
  border-color: var(--accent);
}

.icon-btn.is-active {
  outline: 2px solid rgba(201,149,43,0.5);
  outline-offset: 1px;
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent-light);
}

.icon-btn.danger {
  color: var(--danger-light);
}

.ico {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.ico path[fill="none"], .ico circle[fill="none"] {
  fill: none;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  user-select: none;
  color: var(--text);
}

.check-inline input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.field-inline span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.field-inline input[type="range"] {
  width: 200px;
  accent-color: var(--accent);
}

.field-inline--range {
  min-width: 220px;
}

.hint-inline {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: var(--bg-panel);
  font-size: 0.85rem;
  line-height: 1.1;
  color: var(--text-secondary);
}

/* === Turn bar (player) === */
.turnbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  overflow-x: auto;
  white-space: nowrap;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-panel);
}

.turnbar-item {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text);
}

.turnbar-item.is-active {
  outline: 2px solid rgba(201,149,43,0.5);
  outline-offset: 1px;
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ===== Player page layout ===== */
.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand .logo {
  font-size: 1.5rem;
}

.brand .title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-light);
  font-family: 'Cinzel', 'Georgia', serif;
}

.pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 0.85rem;
  color: var(--text);
}

.content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 0;
  padding: 0;
}

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

.content > .panel.map-controls {
  border-radius: 0;
  border-right: 1px solid var(--border);
  border-left: none;
  border-top: none;
  border-bottom: none;
  min-height: calc(100vh - 60px);
  padding: 16px;
}

.content > .panel.map-canvas {
  border-radius: 0;
  border: none;
  padding: 10px;
}

/* ===== Responsive: Mobile adjustments ===== */
@media (max-width: 700px) {
  .container {
    padding: 14px 12px 20px;
    border-radius: var(--radius-md);
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  h1 {
    font-size: 1.2rem;
  }

  .combat-actions-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .combat-actions-secondary {
    margin-left: 0;
    justify-content: center;
  }

  .next-turn-btn {
    width: 100%;
    justify-content: center;
  }

  .form-group {
    padding: 6px 8px 8px;
  }

  .table-wrapper {
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 0;
  }
}

/* ===== Smooth transitions ===== */
.section-details > *:not(summary) {
  animation: fadeIn 0.15s ease;
}

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