/* Admin Panel Styles */
.admin-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #667eea;
}

.admin-header h1 {
  margin: 0;
  color: #667eea;
}

.notice {
  background: #48c774;
  color: white;
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.errors {
  background: #f14668;
  color: white;
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.errors ul {
  margin: 0.5rem 0 0 1.5rem;
}

/* Table Styles */
.bingos-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

thead {
  background: #667eea;
  color: white;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
  background: #f5f5f5;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
}

.form-control-small {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}

.form-control-small:focus {
  outline: none;
  border-color: #667eea;
}

small {
  display: block;
  margin-top: 0.25rem;
  color: #666;
  font-size: 0.875rem;
}

.help-text {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* Cells Grid */
.cells-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 5px;
}

.cell-input {
  display: flex;
  flex-direction: column;
}

.cell-input label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #667eea;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn {
  background: #e0e0e0;
  color: #333;
}

.btn:hover {
  background: #d0d0d0;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-small:hover {
  background: #5568d3;
}

.btn-danger {
  background: #f14668;
}

.btn-danger:hover {
  background: #e03456;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e0e0e0;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #667eea;
}

.header h1 {
  margin: 0;
  color: #667eea;
}

.back-link {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-block;
}

.back-link:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Live Preview Styles */
.preview-and-settings-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.color-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  order: 1;
}

.settings-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.settings-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.settings-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #667eea;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #667eea;
}

.settings-card .form-group {
  margin-bottom: 1rem;
}

.settings-card .form-group:last-child {
  margin-bottom: 0;
}

.settings-card label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
}

.settings-card small {
  font-size: 12px;
  color: #666;
}

.preview-section {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 12px;
  position: sticky;
  top: 20px;
  order: 2;
}

.preview-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease;
}

.preview-card {
  background: #f8f9ff;
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.preview-image-placeholder {
  flex-shrink: 0;
  width: 80px;
  height: 100px;
}

.preview-image-placeholder svg {
  width: 100%;
  height: 100%;
}

.preview-header-text {
  flex: 1;
  text-align: center;
}

.preview-title {
  font-size: 20px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 4px;
  transition: color 0.3s ease;
}

.preview-subtitle {
  font-size: 12px;
  color: #666;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.preview-cell {
  aspect-ratio: 1;
  background: #f9f9f9;
  border: 2px solid #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: #333;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.preview-cell span {
  z-index: 1;
  position: relative;
}

.preview-cell.scratched span {
  opacity: 0;
}

.preview-cell.scratched::before,
.preview-cell.scratched::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 6px;
}

.preview-cell.scratched::before {
  background: rgba(102, 126, 234, 0.4);
  background-image: linear-gradient(45deg, rgba(102, 126, 234, 0.3) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(102, 126, 234, 0.3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(102, 126, 234, 0.3) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(102, 126, 234, 0.3) 75%);
  background-size: 8px 8px;
  z-index: 2;
}

.preview-cell.scratched::after {
  background: rgba(102, 126, 234, 0.2);
  background-image: linear-gradient(-45deg, rgba(102, 126, 234, 0.2) 25%, transparent 25%),
    linear-gradient(45deg, rgba(102, 126, 234, 0.2) 25%, transparent 25%);
  background-size: 10px 10px;
  z-index: 3;
}

.preview-progress-section {
  text-align: center;
}

.preview-progress-label {
  font-size: 14px;
  font-weight: 900;
  color: #667eea;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.preview-progress-wrapper {
  display: flex;
  align-items: center;
  padding-left: 20px;
}

.preview-progress-circle {
  width: 36px;
  height: 36px;
  background: white;
  border: 3px solid #667eea;
  border-radius: 50%;
  margin-right: -18px;
  z-index: 1;
  transition: border-color 0.3s ease;
}

.preview-progress-bar-container {
  flex: 1;
  height: 24px;
  background: white;
  border: 3px solid #667eea;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.preview-progress-bar {
  height: 100%;
  width: 12%;
  background: #667eea;
  border-radius: 10px;
  transition: background 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-container {
    margin: 0;
    padding: 1rem;
    border-radius: 0;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .cells-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  table {
    font-size: 0.875rem;
  }

  th, td {
    padding: 0.5rem;
  }

  .actions {
    flex-direction: column;
  }
}

/* Color Picker Component Styles */
.color-picker {
  position: relative;
}
.color-picker-dropdown {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.color-picker-dropdown:hover {
  border-color: #667eea;
}
.color-picker-dropdown.open {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}
.color-picker-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}
.color-label {
  flex: 1;
  font-size: 14px;
  color: #333;
}
.color-picker-arrow {
  font-size: 10px;
  color: #666;
  transition: transform 0.2s;
}
.color-picker-dropdown.open .color-picker-arrow {
  transform: rotate(180deg);
}
.color-picker-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  display: none;
  margin-top: 4px;
}
.color-picker-options.open {
  display: block;
}
.color-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.color-option:hover {
  background: #f5f5f5;
}
.color-option.selected {
  background: #e8eeff;
}
.color-option .color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.color-option .color-label {
  font-size: 14px;
}
.color-option-custom {
  border-top: 1px solid #eee;
  padding: 12px;
  background: #fafafa;
}
.custom-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.custom-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid #ddd;
}
.custom-color-input {
  width: 50px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.custom-color-btn {
  flex: 1;
  padding: 8px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.custom-color-btn:hover {
  background: #5568d3;
}

/* Publish Status Toggle */
.publish-status-group {
  background: #e8f5e9;
  border: 2px solid #4caf50;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.publish-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.publish-toggle .form-check-input {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.publish-toggle .form-check-label {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2e7d32;
  cursor: pointer;
  margin: 0;
}

.publish-status-group small {
  display: block;
  margin-top: 0.5rem;
  color: #666;
}
/*


 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  min-height: 100%;
  min-height: -webkit-fill-available;
  background: #667eea;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--screenshot-background, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
  background-attachment: fixed;
  background-size: cover;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding: 20px;
  color: #333;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* Navigation Bar */
.bingo-nav {
  max-width: 1200px;
  margin: 0 auto 20px;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #667eea;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
  transition: color 0.2s;
}

.nav-brand:hover {
  color: #5568d3;
}

.nav-brand svg {
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  background: #f0f0f0;
  color: #333;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-link:hover {
  background: #667eea;
  color: white;
}

.nav-link.primary {
  background: #667eea;
  color: white;
}

.nav-link.primary:hover {
  background: #5568d3;
}

.nav-link.cta {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  animation: pulse-cta 2s ease-in-out infinite;
}

.nav-link.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

@keyframes pulse-cta {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 4px 25px rgba(102, 126, 234, 0.6);
  }
}

/* Hide nav in screenshot mode */
body.screenshot-mode .bingo-nav {
  display: none !important;
}

@media (max-width: 600px) {
  .nav-content {
    flex-direction: column;
    gap: 12px;
    padding: 15px;
  }

  .nav-brand {
    font-size: 1.1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Index Page */
.bingos-index {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  color: white;
}

.index-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.auth-links {
  display: flex;
  gap: 10px;
}

.auth-btn {
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
}

.auth-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.auth-btn.primary {
  background: white;
  color: #667eea;
  border-color: white;
}

.auth-btn.primary:hover {
  background: #f0f0f0;
}

.bingos-index h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.bingos-index > p {
  font-size: 1.2rem;
  margin-bottom: 3rem;
  opacity: 0.9;
}

.bingos-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.bingo-card {
  background: white;
  border-radius: 15px;
  padding: 2rem;
  text-decoration: none;
  color: #333;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.bingo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.bingo-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.bingo-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--main-color, #667eea);
}

/* Bingo Show Page */
.bingo-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--card-background, #f8f9ff);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.bingo-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.character-image {
  width: 300px;
  height: 300px;
  object-fit: cover;
  flex-shrink: 0;
}

.bingo-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.bingo-header h1 {
  font-size: 3rem;
  color: var(--main-color, #667eea);
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.bingo-header p {
  margin: 0;
  color: #666;
  font-size: 1.1rem;
}

/* Layout: Classic centered (header_centered) */
.layout-header-centered .bingo-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.layout-header-centered .character-image {
  margin-bottom: 1.5rem;
}

/* Layout: Sidebar layouts (sidebar_left and sidebar_right) */
.layout-sidebar-left .bingo-container,
.layout-sidebar-right .bingo-container {
  display: flex;
  position: relative;
}

.layout-sidebar-left .bingo-main,
.layout-sidebar-right .bingo-main {
  flex: 1;
  position: relative;
  z-index: 2;
}

.layout-sidebar-left .character-image,
.layout-sidebar-right .character-image {
  width: 400px;
  height: 600px;
  object-fit: cover;
  object-position: top;
  position: sticky;
  top: 20px;
  flex-shrink: 0;
  z-index: 1;
}

/* Screenshot mode - colorful background wrapper with fixed aspect ratio */
body.screenshot-mode > div:not(.screenshot-loading) {
  background: var(--screenshot-background, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
  padding: 2rem !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 940px !important;
  min-height: 1175px !important;
  box-sizing: border-box !important;
}

/* Ensure loading overlay stays full screen even in screenshot mode */
body.screenshot-mode .screenshot-loading {
  width: 100vw !important;
  height: 100vh !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Screenshot mode - white card */
body.screenshot-mode .bingo-container {
  width: 900px !important;
  max-width: 900px !important;
  min-width: 900px !important;
  padding: 2rem !important;
  position: relative !important;
  display: block !important;
  background: #f8f9ff !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  margin: 0 !important;
}

/* Reset all positioning */
body.screenshot-mode .bingo-header,
body.screenshot-mode .character-image,
body.screenshot-mode .bingo-main,
body.screenshot-mode .bingo-grid,
body.screenshot-mode .progress-section {
  position: relative !important;
}

/* Header - default horizontal layout */
body.screenshot-mode .bingo-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 2rem !important;
  margin-bottom: 2rem !important;
}

body.screenshot-mode .character-image {
  width: 300px !important;
  height: auto !important;
  max-height: 400px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}

body.screenshot-mode .bingo-header-text {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  text-align: center !important;
}

body.screenshot-mode .bingo-header h1 {
  font-size: 3rem !important;
  line-height: 1.2 !important;
  margin: 0 0 0.5rem 0 !important;
}

body.screenshot-mode .bingo-header p {
  font-size: 1.1rem !important;
  line-height: 1.4 !important;
  margin: 0 !important;
}

/* Grid */
body.screenshot-mode .bingo-grid {
  display: grid !important;
  gap: 10px !important;
  margin-bottom: 2rem !important;
}

body.screenshot-mode .bingo-cell {
  min-height: 100px !important;
  padding: 8px !important;
}

body.screenshot-mode .cell-text {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

/* Progress section */
body.screenshot-mode .progress-section {
  margin-bottom: 0 !important;
}

body.screenshot-mode .progress-label {
  font-size: 1.8rem !important;
  font-weight: 900 !important;
}

body.screenshot-mode .progress-text {
  font-size: 1.1rem !important;
}

body.screenshot-mode .progress-bar-wrapper {
  position: relative !important;
  padding-left: 30px !important;
}

body.screenshot-mode .progress-bar {
  position: relative !important;
  height: 40px !important;
}

body.screenshot-mode .progress-bar::before {
  position: absolute !important;
  left: -30px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 60px !important;
  height: 60px !important;
}

body.screenshot-mode .progress-fill::before {
  left: -30px !important;
  width: 60px !important;
  height: 60px !important;
}

body.screenshot-mode .breakpoint-marker {
  height: 50px !important;
}

body.screenshot-mode .progress-status-label {
  font-size: 1.1rem !important;
  top: 68% !important;
}

/* Left sidebar: Image overlaps 50% into grid area */
.layout-sidebar-left .bingo-container {
  flex-direction: row;
}

.layout-sidebar-left .character-image {
  margin-right: -200px; /* 50% of image width */
}

.layout-sidebar-left .bingo-main {
  padding-left: 2rem;
}

/* Right sidebar: Image overlaps 50% into grid area */
.layout-sidebar-right .bingo-container {
  flex-direction: row-reverse;
}

.layout-sidebar-right .character-image {
  margin-left: -200px; /* 50% of image width */
}

.layout-sidebar-right .bingo-main {
  padding-right: 2rem;
}

.layout-sidebar-left .bingo-header,
.layout-sidebar-right .bingo-header {
  flex-direction: column;
  text-align: center;
}

/* Bingo Grid */
.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 2rem;
}

.bingo-cell {
  aspect-ratio: 1;
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f9f9f9;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.bingo-cell:hover {
  background: #f0f0f0;
  transform: scale(1.05);
  border-color: var(--main-color, #667eea);
}

.bingo-cell.selected {
  background: #f9f9f9;
  border-color: var(--main-color, #667eea);
}

.scratch-layer-1,
.scratch-layer-2 {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
  background-size: 10px 10px;
  background-repeat: repeat;
  z-index: 1;
}

/* Diagonal Stripes Pattern (Default) */
.scratch-layer-1 {
  background-image:
    linear-gradient(45deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px 0px, 0px 0px;
}

.scratch-layer-2 {
  background-image:
    linear-gradient(-45deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 25%, transparent 25%),
    linear-gradient(45deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 25%, transparent 25%),
    linear-gradient(-45deg, transparent 75%, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 75%),
    linear-gradient(45deg, transparent 75%, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px 0px, 0px 0px;
}

.bingo-cell.selected .scratch-layer-1,
.bingo-cell.selected .scratch-layer-2 {
  opacity: 1;
}

.bingo-cell.selected .scratch-layer-1 {
  animation: scratch 0.4s ease-out;
}

.bingo-cell.selected .scratch-layer-2 {
  animation: scratch 0.4s ease-out 0.1s;
}

@keyframes scratch {
  from {
    opacity: 0;
    transform: scale(0.8) rotate(-5deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Dots Pattern */
.scratch-style-dots .scratch-layer-1 {
  background-image: radial-gradient(circle, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.4) 2px, transparent 2px);
  background-size: 8px 8px;
  background-position: 0 0;
}

.scratch-style-dots .scratch-layer-2 {
  background-image: radial-gradient(circle, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.25) 1.5px, transparent 1.5px);
  background-size: 8px 8px;
  background-position: 4px 4px;
}

/* Circles Pattern */
.scratch-style-circles .scratch-layer-1 {
  background-image: radial-gradient(circle, transparent 3px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 3px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 5px, transparent 5px);
  background-size: 12px 12px;
  background-position: 0 0;
}

.scratch-style-circles .scratch-layer-2 {
  background-image: radial-gradient(circle, transparent 2px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 2px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 4px, transparent 4px);
  background-size: 12px 12px;
  background-position: 6px 6px;
}

/* Crosshatch Pattern */
.scratch-style-crosshatch .scratch-layer-1 {
  background-image:
    linear-gradient(0deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 1px, transparent 1px);
  background-size: 10px 10px;
  background-position: 0 0;
}

.scratch-style-crosshatch .scratch-layer-2 {
  background-image:
    linear-gradient(45deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 1px, transparent 1px);
  background-size: 8px 8px;
  background-position: 0 0;
}

/* Waves Pattern */
.scratch-style-waves .scratch-layer-1 {
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 3px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.3) 6px);
  background-size: 100% 12px;
}

.scratch-style-waves .scratch-layer-2 {
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 3px, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.2) 6px);
  background-size: 12px 100%;
}

/* Grid Pattern */
.scratch-style-grid .scratch-layer-1 {
  background-image:
    linear-gradient(0deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.35) 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: 0 0;
}

.scratch-style-grid .scratch-layer-2 {
  background-image:
    linear-gradient(0deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--scratch-color-rgb, 102, 126, 234), 0.15) 1px, transparent 1px);
  background-size: 6px 6px;
  background-position: 0 0;
}

.cell-text {
  font-size: 1.4rem;
  font-weight: 700;
  z-index: 2;
  line-height: 1.15;
  padding: 0;
  position: relative;
  word-break: keep-all;
  overflow-wrap: normal;
  white-space: normal;
  max-width: 100%;
  max-height: 100%;
  display: block;
  overflow: hidden;
  text-align: center;
}

.cell-text:has(+ *) {
  font-size: clamp(0.9rem, 1.4rem, 1.4rem);
}

@supports not (selector(:has(*))) {
  .bingo-cell {
    font-size: 1.4rem;
  }

  .bingo-cell[data-long-text] .cell-text {
    font-size: 1.1rem;
  }
}

/* Progress Section */
.progress-section {
  margin-bottom: 2rem;
}

.progress-label {
  text-align: center;
  font-weight: 900;
  color: var(--main-color, #667eea);
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  text-transform: capitalize;
}

.progress-bar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-left: 30px;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 40px;
  background: white;
  border-radius: 20px;
  overflow: visible;
  border: 3px solid var(--main-color, #667eea);
}

.progress-bar::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 50%;
  border: 3px solid var(--main-color, #667eea);
  z-index: 0;
}

.progress-fill {
  position: relative;
  height: 100%;
  background: var(--main-color, #667eea);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 18px;
  z-index: 2;
}

.progress-fill::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 50%;
  border: 3px solid var(--main-color, #667eea);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.progress-fill.has-progress::before {
  background: var(--main-color, #667eea);
  opacity: 1;
}

.progress-circle {
  display: none;
}

.progress-breakpoint {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.breakpoint-marker {
  width: 2px;
  height: 50px;
  background: var(--main-color, #667eea);
  margin: 0 auto;
  opacity: 0.3;
}

.progress-status-label {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-weight: 900;
  color: white;
  white-space: nowrap;
  z-index: 4;
  pointer-events: none;
  -webkit-text-stroke: 5px var(--main-color, #667eea);
  text-stroke: 5px var(--main-color, #667eea);
  paint-order: stroke fill;
}

.progress-text {
  text-align: center;
  font-weight: bold;
  color: var(--main-color, #667eea);
  font-size: 1.1rem;
}

/* Screenshot Loading Overlay */
.screenshot-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: rgb(102, 126, 234);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.loading-content {
  text-align: center;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.loading-content p {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 1.5rem 0 0 0;
  animation: pulse 1.5s ease-in-out infinite;
  text-align: center;
  white-space: nowrap;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Actions */
.actions {
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 5px 15px rgba(var(--main-color-rgb, 102, 126, 234), 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(var(--main-color-rgb, 102, 126, 234), 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-pinterest {
  background: #E60023;
  color: white;
  box-shadow: 0 4px 12px rgba(230, 0, 35, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
}

.btn-pinterest:hover {
  background: #BD081C;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(230, 0, 35, 0.4);
}

.btn-pinterest:active {
  transform: translateY(0);
}

.btn-pinterest:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  background: #E60023;
}

.btn-pinterest svg {
  flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .bingo-container {
    padding: 1rem;
  }

  .bingo-grid {
    gap: 5px;
  }

  .bingo-cell {
    padding: 4px;
  }

  .cell-text {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.1;
  }

  .bingo-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .character-image {
    width: 200px;
    height: 250px;
    max-height: 250px;
    object-fit: cover;
    object-position: top;
  }

  .bingo-header h1 {
    font-size: 1.5rem;
  }

  /* Mobile: Stack sidebar layouts vertically */
  .layout-sidebar-left .bingo-container,
  .layout-sidebar-right .bingo-container {
    flex-direction: column;
    align-items: center;
  }

  .layout-sidebar-left .character-image,
  .layout-sidebar-right .character-image {
    width: 200px;
    height: auto;
    max-height: 300px;
    margin: 0 0 1.5rem 0;
    position: relative;
  }

  .layout-sidebar-left .bingo-main,
  .layout-sidebar-right .bingo-main {
    padding: 0;
    width: 100%;
  }

  .progress-bar-wrapper {
    padding-left: 20px;
  }

  .progress-bar {
    height: 30px;
  }

  .progress-bar::before {
    left: -20px;
    width: 45px;
    height: 45px;
  }

  .progress-fill::before {
    left: -20px;
    width: 45px;
    height: 45px;
  }

  .progress-label {
    font-size: 1.4rem;
    font-weight: 900;
  }

  .breakpoint-marker {
    height: 35px;
  }

  .progress-status-label {
    font-size: 0.9rem;
  }
}
