/* =============  COLOR VARIABLES  ============= */
:root {
  /* Base colors */
  --color-white: #ddfff7;
  --color-black: #000000;
  --color-transparent: transparent;
  
  /* Enhanced red palette with better contrast */
  --color-red-primary: #ff2b2b;
  --color-red-secondary: #e60000;
  --color-red-tertiary: #ff5555;
  --color-red-light: #ff8888;
  --color-red-hover: #ff4444;
  --color-red-dark: #990000;
  --color-red-darker: #660000;
  --color-red-bright: #ff0033;
  --color-red-muted: #cc3333;
  
  /* Improved text colors with better contrast */
  --color-text-primary: #ddfff7;
  --color-text-light: #d4d4d4;
  --color-text-accent: #ddfff7;
  --color-text-dark: #999999;
  
  /* Refined background colors with better depth */
  --color-bg-main: linear-gradient(to bottom, #0a0a0a 0%, #111111 70%, var(--color-red-darker) 95%, var(--color-red-dark) 100%);
  --color-bg-primary: rgba(18, 18, 18, 0.95);
  --color-bg-secondary: rgb(28, 28, 28);
  --color-bg-tertiary: rgba(15, 15, 15, 0.92);
  --color-bg-quaternary: rgba(25, 25, 25, 0.94);
  --color-bg-input: rgba(32, 32, 32, 0.93);
  --color-bg-hover-primary: rgba(45, 45, 45, 0.88);
  --color-bg-hover-secondary: rgba(58, 58, 58, 0.90);
  --color-bg-card: rgba(22, 22, 22, 0.97);
  
  /* Enhanced border colors */
  --color-border-primary: rgba(150, 150, 150, 0.3);
  --color-border-secondary: rgba(180, 180, 180, 0.25);
  --color-border-accent: rgba(255, 43, 43, 0.4);
  --color-border-light: rgba(200, 200, 200, 0.2);
  --color-border-focus: rgba(255, 43, 43, 0.6);
  
  /* Improved red accent backgrounds */
  --color-red-bg-primary: rgba(255, 43, 43, 0.15);
  --color-red-bg-secondary: rgba(255, 43, 43, 0.06);
  --color-red-bg-tertiary: rgba(255, 43, 43, 0.10);
  --color-red-bg-quaternary: rgba(255, 43, 43, 0.12);
  --color-red-bg-hover: rgba(255, 43, 43, 0.20);
  
  /* Enhanced shadow colors with more depth */
  --color-shadow-primary: rgba(0, 0, 0, 0.6);
  --color-shadow-secondary: rgba(0, 0, 0, 0.8);
  --color-shadow-tertiary: rgba(0, 0, 0, 0.3);
  --color-shadow-red-primary: rgba(255, 43, 43, 0.25);
  --color-shadow-red-secondary: rgba(255, 43, 43, 0.35);
  --color-shadow-red-glow: rgba(255, 43, 43, 0.4);
  --color-shadow-green: rgba(0, 255, 136, 0.3);
  --color-text-shadow: rgba(255, 43, 43, 0.3);
  --color-text-shadow-strong: rgba(255, 43, 43, 0.5);
  
  /* Improved gradient colors */
  --color-gradient-primary-start: #e60000;
  --color-gradient-primary-end: var(--color-red-primary);
  --color-gradient-hover-start: var(--color-red-primary);
  --color-gradient-hover-end: #ff6666;
  --color-gradient-bg-start: rgba(10, 10, 10, 0.98);
  --color-gradient-bg-end: rgba(25, 25, 25, 0.95);
  
  /* Enhanced discount colors */
  --color-discount-bg: rgba(0, 255, 136, 0.12);
  --color-discount-border: var(--color-green-accent);
  --color-discount-text: #66ffaa;
  
  /* Status colors */
  --color-success: #00cc66;
  --color-warning: #ffaa00;
  --color-error: #ff3366;
  --color-info: #3399ff;
}

/* =============  LIGHT MODE COLOR VARIABLES  ============= */
[data-theme="light"] {
  /* Base colors */
  --color-white: #2c3e50;
  --color-black: #ffffff;
  --color-transparent: transparent;
  
  /* Blue palette for light mode */
  --color-red-primary: #0080ff;
  --color-red-secondary: #0066cc;
  --color-red-tertiary: #3399ff;
  --color-red-light: #66b3ff;
  --color-red-hover: #0073e6;
  --color-red-dark: #0059b3;
  --color-red-darker: #004080;
  --color-red-bright: #0080ff;
  --color-red-muted: #3366cc;
  
  /* Light mode text colors */
  --color-text-primary: #2c3e50;
  --color-text-light: #34495e;
  --color-text-accent: #2c3e50;
  --color-text-dark: #7f8c8d;
  
  /* Light mode backgrounds */
  --color-bg-main: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 70%, #e3f2fd 95%, #bbdefb 100%);
  --color-bg-primary: rgba(255, 255, 255, 0.95);
  --color-bg-secondary: rgb(248, 249, 250);
  --color-bg-tertiary: rgba(255, 255, 255, 0.92);
  --color-bg-quaternary: rgba(245, 245, 245, 0.94);
  --color-bg-input: rgba(250, 250, 250, 0.93);
  --color-bg-hover-primary: rgba(240, 240, 240, 0.88);
  --color-bg-hover-secondary: rgba(230, 230, 230, 0.90);
  --color-bg-card: rgba(255, 255, 255, 0.97);
  
  /* Light mode borders */
  --color-border-primary: rgba(52, 73, 94, 0.3);
  --color-border-secondary: rgba(52, 73, 94, 0.25);
  --color-border-accent: rgba(0, 128, 255, 0.4);
  --color-border-light: rgba(149, 165, 166, 0.2);
  --color-border-focus: rgba(0, 128, 255, 0.6);
  
  /* Light mode blue accent backgrounds */
  --color-red-bg-primary: rgba(0, 128, 255, 0.15);
  --color-red-bg-secondary: rgba(0, 128, 255, 0.06);
  --color-red-bg-tertiary: rgba(0, 128, 255, 0.10);
  --color-red-bg-quaternary: rgba(0, 128, 255, 0.12);
  --color-red-bg-hover: rgba(0, 128, 255, 0.20);
  
  /* Light mode shadows */
  --color-shadow-primary: rgba(44, 62, 80, 0.2);
  --color-shadow-secondary: rgba(44, 62, 80, 0.3);
  --color-shadow-tertiary: rgba(44, 62, 80, 0.1);
  --color-shadow-red-primary: rgba(0, 128, 255, 0.25);
  --color-shadow-red-secondary: rgba(0, 128, 255, 0.35);
  --color-shadow-red-glow: rgba(0, 128, 255, 0.4);
  --color-shadow-green: rgba(0, 200, 102, 0.3);
  --color-text-shadow: rgba(0, 128, 255, 0.3);
  --color-text-shadow-strong: rgba(0, 128, 255, 0.5);
  
  /* Light mode gradients */
  --color-gradient-primary-start: #0066cc;
  --color-gradient-primary-end: var(--color-red-primary);
  --color-gradient-hover-start: var(--color-red-primary);
  --color-gradient-hover-end: #66b3ff;
  --color-gradient-bg-start: rgba(255, 255, 255, 0.98);
  --color-gradient-bg-end: rgba(245, 245, 245, 0.95);
  
  /* Light mode discount colors */
  --color-discount-bg: rgba(0, 200, 102, 0.12);
  --color-discount-border: #00cc66;
  --color-discount-text: #00994d;
}

/* =============  COMMISSION CALCULATOR STYLES  ============= */

.commission-note {
  color: var(--color-red-primary);
  font-weight: bold;
  text-align: center;
  margin-bottom: 1em;
  font-size: 1rem;
}

.commission-calculator {
  min-height: 100vh;
  padding: 68px 20px 48px;
  color: var(--color-text-primary);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  align-self: stretch;
  background: transparent;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 0.5rem;
}

/* Expand container on the commissions page to fit screen with side breathing room */
.commission-calculator .container {
  max-width: 100%;
  width: 100%; /* stretch inside flex parent */
  padding-inline: clamp(16px, 4vw, 48px);
}

.commission-calculator h1 {
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--color-red-primary);
  text-shadow: 0 0 15px var(--color-text-shadow);
}

.subtitle {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 3rem;
  color: var(--color-text-accent);
}

/* Table-based Calculator */
.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 3.5rem;
  margin-bottom: 6rem;
}

/* make both columns stretch to equal row height */
.calculator-layout > .calculator-column,
.calculator-layout > .price-column {
  align-self: stretch;
}

.calculator-column {
  display: flex;
  flex-direction: column;
}

.price-column {
  display: grid;
  grid-template-rows: auto 1fr; /* price display, then details fills remainder */
  gap: 1rem;
  /* allow column to shrink and not grow the grid row */
  min-height: 0;
  overflow: hidden;
  contain: size;
}

.calculator-table-section {
  background: var(--color-bg-primary);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--color-border-accent);
  box-shadow: 0 4px 20px var(--color-shadow-primary);
  backdrop-filter: blur(8px);
  height: fit-content;
  width: 100%;
  margin-inline: auto;
}

.commission-calculator .calculator-table-section {
  width: 100%;
  max-width: none;
  margin-inline: auto;
}

.calculator-table-section h2 {
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--color-red-primary);
  text-shadow: 0 0 8px var(--color-text-shadow);
}

.table-instructions {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-light);
  font-style: italic;
}

.table-container {
  overflow-x: auto;
  margin-bottom: 2rem;
  width: 100%;
  /* Ensure smooth scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  /* Add subtle scroll indicator */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 43, 43, 0.3) transparent;
}

.table-container::-webkit-scrollbar {
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--color-border-secondary);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-red-secondary);
}

.commission-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  background: var(--color-bg-quaternary);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border-primary);
}

.commission-table th,
.commission-table td {
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--color-border-primary);
  color: var(--color-text-primary);
  position: relative;
}

.commission-table th {
  background: var(--color-bg-hover-primary);
  font-weight: 600;
  color: var(--color-text-accent);
  font-size: 1.1rem;
}

.commission-table tbody tr {
  transition: background-color 0.3s ease;
}

.commission-table tbody tr:hover {
  background: var(--color-bg-hover-primary);
}

/* Checkbox cells styling */
.checkbox-cell {
  padding: 1rem 0.5rem;
  position: relative;
  vertical-align: middle;
}

.price-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.5rem;
  border-radius: 6px;
  border: 2px solid transparent;
  min-height: 70px;
  justify-content: center;
}

.checkbox-content:hover {
  background: var(--color-bg-hover-primary);
  border-color: var(--color-red-secondary);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px var(--color-shadow-primary);
}

.price-checkbox:checked + .checkbox-content {
  background: var(--color-red-bg-primary);
  border-color: var(--color-red-primary);
  box-shadow: 0 0 10px var(--color-shadow-red-primary);
}

.price-checkbox:checked + .checkbox-content .checkmark {
  opacity: 1;
  transform: scale(1);
}

.checkmark {
  width: 20px;
  height: 20px;
  background: var(--color-red-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-weight: bold;
  font-size: 12px;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.price-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-red-primary);
}

.style-label {
  font-size: 0.8rem;
  color: var(--color-text-light);
  text-align: center;
  line-height: 1.2;
}

/* Type name cell */
.type-name {
  font-weight: 600;
  font-size: 1.1rem;
  background: var(--color-bg-hover-primary);
  color: var(--color-text-accent);
}

/* Additional Options */
.additional-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.background-section,
.character-section,
.commercial-section {
  background: var(--color-bg-tertiary);
  border-radius: 8px;
  padding: 1.2rem;
  border: 1px solid var(--color-border-primary);
  backdrop-filter: blur(6px);
}

.background-section h3,
.character-section h3,
.commercial-section h3 {
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--color-red-primary);
  text-shadow: 0 0 6px var(--color-text-shadow);
}

.background-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.background-option {
  display: block;
  cursor: pointer;
  transition: all 0.3s ease;
}

.background-option input[type="checkbox"] {
  display: none;
}

.background-content {
  display: block;
  padding: 0.75rem;
  background: var(--color-bg-hover-primary);
  border: 1px solid var(--color-border-primary);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.background-option:hover .background-content {
  background: var(--color-bg-hover-secondary);
  border-color: var(--color-border-accent);
}

.background-option input[type="checkbox"]:checked + .background-content {
  background: var(--color-red-bg-primary);
  border-color: var(--color-red-primary);
  box-shadow: 0 0 8px var(--color-shadow-red-primary);
}

.background-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--color-text-accent);
}

.background-price {
  display: block;
  font-weight: 700;
  color: var(--color-red-primary);
}

/* Commercial Use Section */
.commercial-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.commercial-option {
  display: block;
  cursor: pointer;
  transition: all 0.3s ease;
}

.commercial-option input[type="checkbox"] {
  display: none;
}

.commercial-content {
  display: block;
  padding: 0.75rem;
  background: var(--color-bg-hover-primary);
  border: 1px solid var(--color-border-primary);
  border-radius: 6px;
  transition: all 0.3s ease;
  text-align: center;
}

.commercial-option:hover .commercial-content {
  background: var(--color-bg-hover-secondary);
  border-color: var(--color-border-accent);
}

.commercial-option input[type="checkbox"]:checked + .commercial-content {
  background: var(--color-red-bg-primary);
  border-color: var(--color-red-primary);
  box-shadow: 0 0 8px var(--color-shadow-red-primary);
}

.commercial-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--color-text-accent);
}

.commercial-price {
  display: block;
  font-weight: 700;
  color: var(--color-red-primary);
  font-size: 1.1rem;
}

/* Loyalty discount styling - green for discounts */
input[name="loyaltyDiscount"]:checked + .commercial-content .commercial-price {
  color: var(--color-green-accent);
}

input[name="loyaltyDiscount"]:checked + .commercial-content {
  background: var(--color-discount-bg);
  border-color: var(--color-discount-border);
  box-shadow: 0 0 8px var(--color-shadow-green);
}

/* Character Counter */
.character-counter {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.character-counter label {
  font-weight: 600;
  color: var(--color-text-accent);
}

.counter-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-top: 3rem;
}

.counter-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border-secondary);
  background: var(--color-bg-hover-primary);
  color: var(--color-text-accent);
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: none; /* remove hover animation */
}

.counter-btn:hover {
  background: var(--color-bg-hover-secondary);
  border-color: var(--color-red-primary);
  transform: none; /* disable hover transform */
}

.counter-btn:active {
  transform: scale(0.95);
}

#additionalCharacters {
  width: 80px;
  height: 40px;
  text-align: center;
  border: 1px solid var(--color-border-secondary);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
}

#additionalCharacters:focus {
  outline: none;
  border-color: var(--color-red-primary);
  box-shadow: 0 0 8px var(--color-shadow-red-primary);
}

/* Price Display */
.price-display {
  background: var(--color-bg-secondary);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--color-border-accent);
  box-shadow: 0 4px 20px var(--color-shadow-primary);
  backdrop-filter: blur(8px);
  height: fit-content;
  position: sticky;
}

.price-breakdown h3 {
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--color-red-primary);
  text-shadow: 0 0 8px var(--color-text-shadow);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border-primary);
  color: var(--color-text-accent);
}

.breakdown-total {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  margin-top: 1rem;
  border-top: 2px solid var(--color-red-primary);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-red-primary);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  align-items: stretch;
}

.btn-primary, .btn-secondary, .btn-discord {
  --btn-bg: var(--color-bg-hover-primary);
  --btn-border: var(--color-border-secondary);
  --btn-text: var(--color-text-accent);
  --btn-glow: var(--color-shadow-primary);
  position: relative;
  flex: 1 1 180px;
  min-width: 150px;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--btn-border);
  background: linear-gradient(135deg, var(--btn-bg) 0%, rgba(60,60,60,0.4) 100%);
  color: var(--btn-text);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  overflow: hidden;
  backdrop-filter: blur(4px);
  transition: none; /* remove hover animations */
}

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--color-red-secondary) 0%, var(--color-red-primary) 100%);
  --btn-border: var(--color-red-secondary);
  --btn-text: var(--color-text-primary);
  --btn-glow: var(--color-shadow-red-secondary);
}

.btn-discord {
  --btn-bg: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
  --btn-border: rgba(120,130,255,0.6);
  --btn-text: #ffffff;
  --btn-glow: rgba(88,101,242,0.35);
}

/* Light mode Discord button text */
[data-theme="light"] .btn-discord {
  --btn-text: #2c3e50;
}

.btn-secondary {
  --btn-bg: linear-gradient(135deg, var(--color-bg-hover-primary) 0%, var(--color-bg-hover-secondary) 100%);
  --btn-border: var(--color-border-secondary);
  --btn-text: var(--color-text-accent);
  --btn-glow: rgba(0,0,0,0.5);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-red-primary) 0%, var(--color-red-tertiary) 100%);
  border-color: var(--color-red-primary);
}

.btn-discord:hover {
  background: linear-gradient(135deg, #677bc4 0%, #4752c4 100%);
  border-color: #4752c4;
}

.btn-primary:active,
.btn-secondary:active,
.btn-discord:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 3px 10px var(--btn-glow);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-discord:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* subtle shine effect */
.btn-primary::before,
.btn-secondary::before,
.btn-discord::before {
  content: none; /* disable shine pseudo-element */
}

.btn-primary:hover::before,
.btn-secondary:hover::before,
.btn-discord:hover::before {
  opacity: 0;
  transform: none;
}

/* Wrap behavior adjustments */
@media (max-width: 1100px) {
  .btn-primary, .btn-secondary, .btn-discord { flex: 1 1 160px; }
}
@media (max-width: 900px) {
  .btn-primary, .btn-secondary, .btn-discord { flex: 1 1 200px; }
}
@media (max-width: 768px) {
  .btn-primary, .btn-secondary, .btn-discord { width: 100%; min-width: 0; }
}

/* Price Reference Table */
.price-reference {
  background: var(--color-bg-primary);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--color-border-accent);
  box-shadow: 0 4px 20px var(--color-shadow-primary);
  backdrop-filter: blur(8px);
}

.price-reference h3 {
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--color-red-primary);
  text-align: center;
  text-shadow: 0 0 8px var(--color-text-shadow);
}

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

#priceTable th,
#priceTable td {
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--color-border-primary);
  color: var(--color-text-primary);
}

#priceTable th {
  background: var(--color-bg-hover-primary);
  font-weight: 600;
  color: var(--color-text-accent);
}

#priceTable tbody tr:nth-child(even) {
  background: var(--color-bg-tertiary);
}

#priceTable tbody tr:hover {
  background: var(--color-bg-hover-primary);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .calculator-layout {
    grid-template-columns: 1fr 350px;
    gap: 2rem;
  }
}

@media (max-width: 1024px) {
  .calculator-layout {
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
  }

  .additional-options {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .commercial-section {
    grid-column: 1 / -1;
  }

  .commission-table th,
  .commission-table td {
    padding: 0.75rem 0.5rem;
  }

  .checkbox-content {
    min-height: 60px;
    padding: 0.4rem;
  }

  .price-label {
    font-size: 0.9rem;
  }

  .style-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 900px) {
  .calculator-layout { 
    grid-template-columns: 1fr; 
  }
  /* Ensure price column appears AFTER the table on mobile */
  .price-column { 
    order: 1; 
    display: flex; /* stack price and details vertically */
    flex-direction: column;
    gap: 1.25rem;
    overflow: visible; /* avoid clipping children */
    contain: none;     /* allow normal layout flow */
  }
  .price-display { 
    position: static; 
    margin-bottom: 0; /* spacing handled by gap */
    width: 100%;
  }
  .details-panel {
    padding: 1rem;
    height: auto;      /* override desktop height:100% */
    min-height: 0;
    max-height: none;
    overflow: visible; /* let content expand */
  }
}

@media (max-width: 768px) {
  .commission-calculator {
    padding: 52px 15px 32px;
  }

  .commission-calculator h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
  }

  .subtitle {
    margin-bottom: 2rem;
    font-size: 1rem;
  }
  
  .calculator-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .calculator-table-section {
    padding: 1.5rem;
  }

  .calculator-table-section h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
  }

  .table-instructions {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
  
  .price-display {
    position: static;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
  }

  /* Force horizontal scroll container for table */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Better table scaling on mobile */
  .commission-table {
    font-size: 0.75rem;
    table-layout: auto;
    min-width: 100%;
    width: 100%;
  }

  .commission-table th,
  .commission-table td {
    padding: 0.35rem 0.1rem;
    vertical-align: middle;
  }

  .commission-table th:first-child,
  .commission-table td:first-child {
    width: 22%;
    min-width: 70px;
  }

  .commission-table th:not(:first-child),
  .commission-table td:not(:first-child) {
    width: 26%;
    min-width: 83px;
  }

  .checkbox-cell {
    padding: 0.4rem 0.05rem;
  }

  .checkbox-content {
    min-height: 42px;
    padding: 0.2rem;
    gap: 0.1rem;
  }

  .checkmark {
    width: 12px;
    height: 12px;
    font-size: 8px;
  }

  .price-label {
    font-size: 0.75rem;
    font-weight: 700;
  }

  .style-label {
    font-size: 0.6rem;
    line-height: 1;
  }

  .type-name {
    font-size: 0.75rem;
    padding: 0.35rem 0.1rem;
    word-break: break-word;
    line-height: 1.1;
  }

  /* Additional options on mobile */
  .additional-options {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .background-section,
  .character-section,
  .commercial-section {
    padding: 1rem;
  }

  .background-section h3,
  .character-section h3,
  .commercial-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .counter-btn {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  #additionalCharacters {
    width: 60px;
    height: 30px;
    font-size: 0.8rem;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
  }
  
  /* Make all three action buttons smaller on mobile */
  .btn-primary, .btn-secondary, .btn-discord {
    width: 100%;
    min-width: 0;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 8px;
    max-height: 44px;
    line-height: 1.1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .breakdown-item,
  .breakdown-total {
    font-size: 0.8rem;
    padding: 0.3rem 0;
  }

  .breakdown-item span:first-child {
    font-size: 0.8rem;
  }

  .breakdown-item span:last-child,
  .breakdown-total span:last-child {
    font-size: 0.8rem;
  }

  .price-breakdown {
    padding: 1rem;
  }

  .price-breakdown h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  .counter-controls {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .commission-calculator {
    padding: 52px 8px 28px;
  }
  
  .commission-calculator h1 {
    font-size: 2rem;
  }
  
  .calculator-table-section,
  .price-display,
  .price-reference {
    padding: 1rem;
  }
  
  .calculator-layout {
    gap: 1rem;
  }

  /* Force horizontal scroll container for table */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Ultra compact table for very small screens */
  .commission-table {
    font-size: 0.65rem;
    table-layout: auto;
    min-width: 100%;
    width: 100%;
  }

  .commission-table th,
  .commission-table td {
    padding: 0.25rem 0.05rem;
    vertical-align: middle;
  }

  .commission-table th:first-child,
  .commission-table td:first-child {
    width: 22%;
    min-width: 60px;
  }

  .commission-table th:not(:first-child),
  .commission-table td:not(:first-child) {
    width: 26%;
    min-width: 73px;
  }

  .checkbox-cell {
    padding: 0.3rem 0.02rem;
  }

  .checkbox-content {
    min-height: 35px;
    padding: 0.15rem 0.1rem;
    gap: 0.05rem;
  }

  .checkmark {
    width: 10px;
    height: 10px;
    font-size: 7px;
  }

  .price-label {
    font-size: 0.65rem;
    font-weight: 700;
  }

  .style-label {
    font-size: 0.55rem;
    line-height: 0.9;
  }

  .type-name {
    font-size: 0.65rem;
    padding: 0.25rem 0.05rem;
    word-break: break-word;
    line-height: 0.9;
  }

  /* Additional options on mobile */
  .additional-options {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .background-section,
  .character-section,
  .commercial-section {
    padding: 0.75rem;
  }

  .background-section h3,
  .character-section h3,
  .commercial-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .counter-btn {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  #additionalCharacters {
    width: 50px;
    height: 28px;
    font-size: 0.75rem;
  }

  /* Make all three action buttons smaller on very small screens */
  .btn-primary, .btn-secondary, .btn-discord {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .breakdown-item,
  .breakdown-total {
    font-size: 0.75rem;
    padding: 0.25rem 0;
  }

  .breakdown-item span:first-child {
    font-size: 0.75rem;
  }

  .breakdown-item span:last-child,
  .breakdown-total span:last-child {
    font-size: 0.75rem;
  }

  .price-breakdown {
    padding: 0.75rem;
  }

  .price-breakdown h3 {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }
}

@media (max-width: 375px) {
  .commission-calculator {
    padding: 52px 4px 28px;
  }

  .calculator-table-section {
    padding: 0.75rem;
  }

  /* Ultra compact horizontal scroll for tiny screens */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Absolute minimum table size */
  .commission-table {
    font-size: 0.6rem;
    table-layout: auto;
    min-width: 100%;
    width: 100%;
  }

  .commission-table th,
  .commission-table td {
    padding: 0.2rem 0.02rem;
    vertical-align: middle;
  }

  .commission-table th:first-child,
  .commission-table td:first-child {
    width: 22%;
    min-width: 50px;
  }

  .commission-table th:not(:first-child),
  .commission-table td:not(:first-child) {
    width: 26%;
    min-width: 70px;
  }

  .checkbox-cell {
    padding: 0.25rem 0.01rem;
  }

  .checkbox-content {
    min-height: 30px;
    padding: 0.1rem 0.05rem;
    gap: 0.03rem;
  }

  .checkmark {
    width: 8px;
    height: 8px;
    font-size: 6px;
  }

  .price-label {
    font-size: 0.6rem;
    font-weight: 700;
  }

  .style-label {
    font-size: 0.5rem;
    line-height: 0.8;
  }

  .type-name {
    font-size: 0.6rem;
    padding: 0.2rem 0.02rem;
    word-break: break-word;
    line-height: 0.9;
  }

  /* Additional options on mobile */
  .additional-options {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .background-section,
  .character-section,
  .commercial-section {
    padding: 0.5rem;
  }

  .background-section h3,
  .character-section h3,
  .commercial-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  .counter-btn {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  #additionalCharacters {
    width: 45px;
    height: 26px;
    font-size: 0.7rem;
  }

  /* Keep all three buttons compact */
  .btn-primary, .btn-secondary, .btn-discord {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .breakdown-item,
  .breakdown-total {
    font-size: 0.65rem;
    padding: 0.15rem 0;
  }

  .breakdown-item span:first-child {
    font-size: 0.65rem;
  }

  .breakdown-item span:last-child,
  .breakdown-total span:last-child {
    font-size: 0.65rem;
  }

  .price-breakdown {
    padding: 0.75rem;
  }

  .price-breakdown h3 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }
}

@media (max-width: 320px) {
  .commission-calculator {
    padding: 52px 2px 28px;
  }

  .calculator-table-section {
    padding: 0;
    font-weight: 700;
  }

  /* Ensure additional options are more compact */
  .background-section,
  .character-section,
  .commercial-section {
    padding: 0.4rem;
  }

  .background-section h3,
  .character-section h3,
  .commercial-section h3 {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
  }

  .counter-btn {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  #additionalCharacters {
    width: 40px;
    height: 24px;
    font-size: 0.65rem;
  }

  /* Keep buttons smallest at tiniest breakpoint */
  .btn-primary, .btn-secondary, .btn-discord {
    padding: 0.4rem 0.5rem;
    font-size: 0.7rem;
  }

  .breakdown-item,
  .breakdown-total {
    font-size: 0.65rem;
    padding: 0.15rem 0;
  }

  .price-breakdown {
    padding: 0.75rem;
  }

  .price-breakdown h3 {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
  }
}

/* =============  OR SEPARATOR STYLES  ============= */
.action-buttons .action-separator {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-accent);
  opacity: 0.7;
  position: relative;
  user-select: none;
}
.action-buttons .action-separator::before,
.action-buttons .action-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border-secondary), transparent);
  margin: 0 0.75rem;
}

/* Commission Email Modal */
.commission-email-modal { position: fixed; inset:0; display:flex; align-items:center; justify-content:center; z-index:1200; font-family:'Inter',sans-serif; }
.commission-email-modal[hidden]{ display:none !important; }
.commission-email-modal .cem-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,0.65); backdrop-filter:blur(4px); }
.cem-dialog{ position:relative; width:clamp(300px, 90%, 640px); max-height:90vh; overflow:auto; background:var(--color-bg-primary); border:1px solid var(--color-border-accent); border-radius:14px; box-shadow:0 8px 32px rgba(0,0,0,0.55); padding:1.25rem 1.5rem 1.75rem; display:flex; flex-direction:column; gap:1rem; }
.cem-header{ display:flex; align-items:center; justify-content:space-between; }
.cem-header h3{ font-family:'Bangers',cursive; font-size:1.55rem; margin:0; letter-spacing:1px; color:var(--color-red-primary); }
.cem-close{ background:none; border:none; font-size:1.75rem; line-height:1; cursor:pointer; color:var(--color-text-accent); padding:.25rem .5rem; border-radius:6px; }
.cem-close:hover{ background:rgba(255,255,255,0.06); color:var(--color-text-primary); }
.cem-form{ display:flex; flex-direction:column; gap:1rem; }
.cem-row{ display:flex; flex-direction:column; gap:.4rem; }
.cem-row label{ font-size:.85rem; text-transform:uppercase; letter-spacing:1px; color:var(--color-text-accent); font-weight:600; }
.cem-row input[type="email"], .cem-row input[type="text"], .cem-row textarea{ width:100%; border:1px solid var(--color-border-secondary); background:var(--color-bg-secondary); color:var(--color-text-primary); padding:.7rem .85rem; border-radius:8px; font-family:'Inter',sans-serif; font-size:.9rem; resize:vertical; box-shadow:inset 0 0 0 1px rgba(255,255,255,0.03); }
.cem-row input:focus, .cem-row textarea:focus{ outline:2px solid var(--color-border-focus); outline-offset:1px; }
.cem-row textarea{ min-height:180px; }
.cem-actions{ display:flex; gap:.75rem; justify-content:flex-end; }
.cem-status{ min-height:1.2rem; font-size:.8rem; color:var(--color-text-accent); }
.cem-status.error{ color:var(--color-red-primary); }
.cem-status.success{ color:#4caf50; }
.cem-hp{ display:none !important; }
@media (max-width:600px){ .cem-dialog{ padding:1rem 1rem 1.25rem; } .cem-actions{ flex-direction:column-reverse; } }

/* Email Service Warning Styles */
.service-warning {
  background: rgba(255, 43, 43, 0.1);
  border: 1px solid rgba(255, 43, 43, 0.3);
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.75rem;
  text-align: center;
  animation: warning-pulse 2s ease-in-out infinite;
}

.service-warning small {
  color: var(--color-red-tertiary);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

@keyframes warning-pulse {
  0%, 100% {
    background: rgba(255, 43, 43, 0.1);
    border-color: rgba(255, 43, 43, 0.3);
  }
  50% {
    background: rgba(255, 43, 43, 0.15);
    border-color: rgba(255, 43, 43, 0.4);
  }
}

/* Enhanced Discord button styling when email is unavailable */
.btn-discord.btn-primary {
  background: linear-gradient(135deg, #7289da 0%, #5865f2 100%);
  border-color: #5865f2;
  transform: scale(1.02);
  transition: all 0.3s ease;
}

.btn-discord.btn-primary:hover {
  background: linear-gradient(135deg, #677bc4 0%, #4752c4 100%);
  transform: none; /* disable hover scale */
  box-shadow: none; /* disable hover shadow */
}

/* Details panel on the right to occupy bottom-right space */
.details-panel {
  background: var(--color-bg-secondary);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--color-border-accent);
  box-shadow: 0 4px 20px var(--color-shadow-primary);
  backdrop-filter: blur(8px);
  /* fill available height with internal scroll */
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* Scrollbar styling for details panel */
.details-panel {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-secondary) var(--color-bg-tertiary);
}
.details-panel::-webkit-scrollbar {
  width: 8px;
}
.details-panel::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
  border-radius: 4px;
}
.details-panel::-webkit-scrollbar-thumb {
  background: var(--color-border-secondary);
  border-radius: 4px;
}
.details-panel::-webkit-scrollbar-thumb:hover {
  background: var(--color-red-secondary);
}

.details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: none;
  z-index: 2;
  padding-bottom: 0.25rem;
  margin-top: 0.5rem;
}

.details-header::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: -1rem;
  right: -2rem;
  height: 6rem;
  pointer-events: none;
  z-index: -1;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(to bottom, var(--color-bg-secondary) 0%, rgba(28, 28, 28, 0.895) 40%, rgba(28, 28, 28, 0.445) 70%, rgba(28, 28, 28, 0) 100%);
}

/* Light mode gradient for details header */
[data-theme="light"] .details-header::before {
  background: linear-gradient(to bottom, var(--color-bg-secondary) 0%, rgba(248, 249, 250, 0.895) 40%, rgba(248, 249, 250, 0.445) 70%, rgba(248, 249, 250, 0) 100%);
}
.details-header h3 {
  margin: 0;
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 1.2rem;
  color: var(--color-red-primary);
  text-shadow: 0 0 6px var(--color-text-shadow);
}
#copyDetailsBtn {
  background: var(--color-bg-hover-primary) !important;
  border: 1px solid var(--color-border-accent) !important;
  color: var(--color-red-primary) !important;
  border-radius: 8px;
  font-size: 0.95rem;
  padding: 0.5rem 1.1rem;
  margin-left: 0.5rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 6px var(--color-shadow-primary);
  transition: background 0.15s, border 0.15s, color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  outline: none;
}
#copyDetailsBtn:hover, #copyDetailsBtn:focus {
  background: var(--color-red-bg-primary) !important;
  border-color: var(--color-red-primary) !important;
  color: var(--color-red-primary) !important;
  box-shadow: 0 2px 10px var(--color-shadow-red-primary);
}
#copyDetailsBtn:active {
  background: var(--color-red-bg-secondary) !important;
  color: var(--color-red-dark) !important;
  box-shadow: 0 1px 4px var(--color-shadow-primary);
}

.details-panel h3 {
  font-family: 'Bangers', cursive;
  font-weight: 300;
  font-size: 1.2rem;
  margin: 0 0 0.5rem 0;
  color: var(--color-red-primary);
  text-shadow: 0 0 6px var(--color-text-shadow);
}

#detailsText {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--color-text-accent);
}

/* =============  COMMISSION CALCULATOR STYLES - END  ============= */
