/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* App Container */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* PDF Loader Screen */
.pdf-loader {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.pdf-loader-content h1 {
  font-size: 24px;
  color: #e94560;
  margin-bottom: 16px;
}

.pdf-loader-content p {
  margin-bottom: 12px;
  color: #aaa;
}

.file-btn {
  display: inline-block;
  padding: 12px 28px;
  background: #e94560;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background 0.2s;
}

.file-btn:hover {
  background: #c73a52;
}

.file-hint {
  margin-top: 12px;
  font-size: 12px;
  color: #666;
}

/* Main Container (wraps tabs + content) */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Tab Bar */
.tab-bar {
  display: flex;
  background: #0f1a30;
  border-bottom: 2px solid #4a4a6a;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
}

.tab-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: bold;
  color: #888;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn:hover {
  color: #ccc;
  background: #16213e;
}

.tab-btn.active {
  color: #e94560;
  border-bottom-color: #e94560;
  background: #16213e;
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ============================================================================
   TABLES TAB - New Layout
   ============================================================================ */

/* Tables Search Bar */
.tables-search-bar {
  position: relative;
  padding: 10px 16px;
  background: #16213e;
  border-bottom: 1px solid #4a4a6a;
  flex-shrink: 0;
  z-index: 10;
}

.tables-search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.tables-search-input:focus {
  border-color: #e94560;
}

.tables-search-input::placeholder {
  color: #8888aa;
}

/* Tables Search Results Dropdown */
.tables-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  max-height: 280px;
  overflow-y: auto;
  background: #16213e;
  border: 1px solid #4a4a6a;
  border-top: none;
  border-radius: 0 0 4px 4px;
  list-style: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tables-search-results.active {
  display: block;
}

.tables-search-results li {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #2a2a4a;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tables-search-results li:last-child {
  border-bottom: none;
}

.tables-search-results li:hover,
.tables-search-results li.highlighted {
  background: #0f3460;
}

.tables-search-results li .result-abbr {
  font-weight: bold;
  color: #e94560;
  min-width: 80px;
  font-size: 13px;
}

.tables-search-results li .result-name {
  flex: 1;
  font-size: 13px;
  color: #ccc;
}

.tables-search-results li .result-type {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: bold;
  flex-shrink: 0;
}

.tables-search-results li .result-type.standard {
  background: #1a5276;
  color: #85c1e9;
}

.tables-search-results li .result-type.optional {
  background: #6c3461;
  color: #d2b4de;
}

.tables-search-results li .result-page {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}

/* No results message */
.tables-search-results .no-results {
  padding: 12px;
  text-align: center;
  color: #888;
  font-style: italic;
  cursor: default;
}

.tables-search-results .no-results:hover {
  background: transparent;
}

/* Tables Grid */
.tables-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0));
}

.tables-empty {
  width: 100%;
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 16px;
}

.tables-empty p {
  margin-bottom: 8px;
}

/* Table Viewer Card */
.table-viewer {
  position: relative;
  width: 100%;
  background: #16213e;
  border: 1px solid #4a4a6a;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

.table-viewer:hover {
  border-color: #e94560;
  box-shadow: 0 2px 12px rgba(233, 69, 96, 0.3);
}

.table-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #0f1a30;
  border-bottom: 1px solid #4a4a6a;
  flex-shrink: 0;
}

.table-viewer-title {
  font-size: 13px;
  font-weight: bold;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 10px;
}

.table-viewer-title .title-abbr {
  color: #e94560;
}

.table-viewer-title .title-name {
  color: #ccc;
}

.table-viewer-header .title-page {
  font-size: 11px;
  color: #888;
  margin-right: 10px;
  flex-shrink: 0;
}

.table-viewer-close {
  background: none;
  border: none;
  color: #e94560;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.table-viewer-close:hover {
  background: #e94560;
  color: #fff;
}

.table-viewer-iframe {
  width: 100%;
  flex: 1;
  border: none;
  background: #222;
  min-height: 350px;
}

.table-viewer-pdf-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.table-viewer-fallback {
  padding: 10px 12px;
  border-top: 1px solid #2a2a4a;
  background: #0f1a30;
  color: #9aa0b4;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-viewer-open-link {
  display: inline-block;
  color: #fff;
  background: #e94560;
  text-decoration: none;
  font-weight: 700;
  border-radius: 4px;
  padding: 6px 10px;
}

/* Scrollbar Styling */
.tables-search-results::-webkit-scrollbar,
.tables-grid::-webkit-scrollbar {
  width: 8px;
}

.tables-search-results::-webkit-scrollbar-track,
.tables-grid::-webkit-scrollbar-track {
  background: #1a1a2e;
}

.tables-search-results::-webkit-scrollbar-thumb,
.tables-grid::-webkit-scrollbar-thumb {
  background: #4a4a6a;
  border-radius: 4px;
}

.tables-search-results::-webkit-scrollbar-thumb:hover,
.tables-grid::-webkit-scrollbar-thumb:hover {
  background: #6a6a8a;
}

/* ============================================================================
   CREATURES TAB
   ============================================================================ */

/* Creatures Search Bar */
.creatures-search-bar {
  position: relative;
  padding: 10px 16px;
  background: #16213e;
  border-bottom: 1px solid #4a4a6a;
  flex-shrink: 0;
  z-index: 10;
}

.creatures-search-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.creatures-search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.clear-all-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  background: #c73a52;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.clear-all-btn:hover {
  background: #a82d42;
}

.creatures-search-input:focus {
  border-color: #e94560;
}

.creatures-search-input::placeholder {
  color: #8888aa;
}

/* Creatures Search Results Dropdown */
.creatures-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  max-height: 280px;
  overflow-y: auto;
  background: #16213e;
  border: 1px solid #4a4a6a;
  border-top: none;
  border-radius: 0 0 4px 4px;
  list-style: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.creatures-search-results.active {
  display: block;
}

.creatures-search-results li {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #2a2a4a;
  transition: background 0.15s;
  font-size: 13px;
  color: #ccc;
}

.creatures-search-results li:last-child {
  border-bottom: none;
}

.creatures-search-results li:hover,
.creatures-search-results li.highlighted {
  background: #0f3460;
  color: #fff;
}

/* No results message */
.creatures-search-results .no-results {
  padding: 12px;
  text-align: center;
  color: #888;
  font-style: italic;
  cursor: default;
}

.creatures-search-results .no-results:hover {
  background: transparent;
}

/* Creatures Grid */
.creatures-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0));
}

.creatures-empty {
  width: 100%;
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 16px;
}

.creatures-empty p {
  margin-bottom: 8px;
}

/* Creature Card */
.creature-card {
  position: relative;
  width: 360px;
  background: #16213e;
  border: 1px solid #4a4a6a;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.creature-card:hover {
  border-color: #e94560;
  box-shadow: 0 2px 12px rgba(233, 69, 96, 0.3);
}

.creature-card img {
  width: 100%;
  height: auto;
  display: block;
}

.creature-card-label {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: bold;
  color: #ccc;
  text-align: center;
  background: #0f1a30;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Creature HP and Damage Row */
.creature-hp-damage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #0f1a30;
  border-top: 1px solid #4a4a6a;
}

/* Creature HP Container */
.creature-hp-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.creature-hp-label {
  font-size: 12px;
  font-weight: bold;
  color: #e94560;
  text-transform: uppercase;
}

.creature-hp-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.creature-hp-btn.decrease {
  background: #c0392b;
  color: #fff;
}

.creature-hp-btn.decrease:hover {
  background: #e74c3c;
}

.creature-hp-btn.increase {
  background: #27ae60;
  color: #fff;
}

.creature-hp-btn.increase:hover {
  background: #2ecc71;
}

.creature-hp-btn:active {
  transform: scale(0.95);
}

.creature-hp-value {
  min-width: 60px;
  padding: 6px 12px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  background: #2a2a4a;
  border-radius: 4px;
  text-align: center;
}

.creature-hp-value.bloodied {
  background: #d35400;
}

.creature-hp-value.critical {
  background: #c0392b;
  animation: pulse 1s infinite;
}

.creature-hp-value.dead {
  background: #7f8c8d;
  color: #bdc3c7;
  text-decoration: line-through;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Creature Damage Input Container */
.creature-damage-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.creature-damage-input {
  width: 60px;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.creature-damage-input:focus {
  border-color: #e94560;
}

.creature-damage-input::placeholder {
  color: #8888aa;
  font-size: 12px;
}

/* Hide number input spinners */
.creature-damage-input::-webkit-outer-spin-button,
.creature-damage-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.creature-damage-input[type=number] {
  -moz-appearance: textfield;
}

.creature-damage-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: #c0392b;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.creature-damage-btn:hover {
  background: #e74c3c;
}

.creature-damage-btn:active {
  transform: scale(0.95);
}

/* Creature search result HP badge */
.creature-result-name {
  flex: 1;
}

.creature-result-hp {
  font-size: 11px;
  color: #e94560;
  background: rgba(233, 69, 96, 0.15);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: bold;
}

.creature-card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.7);
  color: #e94560;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
}

.creature-card:hover .creature-card-remove {
  opacity: 1;
}

.creature-card-remove:hover {
  background: rgba(233, 69, 96, 0.9);
  color: #fff;
}

/* Scrollbar for creatures grid */
.creatures-grid::-webkit-scrollbar {
  width: 8px;
}

.creatures-grid::-webkit-scrollbar-track {
  background: #1a1a2e;
}

.creatures-grid::-webkit-scrollbar-thumb {
  background: #4a4a6a;
  border-radius: 4px;
}

.creatures-grid::-webkit-scrollbar-thumb:hover {
  background: #6a6a8a;
}

/* Scrollbar for creatures search results */
.creatures-search-results::-webkit-scrollbar {
  width: 8px;
}

.creatures-search-results::-webkit-scrollbar-track {
  background: #1a1a2e;
}

.creatures-search-results::-webkit-scrollbar-thumb {
  background: #4a4a6a;
  border-radius: 4px;
}

.creatures-search-results::-webkit-scrollbar-thumb:hover {
  background: #6a6a8a;
}

/* ============================================================================
   ROUNDS AND CHARACTER NOTES ROW
   ============================================================================ */

.rounds-notes-row {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: #16213e;
  border-bottom: 1px solid #4a4a6a;
  flex-shrink: 0;
  align-items: center;
}

/* Rounds Tracker (updated for row layout) */
.rounds-tracker {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.rounds-header {
  font-size: 14px;
  font-weight: bold;
  color: #e94560;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: center;
}

.rounds-dice-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rounds-dice {
  width: 44px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0f3460;
  border: 2px solid #4a4a6a;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.dice-number {
  font-size: 16px;
  font-weight: bold;
  color: #ccc;
}

.dice-modifier {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.rounds-dice:hover {
  border-color: #e94560;
  background: #1a4a7a;
}

.rounds-dice.active {
  background: #e94560;
  border-color: #e94560;
  box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.rounds-dice.active .dice-number,
.rounds-dice.active .dice-modifier {
  color: #fff;
}

/* Character Notes */
.character-notes {
  flex: 1;
  min-width: 0;
}

.character-notes-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.character-notes-header {
  font-size: 14px;
  font-weight: bold;
  color: #e94560;
  text-transform: uppercase;
  text-align: left;
}

.character-notes-toggle {
  display: none;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: #0f3460;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
}

.character-notes-toggle:hover {
  border-color: #e94560;
}

.character-hp-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.character-hp-label {
  font-size: 12px;
  font-weight: bold;
  color: #e94560;
  text-transform: uppercase;
}

.character-max-hp-input {
  width: 64px;
  height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.character-max-hp-input:focus {
  border-color: #e94560;
}

.character-max-hp-input::placeholder {
  color: #666;
}

.character-max-hp-input::-webkit-outer-spin-button,
.character-max-hp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.character-max-hp-input[type=number] {
  -moz-appearance: textfield;
}

.character-hp-adjust-input {
  width: 68px;
  height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.character-hp-adjust-input:focus {
  border-color: #e94560;
}

.character-hp-adjust-input::placeholder {
  color: #666;
}

.character-hp-adjust-input::-webkit-outer-spin-button,
.character-hp-adjust-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.character-hp-adjust-input[type=number] {
  -moz-appearance: textfield;
}

.character-hp-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.character-hp-btn.decrease {
  background: #c0392b;
  color: #fff;
}

.character-hp-btn.decrease:hover {
  background: #e74c3c;
}

.character-hp-btn.increase {
  background: #27ae60;
  color: #fff;
}

.character-hp-btn.increase:hover {
  background: #2ecc71;
}

.character-hp-btn:active {
  transform: scale(0.95);
}

.character-hp-value {
  min-width: 60px;
  padding: 6px 12px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  background: #2a2a4a;
  border-radius: 4px;
  text-align: center;
}

.character-notes-content {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Notes Section Common Styles */
.notes-section {
  flex: 1;
  min-width: 200px;
}

.notes-section-header {
  font-size: 12px;
  font-weight: bold;
  color: #85c1e9;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-align: center;
  padding-bottom: 4px;
  border-bottom: 1px solid #4a4a6a;
}

.notes-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Maneuvers Section */
.maneuver-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.maneuver-dice {
  display: flex;
  gap: 3px;
}

.die-input {
  width: 28px;
  height: 28px;
  padding: 2px;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.die-input:focus {
  border-color: #e94560;
}

.die-input::-webkit-outer-spin-button,
.die-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.die-input[type=number] {
  -moz-appearance: textfield;
}

.die-input::placeholder {
  font-size: 10px;
  color: #666;
}

.maneuver-name {
  flex: 1;
  min-width: 60px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.maneuver-name:focus {
  border-color: #e94560;
}

.maneuver-name::placeholder {
  color: #666;
}

.maneuver-damage {
  width: 60px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.maneuver-damage:focus {
  border-color: #e94560;
}

.maneuver-damage::placeholder {
  color: #666;
}

/* Armor Section */
.armor-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.armor-name {
  width: 95px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.armor-name:focus {
  border-color: #e94560;
}

.armor-name::placeholder {
  color: #666;
}

.armor-effect {
  flex: 1;
  min-width: 35px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
}

.armor-effect:focus {
  border-color: #e94560;
}

.armor-effect::placeholder {
  color: #666;
}

.armor-dice {
  display: flex;
  gap: 3px;
}

/* Additional Notes Section */
.additional-notes-textarea {
  width: 100%;
  min-height: 80px;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
  font-family: inherit;
}

.additional-notes-textarea:focus {
  border-color: #e94560;
}

.additional-notes-textarea::placeholder {
  color: #666;
}

/* ============================================================================
   TABLET / ANDROID RESPONSIVE IMPROVEMENTS
   ============================================================================ */

@media (min-width: 480px) and (max-width: 1024px) {
  .tab-btn {
    flex: 1;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 14px;
  }

  .tables-search-bar,
  .creatures-search-bar {
    padding: 12px;
  }

  .tables-search-input,
  .creatures-search-input,
  .clear-all-btn,
  .character-max-hp-input,
  .character-hp-adjust-input,
  .maneuver-name,
  .maneuver-damage,
  .armor-name,
  .armor-effect,
  .additional-notes-textarea,
  .die-input,
  .creature-damage-input {
    font-size: 14px;
  }

  .tables-grid,
  .creatures-grid {
    padding: 12px;
    gap: 12px;
  }

  .table-viewer {
    min-height: 590px;
  }

  .table-viewer-iframe {
    min-height: 390px;
  }

  .creature-card img {
    width: 90%;
    margin: 4px auto;
    height: auto;
  }

  .creature-card {
    width: 320px;
    max-width: calc(50% - 12px);
    height: auto;
    min-height: 0;
  }

  .creature-card-label {
    padding: 6px 8px;
    font-size: 13px;
  }

  .creature-hp-damage-row {
    gap: 6px;
    padding: 6px 8px;
  }

  .creature-hp-value {
    min-width: 52px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .creature-damage-input {
    width: 50px;
    padding: 5px 6px;
  }

  .creature-hp-btn,
  .character-hp-btn {
    width: 38px;
    height: 28px;
    font-size: 14px;
  }

  .rounds-notes-row {
    flex-direction: column;
    align-items: stretch;
  }

  .rounds-tracker {
    width: 100%;
  }

  .character-notes-content {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .maneuvers-section,
  .armor-section {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    max-width: calc(50% - 6px);
  }

  .additional-notes-section {
    width: 100%;
    flex: 1 1 100%;
  }

  .character-notes-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .character-notes-content.is-collapsed {
    display: none;
  }

  .notes-section {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .tables-search-bar,
  .creatures-search-bar,
  .tables-grid,
  .creatures-grid {
    padding-left: 10px;
    padding-right: 10px;
  }

  .tables-search-input,
  .creatures-search-input,
  .clear-all-btn,
  .character-max-hp-input,
  .character-hp-adjust-input,
  .maneuver-name,
  .maneuver-damage,
  .armor-name,
  .armor-effect,
  .additional-notes-textarea,
  .die-input,
  .creature-damage-input {
    font-size: 16px;
  }

  .creatures-search-input-wrapper {
    flex-wrap: wrap;
  }

  .clear-all-btn {
    width: 100%;
  }

  .creature-hp-damage-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .creature-hp-container,
  .creature-damage-container {
    justify-content: space-between;
    width: 100%;
  }

  .creature-damage-input {
    flex: 1;
    min-width: 0;
  }

  .creature-damage-btn {
    min-height: 21px;
  }

  .table-viewer-header .title-page {
    display: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .creature-card-remove {
    opacity: 1;
    width: 34px;
    height: 34px;
    line-height: 34px;
    font-size: 20px;
    background: rgba(0, 0, 0, 0.82);
  }

  .table-viewer-close,
  .clear-all-btn,
  .creature-hp-btn,
  .character-hp-btn,
  .creature-damage-btn {
    min-height: 21px;
  }
}
