.fp-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  flex-shrink: 0;
  pointer-events: none;
}
.fp-icon--poop {
  width: 1.3em;
  height: 1.3em;
  vertical-align: -0.3em;
}
.tool-btn .fp-icon,
.size-btn .fp-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
.action-btn .fp-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
.flag-btn .fp-icon {
  width: 13px;
  height: 13px;
  vertical-align: middle;
}
.already-rated .fp-icon {
  width: 13px;
  height: 13px;
  vertical-align: middle;
  color: #4a8a4a;
}

#fp-select,
#paint-wrapper,
#gallery-wrapper {
  width: 100%;
  box-sizing: border-box;
}

body:has(#paint-wrapper) main.page-container {
  min-height: 0 !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
}

body:has(#paint-wrapper) #paint-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#canvas-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #fff;
  cursor: crosshair;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 2px solid #0b5285;
  border-radius: 6px;
  background: #fff;
  color: #0b5285;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  text-shadow: none;
}
.action-btn:hover {
  background: #0b5285;
  color: #fff;
  text-decoration: none;
  text-shadow: none;
}
.action-btn--danger {
  border-color: #cc2200;
  color: #cc2200;
}
.action-btn--danger:hover {
  background: #cc2200;
  color: #fff;
}
.action-btn--submit {
  border-color: #bada55;
  background: #bada55;
  color: #1a1a1a;
}
.action-btn--submit:hover {
  background: #a8c93f;
  border-color: #a8c93f;
  color: #1a1a1a;
}

html.dark-mode .action-btn {
  background: #2a2a2a;
  color: #bada55 !important;
  border-color: #bada55 !important;
}
html.dark-mode .action-btn:hover {
  background: #bada55 !important;
  color: #1a1a1a !important;
}

#fp-select {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 20px;
}
.fp-select-inner {
  text-align: center;
  max-width: 560px;
  width: 100%;
}
.fp-title {
  font-family: 'Original Surfer', sans-serif;
  font-size: 2.8rem;
  color: #0b5285;
  margin: 0 0 8px;
}
html.dark-mode .fp-title { color: #bada55 !important; }

.fp-subtitle {
  font-size: 1rem;
  color: #666;
  margin: 0 0 32px;
}
html.dark-mode .fp-subtitle { color: #ccc !important; text-align: center; }

.fp-mode-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.fp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 200px;
  padding: 32px 16px;
  border: 3px solid #0b5285;
  border-radius: 16px;
  background: #fff;
  color: #0b5285;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: 4px 4px 0 #0b5285;
}
.fp-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #0b5285;
  background: #f0f8ff;
  text-decoration: none;
  color: #0b5285;
}
.fp-card--browse {
  border-color: #bada55;
  box-shadow: 4px 4px 0 #a8c93f;
}
.fp-card--browse:hover {
  box-shadow: 6px 6px 0 #a8c93f;
  background: #f8fce8;
  color: #1a1a1a;
}
.fp-card-icon  { font-size: 3rem; line-height: 1; }
.fp-card-icon--preview {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  overflow: hidden;
}
.fp-card-icon--preview img {
  max-width: 100%;
  max-height: 150px;
  width: auto;
  height: auto;
  border-radius: 6px;
  display: block;
}
.fp-card-label { font-family: 'Original Surfer', sans-serif; font-size: 1.5rem; }
.fp-card-desc  { font-size: 0.82rem;}

html.dark-mode .fp-card {
  background: #2a2a2a !important;
  color: #bada55 !important;
  border-color: #bada55 !important;
  box-shadow: 4px 4px 0 #bada55 !important;
}
html.dark-mode .fp-card:hover { background: #333 !important; }


#paint-wrapper {
  display: flex;
  flex-direction: column;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

#paint-toolbar {
  display: flex;
  flex-direction: column;
  background: #0b5285;
  box-sizing: border-box;
  width: 100%;
  user-select: none;
}

.tb-row-1 {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  padding: 6px 10px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tb-row-1::-webkit-scrollbar { display: none; }

.tb-row-2 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 6px;
  border-top: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
}
.tb-row-2::-webkit-scrollbar { display: none; }

.tb-swatch-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
  align-items: center;
}
.tb-swatch-scroll::-webkit-scrollbar { display: none; }

.tb-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tb-sep {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.tb-sep--push {
  flex: 1;
  min-width: 8px;
  background: none;
}

.tool-btn,
.size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  padding: 0;
  flex-shrink: 0;
}
.tool-btn:hover,
.size-btn:hover {
  background: rgba(255,255,255,0.25);
}
.tool-btn.active,
.size-btn.active {
  background: #bada55;
  border-color: #a8c93f;
  color: #1a1a1a;
}
.size-btn {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  width: 30px;
}

#color-swatches {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  flex-shrink: 0;
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.swatch:hover  { transform: scale(1.2); border-color: #fff; }
.swatch.active { border: 3px solid #fff; transform: scale(1.15); }

.custom-color-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.custom-color-wrap input[type="color"] {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 1px;
  cursor: pointer;
  background: none;
}
#active-color-preview {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 2px solid #fff;
  background: #000;
  flex-shrink: 0;
}

#paint-toolbar .action-btn {
  font-size: 0.78rem;
  padding: 5px 10px;
  height: 34px;
}

#paintCanvas {
  display: block;
  touch-action: none;
}

.fp-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.fp-modal.open { display: flex; }

.fp-modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  text-align: center;
}
html.dark-mode .fp-modal-box {
  background: #2a2a2a !important;
  color: #d3d3d3 !important;
}
.fp-modal-box h2 {
  font-family: 'Original Surfer', sans-serif;
  color: #0b5285;
  margin: 0 0 16px;
}
html.dark-mode .fp-modal-box h2 { color: #bada55 !important; }

.modal-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid #ddd;
  margin-bottom: 16px;
  background: #f9f9f9;
}
.modal-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: left;
  font-size: 0.9rem;
}
.optional { color: #888; font-weight: 400; font-size: 0.8rem; }

.modal-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #0b5285;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  box-sizing: border-box;
  margin-bottom: 16px;
  background: #fff;
  color: #1a1a1a;
}
html.dark-mode .modal-input {
  background: #1e1e1e !important;
  color: #d3d3d3 !important;
  border-color: #bada55 !important;
}

.modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.success-msg {
  font-size: 1.1rem;
  color: #0b5285;
  margin-bottom: 16px;
  font-weight: 700;
}
html.dark-mode .success-msg { color: #bada55 !important; }
.modal-btns-success {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#gallery-wrapper {
  padding-bottom: 40px;
}

.gallery-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 2px solid #e8e8e8;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
html.dark-mode .gallery-topbar { border-color: #444 !important; }

.gallery-counter {
  font-size: 0.85rem;
  color: #777;
}
html.dark-mode .gallery-counter { color: #aaa !important; }

#gallery-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  max-width: 900px;
  margin: 0 auto;
}

.gallery-nav {
  flex-shrink: 0;
  width: 44px;
  height: 80px;
  border: 2px solid #0b5285;
  border-radius: 8px;
  background: #fff;
  color: #0b5285;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  align-self: center;
}
.gallery-nav:hover { background: #0b5285; color: #fff; }
.gallery-nav:disabled { opacity: 0.3; cursor: default; }
html.dark-mode .gallery-nav {
  background: #2a2a2a !important;
  color: #bada55 !important;
  border-color: #bada55 !important;
}
html.dark-mode .gallery-nav:hover { background: #bada55 !important; color: #1a1a1a !important; }

#gallery-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#gallery-img-wrap {
  width: 100%;
  max-height: 60vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  overflow: hidden;
  min-height: 200px;
}
html.dark-mode #gallery-img-wrap {
  background: #222 !important;
  border-color: #444 !important;
}

#gallery-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: none;
  border-radius: 8px;
}
#gallery-img.loaded { display: block; }

.gallery-empty,
.gallery-loading {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}
html.dark-mode .gallery-empty,
html.dark-mode .gallery-loading { color: #aaa !important; }
.hidden { display: none !important; }

#gallery-info {
  text-align: center;
}

.drawing-title {
  font-family: 'Original Surfer', sans-serif;
  color: #0b5285;
  font-size: 1.4rem;
  margin: 0 0 6px;
  word-break: break-word;
}
html.dark-mode .drawing-title { color: #bada55 !important; }

.avg-stars {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  margin-bottom: 2px;
}
.avg-stars .fp-icon {
  width: 1.4rem;
  height: 1.4rem;
  color: #f5a623;
}
.avg-stars .fp-star-empty {
  color: #ddd;
}
html.dark-mode .avg-stars .fp-star-empty { color: #555 !important; }

.rating-count {
  font-size: 0.82rem;
  color: #888;
  margin: 0 0 12px;
}

.user-rating-wrap { margin-bottom: 12px; }
.rate-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
  margin: 0 0 6px;
}
html.dark-mode .rate-label { color: #ccc !important; }

.user-stars {
  display: inline-flex;
  gap: 4px;
  font-size: 2rem;
  cursor: pointer;
}
.user-stars .star {
  color: #ddd;
  transition: color 0.1s, transform 0.1s;
  line-height: 1;
}
html.dark-mode .user-stars .star { color: #444 !important; }
.user-stars .star:hover,
.user-stars .star.hovered { color: #f5a623; transform: scale(1.1); }
.user-stars .star.selected { color: #f5a623; }

.already-rated {
  font-size: 0.82rem;
  color: #4a8a4a;
  margin: 6px 0 0;
}
html.dark-mode .already-rated { color: #90c090 !important; }

.gallery-actions {
  margin-top: 8px;
}
.flag-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: #888;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: 'Nunito', sans-serif;
}
.flag-btn:hover { border-color: #cc2200; color: #cc2200; }
.flag-btn:disabled { opacity: 0.5; cursor: default; }

html.dark-mode #paint-toolbar button.tool-btn,
html.dark-mode #paint-toolbar button.size-btn {
  background-color: rgba(255,255,255,0.12) !important;
  color: #fff !important;
}
html.dark-mode #paint-toolbar button.tool-btn:hover,
html.dark-mode #paint-toolbar button.size-btn:hover {
  background-color: rgba(255,255,255,0.25) !important;
  color: #fff !important;
}
html.dark-mode #paint-toolbar button.tool-btn.active,
html.dark-mode #paint-toolbar button.size-btn.active {
  background-color: #bada55 !important;
  color: #1a1a1a !important;
  border-color: #a8c93f !important;
}

html.dark-mode #paint-toolbar button.swatch,
html.dark-mode button.swatch {
  background-color: var(--swatch-color) !important;
  color: transparent !important;
}

html.dark-mode #paint-toolbar button.action-btn {
  background-color: #2a2a2a !important;
  color: #bada55 !important;
  border-color: #bada55 !important;
}
html.dark-mode #paint-toolbar button.action-btn:hover {
  background-color: #bada55 !important;
  color: #1a1a1a !important;
}
html.dark-mode #paint-toolbar button.action-btn--danger {
  background-color: #2a2a2a !important;
  color: #ff6b6b !important;
  border-color: #cc2200 !important;
}
html.dark-mode #paint-toolbar button.action-btn--danger:hover {
  background-color: #cc2200 !important;
  color: #fff !important;
}
html.dark-mode #paint-toolbar button.action-btn--submit {
  background-color: #bada55 !important;
  color: #1a1a1a !important;
  border-color: #a8c93f !important;
}
html.dark-mode #paint-toolbar button.action-btn--submit:hover {
  background-color: #a8c93f !important;
  color: #1a1a1a !important;
}

html.dark-mode button.gallery-nav {
  background-color: #2a2a2a !important;
  color: #bada55 !important;
  border-color: #bada55 !important;
}
html.dark-mode button.gallery-nav:hover {
  background-color: #bada55 !important;
  color: #1a1a1a !important;
}
html.dark-mode button.gallery-nav:disabled {
  background-color: #2a2a2a !important;
  color: #555 !important;
  border-color: #555 !important;
}

html.dark-mode button.flag-btn {
  background-color: transparent !important;
  color: #888 !important;
  border-color: #888 !important;
}
html.dark-mode button.flag-btn:hover {
  background-color: transparent !important;
  color: #ff6b6b !important;
  border-color: #cc2200 !important;
}

html.dark-mode button.action-btn {
  background-color: #2a2a2a !important;
  color: #bada55 !important;
  border-color: #bada55 !important;
}
html.dark-mode button.action-btn:hover {
  background-color: #bada55 !important;
  color: #1a1a1a !important;
}
html.dark-mode button.action-btn--submit {
  background-color: #bada55 !important;
  color: #1a1a1a !important;
  border-color: #a8c93f !important;
}
html.dark-mode button.action-btn--danger {
  background-color: #2a2a2a !important;
  color: #ff6b6b !important;
  border-color: #cc2200 !important;
}

html.dark-mode button.star,
html.dark-mode #user-stars .star {
  background-color: transparent !important;
  color: #888 !important;
}
html.dark-mode #user-stars .star:hover,
html.dark-mode #user-stars .star.hovered,
html.dark-mode #user-stars .star.selected {
  background-color: transparent !important;
  color: #f5a623 !important;
}

@media (max-width: 640px) {
  #paint-toolbar {
    gap: 4px;
    padding: 5px 6px;
  }
  .tool-btn { width: 30px; height: 30px; font-size: 0.85rem; }
  .size-btn  { width: 26px; height: 30px; }
  #color-swatches { max-width: 140px; }
  .swatch { width: 18px; height: 18px; }

  .fp-mode-cards { flex-direction: column; align-items: center; }
  .fp-card { width: 240px; }

  .gallery-nav { width: 34px; height: 60px; font-size: 1rem; }
  .user-stars { font-size: 1.6rem; }
}

.fp-modal-box--sm {
  max-width: 340px;
  text-align: center;
}
.fp-confirm-msg {
  font-size: 1rem;
  color: #0b5285;
  margin: 0 0 18px 0;
  line-height: 1.5;
}
html.dark-mode .fp-confirm-msg {
  color: #ffffff !important;
}
.fp-error-icon {
  font-size: 2rem;
  margin: 0 0 8px 0;
}

.fp-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e2e08;
  border: 1px solid #bada55;
  color: #bada55;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  white-space: nowrap;
}
.fp-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}