@font-face {
  font-family: 'Destroy Earth';
  src: url('assets/fonts/destroy-earth.bb.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Smash Brush';
  src: url('assets/fonts/Smash\ Brush.otf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Nusaliver';
  src: url('assets/fonts/nusaliver.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  background: url('assets/paper-texture.png') center center / cover no-repeat fixed;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: pan-y pinch-zoom;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: contain;
}

.sidebar {
  width: 320px;
  background: rgba(30, 30, 30, 0.92);
  border-right: 2px solid rgba(200, 150, 100, 0.4);
  padding: 32px 28px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.logo {
  width: 80%;
  max-width: 220px;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.8));
}

.sidebar h1 {
  font-family: 'Destroy Earth', sans-serif;
  font-size: 26px;
  margin: 0;
  color: #f5e6d3;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  text-align: center;
  letter-spacing: 1px;
  line-height: 1.3;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.controls button {
  padding: 16px 20px 16px 56px;
  cursor: pointer;
  background: linear-gradient(135deg, #3a2a1a 0%, #2a1a0a 100%);
  border: 2px solid rgba(200, 150, 100, 0.5);
  border-radius: 6px;
  font-family: 'Destroy Earth', sans-serif;
  font-size: 18px;
  color: #f5e6d3;
  transition: all 0.2s;
  text-align: left;
  position: relative;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.5px;
}

.controls button::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: url('assets/d20.png') center center / contain no-repeat;
  opacity: 0.8;
}

.controls button:hover {
  background: linear-gradient(135deg, #4a3a2a 0%, #3a2a1a 100%);
  border-color: rgba(220, 170, 120, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.controls button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-color: rgba(80, 80, 80, 0.3);
}

.controls button:disabled:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-color: rgba(80, 80, 80, 0.3);
}

.controls button:disabled::before {
  display: none;
}

.controls button:hover::before {
  opacity: 1;
  transform: translateY(-50%) rotate(20deg);
}

.controls button:active {
  background: linear-gradient(135deg, #2a1a0a 0%, #1a0a00 100%);
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #f5e6d3;
  font-family: 'Destroy Earth', sans-serif;
  letter-spacing: 0.5px;
}

.mode select {
  padding: 10px;
  border: 2px solid rgba(200, 150, 100, 0.5);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  background: rgba(30, 30, 30, 0.8);
  color: #f5e6d3;
  font-family: 'Destroy Earth', sans-serif;
}

.mode select:hover {
  border-color: rgba(220, 170, 120, 0.7);
}

.divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(200, 150, 100, 0.4), transparent);
  margin: 8px 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 2px solid rgba(200, 150, 100, 0.3);
}

.sidebar-footer p {
  font-family: 'Smash Brush', sans-serif;
  font-size: 14px;
  color: rgba(245, 230, 211, 0.7);
  text-align: center;
  margin: 0;
  line-height: 1.4;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.mode-btn {
  background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
  border-color: rgba(150, 150, 150, 0.3);
  opacity: 1;
  transition: all 0.3s;
}

.mode-btn.active[data-mode="fantasy"] {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-color: rgba(100, 100, 100, 0.3);
  opacity: 0.4;
  cursor: default;
}

.mode-btn.active[data-mode="scifi"] {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-color: rgba(100, 100, 100, 0.3);
  opacity: 0.4;
  cursor: default;
}

.mode-btn:not(.active):hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.mode-btn.active:hover {
  opacity: 0.4;
  transform: none;
}

.toggle-btn {
  background: linear-gradient(135deg, #2a4a2a 0%, #1a3a1a 100%) !important;
  border-color: rgba(150, 200, 150, 0.5) !important;
}

.toggle-btn:hover {
  background: linear-gradient(135deg, #3a5a3a 0%, #2a4a2a 100%) !important;
  border-color: rgba(170, 220, 170, 0.7) !important;
}

.print-btn {
  background: linear-gradient(135deg, #4a3a2a 0%, #3a2a1a 100%) !important;
  border-color: rgba(200, 150, 100, 0.6) !important;
}

.print-btn::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23f5e6d3" stroke-width="2"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3"/></svg>') center center / contain no-repeat;
  opacity: 0.8;
}

.print-btn:hover {
  background: linear-gradient(135deg, #5a4a3a 0%, #4a3a2a 100%) !important;
  border-color: rgba(220, 170, 120, 0.8) !important;
}

.upload-btn-customize {
  width: 100%;
  padding: 8px !important;
  background: rgba(50, 40, 30, 0.8);
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 4px;
  color: #f5e6d3;
  font-family: 'Destroy Earth', serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center !important;
  user-select: none;
  position: relative;
  display: block;
}

.upload-btn-customize::before {
  display: none !important;
}

.upload-btn-customize:hover {
  background: rgba(60, 50, 40, 0.9);
  border-color: rgba(220, 170, 120, 0.6);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: rgba(30, 30, 30, 0.98);
  border: 2px solid rgba(200, 150, 100, 0.6);
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.modal-content h2 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 20px 0;
  font-size: 20px;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.modal-content h3 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 10px 0;
  font-size: 14px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.modal-label {
  display: block;
  margin-bottom: 16px;
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  font-size: 12px;
}

.modal-label input,
.modal-label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 4px;
  color: #f5e6d3;
  font-family: 'Smash Brush', sans-serif;
  font-size: 12px;
}

.modal-label textarea {
  resize: vertical;
  min-height: 40px;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-grid label {
  display: flex;
  align-items: center;
  font-family: 'Smash Brush', sans-serif;
  color: #f5e6d3;
  font-size: 11px;
  cursor: pointer;
}

.modal-grid input[type="checkbox"] {
  margin-right: 6px;
  cursor: pointer;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 4px;
  font-family: 'Destroy Earth', serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn.confirm {
  background: linear-gradient(135deg, #2a4a2a 0%, #1a3a1a 100%);
  border: 1px solid rgba(100, 200, 100, 0.6);
  color: #d0f0d0;
}

.modal-btn.confirm:hover {
  background: linear-gradient(135deg, #3a5a3a 0%, #2a4a2a 100%);
  border-color: rgba(120, 220, 120, 0.8);
}

.modal-btn.cancel {
  background: linear-gradient(135deg, #4a2a2a 0%, #3a1a1a 100%);
  border: 1px solid rgba(200, 100, 100, 0.6);
  color: #f0d0d0;
}

.modal-btn.cancel:hover {
  background: linear-gradient(135deg, #5a3a3a 0%, #4a2a2a 100%);
  border-color: rgba(220, 120, 120, 0.8);
}

/* Guided Character Creation Modal */
.modal-wide {
  max-width: 90%;
  width: 1200px;
  max-height: 90vh;
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(200, 150, 100, 0.3);
}

.modal-step-indicator {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 15px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(100, 100, 100, 0.5);
  border: 2px solid rgba(150, 150, 150, 0.3);
  cursor: pointer;
  transition: all 0.3s;
}

.step-dot.active {
  background: rgba(200, 150, 100, 0.8);
  border-color: rgba(220, 170, 120, 0.8);
  box-shadow: 0 0 8px rgba(200, 150, 100, 0.5);
}

.step-dot.completed {
  background: rgba(100, 200, 100, 0.7);
  border-color: rgba(120, 220, 120, 0.7);
}

.modal-body-split {
  display: flex;
  gap: 24px;
  max-height: calc(90vh - 200px);
}

.modal-left {
  flex: 1;
  padding-right: 12px;
  max-width: 100%;
}

.modal-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(200, 150, 100, 0.3);
  padding-left: 24px;
}

.modal-right h4 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 12px 0;
  font-size: 14px;
  text-align: center;
}

.portrait-preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 20, 0.5);
  border: 2px dashed rgba(200, 150, 100, 0.3);
  border-radius: 8px;
  min-height: 400px;
  position: relative;
}

.portrait-preview-placeholder {
  color: rgba(245, 230, 211, 0.5);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.portrait-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.preview-sheet {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-sheet-bg {
  width: 100%;
  height: auto;
  object-fit: contain;
}

#createPreviewOverlays {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.create-step {
  display: none;
}

.create-step.active {
  display: block;
}

.create-step h3 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 8px 0;
  font-size: 16px;
}

.step-description {
  color: rgba(245, 230, 211, 0.7);
  font-size: 11px;
  margin: 0 0 16px 0;
  font-style: italic;
}

.mode-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  padding: 4px;
}

.mode-card {
  background: rgba(40, 35, 30, 0.8);
  border: 2px solid rgba(100, 80, 60, 0.5);
  border-radius: 8px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.mode-card:hover {
  border-color: rgba(200, 150, 100, 0.6);
  background: rgba(50, 45, 40, 0.9);
}

.mode-card.selected {
  border-color: rgba(220, 170, 120, 0.9);
  background: rgba(60, 50, 40, 0.9);
  box-shadow: 0 0 16px rgba(200, 150, 100, 0.5);
}

.mode-card h4 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 8px 0;
  font-size: 18px;
}

.mode-card p {
  font-size: 11px;
  color: rgba(245, 230, 211, 0.7);
  margin: 0;
  line-height: 1.4;
}

.lifeform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.lifeform-card {
  background: rgba(40, 35, 30, 0.8);
  border: 2px solid rgba(100, 80, 60, 0.5);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.lifeform-card:hover {
  border-color: rgba(200, 150, 100, 0.6);
  background: rgba(50, 45, 40, 0.9);
}

.lifeform-card.selected {
  border-color: rgba(220, 170, 120, 0.9);
  background: rgba(60, 50, 40, 0.9);
  box-shadow: 0 0 12px rgba(200, 150, 100, 0.4);
}

.modal-btn-centered {
  display: block;
  margin: 0 auto 20px auto;
  padding: 12px 24px;
  background: rgba(50, 40, 30, 0.8);
  border: 2px dashed rgba(200, 150, 100, 0.5);
  border-radius: 8px;
  color: #f5e6d3;
  font-family: 'Destroy Earth', serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn-centered:hover {
  background: rgba(60, 50, 40, 0.9);
  border-color: rgba(220, 170, 120, 0.6);
}

.custom-inline-form {
  background: rgba(30, 25, 20, 0.9);
  border: 2px solid rgba(200, 150, 100, 0.5);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.custom-inline-form h4 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 16px 0;
  font-size: 14px;
  text-align: center;
}

.inline-form-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.inline-form-buttons .modal-btn {
  flex: 0 0 auto;
  min-width: 120px;
}

.quote {
  font-size:x-large 
}

.starting-ability {
  width: 40% !important;
  line-height: 1.35 !important;
}

.lifeform-card h4 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 8px 0;
  font-size: 15px;
}

.lifeform-bonuses {
  font-size: 11px;
  color: rgba(100, 200, 100, 0.9);
  margin: 6px 0;
  font-weight: bold;
}

.lifeform-flavor {
  font-size: 10px;
  color: rgba(245, 230, 211, 0.6);
  margin: 8px 0;
  font-style: italic;
  line-height: 1.4;
}

.lifeform-abilities {
  font-size: 10px;
  color: rgba(200, 180, 150, 0.9);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(100, 80, 60, 0.3);
  line-height: 1.4;
}

.lifeform-abilities-label {
  font-weight: bold;
  color: rgba(220, 170, 120, 0.9);
  display: block;
  margin-bottom: 4px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.option-card {
  background: rgba(40, 35, 30, 0.8);
  border: 2px solid rgba(100, 80, 60, 0.5);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.option-card:hover {
  border-color: rgba(200, 150, 100, 0.6);
  background: rgba(50, 45, 40, 0.9);
}

.option-card.selected {
  border-color: rgba(220, 170, 120, 0.9);
  background: rgba(60, 50, 40, 0.9);
  box-shadow: 0 0 12px rgba(200, 150, 100, 0.4);
}

.option-card h4 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 6px 0;
  font-size: 13px;
}

.option-card p {
  font-size: 10px;
  color: rgba(245, 230, 211, 0.7);
  margin: 0;
  line-height: 1.3;
}

.stat-effort-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 12px;
}

.stat-column h4,
.effort-column h4 {
  font-family: 'Destroy Earth', serif;
  color: #f5e6d3;
  margin: 0 0 10px 0;
  font-size: 13px;
}

.stat-column label,
.effort-column label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 11px;
  color: #f5e6d3;
}

.stat-column input,
.effort-column input {
  width: 60px;
  padding: 4px 8px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 4px;
  color: #f5e6d3;
  font-size: 11px;
  text-align: center;
}

.points-total {
  text-align: center;
  font-family: 'Destroy Earth', serif;
  font-size: 14px;
  color: #f5e6d3;
  padding: 8px;
  background: rgba(40, 35, 30, 0.6);
  border-radius: 4px;
  margin-top: 8px;
}

.modal-btn-upload,
.modal-btn-secondary {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: rgba(50, 40, 30, 0.8);
  border: 1px solid rgba(200, 150, 100, 0.5);
  border-radius: 4px;
  color: #f5e6d3;
  font-family: 'Destroy Earth', serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn-upload:hover,
.modal-btn-secondary:hover {
  background: rgba(60, 50, 40, 0.9);
  border-color: rgba(220, 170, 120, 0.6);
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(200, 150, 100, 0.3);
}

.modal-footer .modal-btn {
  flex: 0 0 auto;
  min-width: 120px;
}

.create-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #2a4a4a 0%, #1a3a3a 100%);
  border: 1px solid rgba(100, 200, 200, 0.6);
  border-radius: 4px;
  color: #d0f0f0;
  font-family: 'Destroy Earth', serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.create-btn:hover {
  background: linear-gradient(135deg, #3a5a5a 0%, #2a4a4a 100%);
  border-color: rgba(120, 220, 220, 0.8);
}

.customize-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid rgba(200, 150, 100, 0.3);
  border-radius: 4px;
  margin-top: 8px;
  max-height: 450px;
  overflow-y: auto;
}

.custom-label.compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: #f5e6d3;
  font-family: 'Destroy Earth', sans-serif;
  margin-top: 10px;
}

.custom-label.compact:first-child {
  margin-top: 0;
}

.custom-label.compact input,
.custom-label.compact select {
  padding: 6px;
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 3px;
  background: rgba(40, 40, 40, 0.8);
  color: #f5e6d3;
  font-size: 12px;
  font-family: Arial, sans-serif;
}

.divider-thin {
  height: 1px;
  background: rgba(200, 150, 100, 0.3);
  margin: 4px 0;
}

.collapsible-header {
  padding: 8px;
  background: rgba(50, 40, 30, 0.8);
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 4px;
  font-family: 'Destroy Earth', sans-serif;
  font-size: 12px;
  color: #f5e6d3;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.collapsible-header:hover {
  background: rgba(60, 50, 40, 0.9);
  border-color: rgba(220, 170, 120, 0.6);
}

.collapsible-content {
  display: none;
  padding: 8px;
  background: rgba(30, 30, 30, 0.4);
  border-radius: 4px;
  margin-top: -4px;
}

.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.compact-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #f5e6d3;
  font-family: 'Destroy Earth', sans-serif;
}

.compact-grid label input {
  flex: 1;
  padding: 4px;
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 3px;
  background: rgba(40, 40, 40, 0.8);
  color: #f5e6d3;
  font-size: 12px;
  width: 45px;
}

.compact-total {
  grid-column: span 2;
  font-size: 13px;
  padding: 6px;
  background: rgba(60, 40, 20, 0.6);
  border: 1px solid rgba(200, 150, 100, 0.5);
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
  font-family: 'Destroy Earth', sans-serif;
  color: #f5e6d3;
}

.type-field {
  font-size:large;
  width: 40% !important;
}

.spell-hint {
  font-size: 10px;
  color: #aaa;
  font-style: italic;
  text-align: center;
  margin-top: 4px;
}

.custom-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #f5e6d3;
  font-family: 'Destroy Earth', sans-serif;
}

.custom-label input,
.custom-label select {
  padding: 8px;
  border: 1px solid rgba(200, 150, 100, 0.4);
  border-radius: 4px;
  background: rgba(40, 40, 40, 0.8);
  color: #f5e6d3;
  font-size: 13px;
  font-family: Arial, sans-serif;
}

.custom-label select[multiple] {
  min-height: 80px;
}

.custom-label input:focus,
.custom-label select:focus {
  outline: none;
  border-color: rgba(220, 170, 120, 0.7);
  background: rgba(50, 50, 50, 0.9);
}

.apply-btn {
  padding: 10px !important;
  background: linear-gradient(135deg, #2a4a2a 0%, #1a3a1a 100%) !important;
  border: 2px solid rgba(150, 200, 150, 0.5) !important;
  margin-top: 4px;
}

.apply-btn::before {
  display: none !important;
}

.apply-btn:hover {
  background: linear-gradient(135deg, #3a5a3a 0%, #2a4a2a 100%) !important;
  border-color: rgba(170, 220, 170, 0.7) !important;
}

.starting-loot {
  line-height: 1.45 !important;
  width: 35% !important;
}

main {
  flex: 1;
  padding: 16px;
  padding-left: 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* Sheet */
.sheet {
  position: relative;
  width: min(980px, 98vw);
  aspect-ratio: 8.5 / 11;
  background: white;
  border: 1px solid #ddd;
  overflow: hidden;
  transition: transform 0.15s ease;
}

/* Poof animation for rerolls */
@keyframes poof-sprite {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}

.sheet.reroll-poof {
  overflow: visible !important;
}

.overlay.reroll-poof {
  overflow: visible !important;
  z-index: 10000;
}

/* Bigger animation for full sheet reroll */
.sheet.reroll-poof::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background-image: url('assets/icrpg-poof.png');
  background-size: 900% auto;
  background-repeat: no-repeat;
  background-position: 0 center;
  animation: poof-sprite 0.6s steps(8) forwards;
  pointer-events: none;
  z-index: 10001;
}

/* Standard animation for individual overlays */
.overlay.reroll-poof::after {
  content: '';
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background-image: url('assets/icrpg-poof.png');
  background-size: 900% auto;
  background-repeat: no-repeat;
  background-position: 0 center;
  animation: poof-sprite 0.6s steps(8) forwards;
  pointer-events: none;
  z-index: 10001;
}

/* Portrait animation needs to be bigger since portraits are larger */
.overlay.portrait.reroll-poof::after {
  width: 200px;
  height: 200px;
  top: 50%;
}

/* Force desktop sheet size during PDF export */
body.force-desktop .sheet {
  width: 980px !important;
  aspect-ratio: 8.5 / 11 !important;
  position: relative !important;
}

body.force-desktop .sheet-bg {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

body.force-desktop main {
  padding: 16px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

body.force-desktop .overlay {
  font-family: "Smash Brush", sans-serif !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6) !important;
}

/* Force desktop styling during PDF export - override all mobile styles */
body.force-desktop .overlay.text {
  font-size: 16px !important;
}

body.force-desktop .overlay.med {
  font-size: 24px !important;
}

body.force-desktop .overlay.big {
  font-size: 36px !important;
  font-family: 'Nusaliver', sans-serif !important;
}

body.force-desktop .overlay.block {
  font-size: 16px !important;
  line-height: 1.15 !important;
  width: 32% !important;
  white-space: pre-line !important;
}

body.force-desktop .gear-list {
  font-size: 16px !important;
  line-height: 1.47 !important;
  width: 42% !important;
}

body.force-desktop #fieldLifeformAbility {
  font-size: 16px !important;
  line-height: 1.7 !important;
  width: 35% !important;
}

body.force-desktop #fieldQuote {
  font-size: 18px !important;
  line-height: 1.15 !important;
  width: 32% !important;
}

body.force-desktop .INTspell-list {
  font-size: 16px !important;
  line-height: 1.5 !important;
}

body.force-desktop .WISspell-list {
  font-size: 16px !important;
  line-height: 1.30 !important;
}

body.force-desktop #fieldStartingLoot {
  font-size: 16px !important;
  line-height: 1.4 !important;
  width: 32% !important;
}

body.force-desktop #fieldStartingAbility {
  font-size: 16px !important;
  line-height: 1.15 !important;
  width: 32% !important;
}

body.force-desktop #fieldType {
  font-size: 24px !important;
  line-height: 1.15 !important;
  width: 50% !important;
}

body.force-desktop #fieldType .item-detail {
  display: block;
  font-size: 12px !important;
  line-height: 1.3 !important;
  margin-top: 6px;
  opacity: 0.9;
}

body.force-desktop .overlay.portrait {
  width: 33% !important;
  height: 33% !important;
  object-fit: contain !important;
  object-position: center !important;
  border-radius: 10px !important;
}

body.force-desktop .overlay.heart {
  width: 22px !important;
  height: 22px !important;
  background: url('assets/red-ring.png') center center / contain no-repeat !important;
}

body.force-desktop .overlay.heart::after {
  content: none !important;
}



.sheet-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Export loading overlay */
.export-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

.export-overlay.active {
  display: flex;
}

.export-content {
  text-align: center;
  color: #f5e6d3;
  font-family: 'Destroy Earth', sans-serif;
}

/* Tooltip styles */
.tooltip {
  position: absolute;
  background: rgba(40, 30, 20, 0.98);
  color: #f5e6d3;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: 'Smash Brush', sans-serif;
  font-size: 18px;
  line-height: 1.4;
  max-width: 280px;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 2px solid #8b6f47;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tooltip-content {
  margin: 0;
}

.tooltip-content strong {
  display: block;
  margin-bottom: 4px;
  color: #d4af37;
  font-size: 16px;
  font-family: 'Destroy Earth', sans-serif;
}

.export-content p {
  font-size: 24px;
  margin-top: 20px;
  letter-spacing: 1px;
}

.dice-animation {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  background: url('assets/d20.png') center center / contain no-repeat;
  animation: rollDice 1s infinite ease-in-out;
}

@keyframes rollDice {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1); }
  75% { transform: rotate(270deg) scale(1.1); }
}

/* Mobile Warning Overlay */
.mobile-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 20, 20, 0.98);
  z-index: 100000;
  align-items: center;
  justify-content: center;
}

.mobile-warning-content {
  text-align: center;
  padding: 40px 30px;
  background: rgba(30, 30, 30, 0.95);
  border: 3px solid rgba(200, 150, 100, 0.6);
  border-radius: 16px;
  max-width: 500px;
  margin: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.warning-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  display: block;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.8));
}

.mobile-warning-content h2 {
  font-family: 'Destroy Earth', sans-serif;
  font-size: 42px;
  color: #d4af37;
  margin: 0 0 20px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 2px;
}

.mobile-warning-content p {
  font-family: 'Smash Brush', sans-serif;
  font-size: 20px;
  color: #f5e6d3;
  line-height: 1.6;
  margin: 15px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.warning-icon {
  font-size: 64px;
  margin-top: 20px;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* Show warning only on mobile/tablet */
@media (max-width: 768px) {
  .mobile-warning {
    display: flex !important;
  }
}

/* Overlay base */
.overlay {
  position: absolute;
  color: #111;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  user-select: none;
  font-family: "Smash Brush", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(200, 150, 100, 0.1);
}

.black {
  color: black;
}

.red {
  color: #d20000;
}

.gray {
  color: gray  
}

.INTspell-list {
  line-height: 1.5 !important;
}

.WISspell-list {
  line-height: 1.3 !important;
}
.gear-list {
  line-height: 1.47 !important;
  width: 42% !important;
}
/* Text sizing defaults (we’ll tune per-field later if needed) */
.overlay.text { font-size: 16px;}
.overlay.big { font-size: 40px; font-family: 'Nusaliver', sans-serif !important;}
.overlay.med { font-size: 24px;}

/* Multiline blocks */
.overlay.block {
  width: 32%;
  white-space: pre-line;
  line-height: 1.15;
  font-weight: 700;
}

#fieldLifeformAbility {
  font-size: 16px;
  line-height: 1.7;
  width: 35%;
}

/* Portrait */
.overlay.portrait {
  width: 33%;
  height: 33%;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
}

/* Heart circles (each heart is an individually placeable overlay) */
.overlay.heart {
  width: 30px;
  height: 30px;
  background: url('assets/red-ring.png') center center / contain no-repeat;
  transform: rotate(var(--rot, -6deg));
}

.overlay.heart::after {
  content: none;
}
/* ===========================
   Mobile Layout
   =========================== */
@media (max-width: 768px) {
  body:not(.force-desktop) {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding-top: max(60px, env(safe-area-inset-top));
    padding-bottom: max(25vh, calc(25vh + env(safe-area-inset-bottom)));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Mobile header */
  .sidebar {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: env(safe-area-inset-left, 0);
    right: env(safe-area-inset-right, 0);
    width: 100%;
    height: 60px;
    padding: 8px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    border-right: none;
    border-bottom: 2px solid rgba(200, 150, 100, 0.4);
    z-index: 1000;
    overflow: hidden;
  }

  .logo {
    width: 40px;
    height: 40px;
    margin: 0;
    flex-shrink: 0;
  }

  .sidebar h1 {
    font-size: 16px;
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.2;
  }

  .sidebar h1 br {
    display: none;
  }

  /* Hide controls in header */
  .sidebar .controls {
    display: none;
  }

  /* Bottom panel for controls */
  body::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(25vh + env(safe-area-inset-bottom, 0px));
    background: rgba(30, 30, 30, 0.92);
    border-top: 2px solid rgba(200, 150, 100, 0.4);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 998;
  }

  /* Create bottom controls panel */
  .controls {
    position: fixed !important;
    bottom: env(safe-area-inset-bottom, 0);
    left: env(safe-area-inset-left, 0);
    right: env(safe-area-inset-right, 0);
    height: 25vh;
    max-height: 25vh;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) 12px;
    background: transparent;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(5, 1fr);
    gap: 6px;
    overflow: hidden;
    z-index: 999;
    align-content: stretch;
  }

  /* Row 1: Mode buttons (2 columns) + Export */
  .controls #btnFantasy {
    grid-column: 1;
    grid-row: 1;
  }

  .controls #btnScifi {
    grid-column: 2;
    grid-row: 1;
  }

  .mode-btn {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    border-color: rgba(150, 150, 150, 0.3);
    opacity: 0.5;
    transition: all 0.3s;
  }

  .mode-btn.active[data-mode="fantasy"] {
    background: linear-gradient(135deg, #3a2a1a 0%, #2a1a0a 100%);
    border-color: rgba(200, 150, 100, 0.5);
    opacity: 1;
  }

  .mode-btn.active[data-mode="scifi"] {
    background: linear-gradient(135deg, #1a2a3a 0%, #0a1a2a 100%);
    border-color: rgba(100, 150, 200, 0.5);
    opacity: 1;
  }

  .mode-btn:hover {
    opacity: 0.8;
  }

  .mode-btn.active:hover {
    opacity: 1;
  }

  .mode-btn.active[data-mode="fantasy"]:hover {
    background: linear-gradient(135deg, #4a3a2a 0%, #3a2a1a 100%);
    border-color: rgba(220, 170, 120, 0.7);
  }

  .mode-btn.active[data-mode="scifi"]:hover {
    background: linear-gradient(135deg, #2a3a4a 0%, #1a2a3a 100%);
    border-color: rgba(120, 170, 220, 0.7);
  }

  .controls #btnPrint {
    grid-column: 1 / 3;
    grid-row: 2;
  }

  /* Row 3: Reroll All + Reroll Name */
  .controls #btnRerollAll {
    grid-column: 1;
    grid-row: 3;
  }

  .controls #btnRerollName {
    grid-column: 2;
    grid-row: 3;
  }

  /* Row 4: Portrait + Quote */
  .controls #btnRerollPortrait {
    grid-column: 1;
    grid-row: 4;
  }

  .controls #btnRerollQuote {
    grid-column: 2;
    grid-row: 4;
  }

  /* Row 5: Stats + Loot */
  .controls #btnRerollStats {
    grid-column: 1;
    grid-row: 5;
  }

  .controls #btnRerollLoot {
    grid-column: 2;
    grid-row: 5;
  }

  .controls .divider {
    display: none;
  }

  .controls button {
    padding: 8px 8px 8px 32px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(200, 150, 100, 0.2);
  }

  .controls button::before {
    width: 20px;
    height: 20px;
    left: 6px;
  }

  /* Main content adjustments */
  main {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    bottom: calc(25vh + env(safe-area-inset-bottom, 0px));
    left: env(safe-area-inset-left, 0);
    right: env(safe-area-inset-right, 0);
    width: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .sheet {
    width: 95%;
    max-width: 95%;
    max-height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .sheet-bg {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
  }

  /* Scale overlay elements proportionally with sheet */
  .overlay {
    font-size: min(12px, 2vw);
  }
  /* Mobile-specific text sizing */
  .overlay.text {
    font-size: 8px !important;
  }

  .overlay.med {
    font-size: 14px !important;
  }

  .overlay.big {
    font-size: 18px !important;
    font-family: 'Nusaliver', sans-serif !important;
  }

  .gear-list {
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  #fieldLifeformAbility {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  #fieldQuote {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  .INTspell-list {
    font-size: 10px !important;
    line-height: 1.45 !important;
  }

  .WISspell-list {
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  #fieldStartingLoot {
    font-size: 10px !important;
    line-height: 1.4 !important;
    width: 35% !important;
  }

  #fieldStartingLoot .item-detail {
    display: block;
    font-size: 6px !important;
    line-height: 2 !important;
    margin-top: 2px;
    opacity: 0.9;
  }

  #fieldStartingAbility {
    font-size: 10px !important;
    line-height: 1.2 !important;
    width: 40% !important;
  }

  #fieldStartingAbility .item-detail {
    display: block;
    font-size: 6px !important;
    line-height: 1.2 !important;
    margin-top: 2px;
    opacity: 0.9;
  }

  #fieldStartingAbility strong,
  #fieldStartingLoot strong {
    display: block;
    font-weight: 700;
    font-size: 7px;
    line-height: 1.1;
  }

  #fieldType {
    font-size: 14px !important;
    line-height: 1.15 !important;
    width: 50% !important;
  }

  #fieldType .item-detail {
    display: block;
    font-size: 6px !important;
    line-height: 1.2 !important;
    margin-top: 3px;
    opacity: 0.9;
  }

  /* Mobile-specific heart sizing */
  .overlay.heart {
    width: 15px !important;
    height: 15px !important;
    background: url('assets/red-ring.png') center center / contain no-repeat !important;
  }

  .overlay.heart::after {
    content: none !important;
  }

  /* Mobile-specific heart positions (adjust these as needed) */
  #fieldHeart1 {
    left: 4.7% !important;
    top: 49.6% !important;
  }

  #fieldHeart2 {
    left: 6.9% !important;
    top: 49.6% !important;
  }

  #fieldHeart3 {
    left: 8.85% !important;
    top: 49.6% !important;
  }

  #fieldHeart4 {
    left: 10.85% !important;
    top: 49.6% !important;
  }

  #fieldHeart5 {
    left: 13% !important;
    top: 49.6% !important;
  }

  /* Force desktop styling during PDF export - inside media query to override mobile styles */
  body.force-desktop,
  body.force-desktop * {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.force-desktop {
    height: auto !important;
    overflow: visible !important;
    flex-direction: row !important;
  }

  body.force-desktop main {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    padding: 16px !important;
    width: auto !important;
  }

  body.force-desktop .sheet {
    width: 980px !important;
    max-width: 980px !important;
    max-height: none !important;
  }

  body.force-desktop .overlay {
    font-size: 16px !important;
  }

  body.force-desktop .overlay.text {
    font-size: 16px !important;
  }

  body.force-desktop .overlay.med {
    font-size: 24px !important;
  }

  body.force-desktop .overlay.big {
    font-size: 36px !important;
  }

  body.force-desktop .gear-list {
    font-size: 16px !important;
    line-height: 1.47 !important;
    width: 42% !important;
  }

  body.force-desktop #fieldLifeformAbility {
    font-size: 16px !important;
    line-height: 1.7 !important;
    width: 35% !important;
  }

  body.force-desktop #fieldQuote {
    font-size: 24px !important;
    line-height: 1.15 !important;
    width: 32% !important;
  }

  body.force-desktop .INTspell-list {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }

  body.force-desktop .WISspell-list {
    font-size: 16px !important;
    line-height: 1.30 !important;
  }

  body.force-desktop #fieldStartingLoot {
    font-size: 16px !important;
    line-height: 1.4 !important;
    width: 32% !important;
  }

  body.force-desktop #fieldStartingLoot .item-detail {
    font-size: 12px !important;
    line-height: 1.3 !important;
    display: block !important;
  }

  body.force-desktop #fieldStartingAbility {
    font-size: 16px !important;
    line-height: 1.2 !important;
    width: 32% !important;
  }

  body.force-desktop #fieldStartingAbility .item-detail {
    font-size: 12px !important;
    line-height: 1.3 !important;
    display: block !important;
  }

  body.force-desktop #fieldStartingAbility strong,
  body.force-desktop #fieldStartingLoot strong {
    font-size: 16px !important;
    line-height: 1.15 !important;
  }

  body.force-desktop #fieldType {
    font-size: 24px !important;
    line-height: 1.15 !important;
    width: 50% !important;
  }

  body.force-desktop .overlay.heart {
    width: 22px !important;
    height: 22px !important;
  }

  body.force-desktop #fieldHeart1 {
    left: 4.65% !important;
    top: 49.75% !important;
  }

  body.force-desktop #fieldHeart2 {
    left: 6.8% !important;
    top: 49.75% !important;
  }

  body.force-desktop #fieldHeart3 {
    left: 9.15% !important;
    top: 49.75% !important;
  }

  body.force-desktop #fieldHeart4 {
    left: 11.15% !important;
    top: 49.75% !important;
  }

  body.force-desktop #fieldHeart5 {
    left: 13.3% !important;
    top: 49.75% !important;
  }

  body.force-desktop .overlay.portrait {
    width: 33% !important;
    height: 33% !important;
  }

  body.force-desktop .sidebar {
    display: none !important;
  }

  body.force-desktop .controls {
    display: none !important;
  }

  body.force-desktop::after {
    content: none !important;
    display: none !important;
  }

  /* Mobile tooltip improvements */
  .tooltip {
    max-width: 90vw;
    font-size: 16px;
    padding: 14px 18px;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(-5px);
  }

  .tooltip.visible {
    transform: translateX(-50%) translateY(0);
  }

  .tooltip-content strong {
    font-size: 14px;
  }
}

/* Landscape tablet optimization (768px - 1024px in landscape) */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  body {
    padding-top: 0;
    padding-bottom: 0;
  }

  .sidebar {
    width: 200px;
    padding: 16px;
    gap: 12px;
  }

  .sidebar h1 {
    font-size: 14px;
  }

  .logo {
    width: 60%;
  }

  .controls button {
    font-size: 12px;
    padding: 8px 8px 8px 36px;
  }

  main {
    flex: 1;
  }

  .sheet {
    max-width: 85%;
    max-height: 95vh;
  }
}

/* Small mobile devices (very narrow screens) */
@media (max-width: 480px) {
  body:not(.force-desktop) {
    padding-bottom: max(28vh, calc(28vh + env(safe-area-inset-bottom)));
  }

  body::after {
    height: calc(28vh + env(safe-area-inset-bottom, 0px));
  }

  .controls {
    height: 28vh;
    max-height: 28vh;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px;
    gap: 5px;
  }

  .controls button {
    font-size: 10px;
    padding: 6px 6px 6px 28px;
    min-height: 40px;
  }

  .controls button::before {
    width: 18px;
    height: 18px;
    left: 5px;
  }

  main {
    bottom: calc(28vh + env(safe-area-inset-bottom, 0px));
  }

  .sidebar h1 {
    font-size: 14px;
  }

  .logo {
    width: 36px;
    height: 36px;
  }
}
