/* === GLOBAL STYLES === */
/* Note: Narrow screen breakpoint of 480px is used in media queries below */
body {
  background: #f8f9fa;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
}

/* === FORM LAYOUT === */
form {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* === FORM ELEMENTS === */
label {
  font-weight: 600;
  color: #555;
  margin-right: 10px;
}

/* === CHARACTER INFO BOX (Soft Gray) === */
.character-info-box {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 12px;
}

.basic-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 12px;
}

.basic-info .form-field {
  margin-bottom: 0;
}

.basic-info input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

/* === LOOK FIELD === */
.basic-info .form-field:has(label[for="look"]) {
  grid-column: 1 / -1; /* Span all columns */
}

.form-field label[for="look"] {
  display: block;
  margin-bottom: 5px;
}

.form-field input#look {
  width: 100%;
  box-sizing: border-box;
}

/* === COMBAT AND PROGRESSION STATS === */
.all-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.all-stats label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

.all-stats input[type="text"] {
  width: 60px;
  padding: 6px 8px;
  border: 2px solid #e1e5e9;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
  box-sizing: border-box;
}

.all-stats input[type="text"]:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Wider inputs for Damage, HP and Load to fit placeholders */
.all-stats input#damage,
.all-stats input#hp,
.all-stats input#load {
  width: 80px;
}

.role-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.role-controls label {
  font-size: 14px;
  font-weight: 600;
  margin-right: 8px;
}

.role-controls select {
  min-width: 140px;
}

/* === HELP ICON BUTTON === */
.help-icon {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.help-icon:hover {
  background: #5a6268;
  transform: scale(1.05);
}

.help-icon:active {
  transform: scale(0.95);
}

.help-icon:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.3);
}

/* === GLOSSARY TERMS === */
.glossary-term {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.glossary-term:hover {
  color: #6b7280;
  text-decoration-style: solid;
  text-decoration-color: #6b7280;
}

.glossary-term:active {
  color: #4b5563;
}

/* Hide help features when help is hidden */
body.hide-help .glossary-term {
  text-decoration: none;
  pointer-events: none;
  cursor: default;
}

body.hide-help .help-icon {
  display: none;
}

/* === MOVE REFERENCES === */
.move-reference {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: #3b82f6;
  color: inherit;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.move-reference:hover {
  color: #2563eb;
  text-decoration-color: #2563eb;
}

.move-reference:active {
  color: #1d4ed8;
}

/* Highlight animation for navigated-to moves */
@keyframes highlight-pulse {
  0% {
    background-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    background-color: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
  100% {
    background-color: transparent;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.move.highlight-move {
  animation: highlight-pulse 2s ease-out;
  border-radius: 4px;
}

/* Hide move references when help is hidden */
body.hide-help .move-reference {
  text-decoration: none;
  pointer-events: none;
  cursor: default;
}

/* === BURGER MENU BUTTON === */
.burger-menu {
  font-size: 1.5em;
  line-height: 1;
  padding: 4px 12px;
  min-width: auto;
}

/* === TABLE OF CONTENTS MODAL === */
.contents-modal .contents-content {
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.contents-list {
  margin-top: 0.75em;
}

.contents-category {
  margin-bottom: 1em;
}

.contents-category h4 {
  margin: 0 0 0.35em 0;
  color: #374151;
  font-size: 0.95em;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.2em;
}

.contents-category ul {
  list-style-type: disc;
  margin: 0;
  padding-left: 1.5em;
}

.contents-category li {
  margin: 0.1em 0;
  line-height: 1.4;
  padding-left: 0.25em;
}

.contents-move-link {
  color: #1f2937; /* Dark gray instead of blue */
  text-decoration: none;
  display: inline-block;
  padding: 0.15em 0;
  transition: color 0.2s, text-decoration 0.2s;
}

.contents-move-link:hover {
  color: #3b82f6; /* Blue on hover */
  text-decoration: underline;
  text-decoration-color: #3b82f6;
}

.contents-move-link:active {
  color: #2563eb; /* Darker blue when clicked */
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .contents-modal .contents-content {
    max-height: 85vh; /* More height on mobile */
    padding: 16px; /* Less padding on mobile */
  }
}

/* === ROLE DESCRIPTION MODAL === */
.role-description-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.role-description-content {
  background: white;
  padding: 24px;
  border-radius: 8px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.role-description-content h3 {
  margin: 0 0 12px 0;
  color: #2c3e50;
  font-size: 20px;
}

.role-description-content p {
  margin: 0;
  color: #495057;
  font-size: 15px;
  line-height: 1.6;
}

.role-description-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.role-description-close:hover {
  color: #2c3e50;
}

@media (max-width: 480px) {
  .role-description-content {
    padding: 20px;
    max-width: calc(100vw - 32px);
  }

  .help-icon {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
}

/* === UI CONTROL (outside boxes) === */
.ui-control {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.ui-control label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
}

.ui-control input[type="checkbox"] {
  transform: scale(1.1);
  cursor: pointer;
}

.hide-options {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.hide-options .hide-label {
  color: #666;
  font-weight: 600;
}

.hide-options label {
  font-weight: 400;
  color: #777;
}

.hide-options .separator {
  color: #999;
  margin: 0 2px;
}

/* === COLLAPSE CONTROLS === */
.collapse-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.collapse-controls button {
  padding: 4px 12px;
  font-size: 12px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.collapse-controls button:hover {
  background: #5a6268;
}

.collapse-controls button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.3);
}

/* Form field containers */
.form-field {
  margin-bottom: 10px;
}

.form-controls {
  margin-bottom: 15px;
}

.form-controls input[type="text"] {
  margin-right: 15px;
}

.form-controls button {
  margin-left: 5px;
}

input[type="text"], select {
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

button {
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

button:hover {
  background: #0056b3;
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

/* === COPY BUTTON STATES === */
#copy-url-button {
  position: relative;
  transition: all 0.3s ease;
  min-width: 120px;
}

#copy-url-button.success {
  background: #28a745;
  color: white;
}

#copy-url-button.success:hover {
  background: #218838;
}

#copy-url-button .button-text {
  transition: opacity 0.2s ease;
}

#copy-url-button .success-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

#copy-url-button.success .button-text {
  opacity: 0;
}

#copy-url-button.success .success-text {
  opacity: 1;
}

/* Checkmark icon using CSS */
.checkmark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checkmark::after {
  content: '';
  width: 4px;
  height: 8px;
  border: 2px solid #28a745;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

/* === VALIDATION WARNING BUTTON === */
/* Positioned in upper right, subtle styling similar to loading indicator */
/* Offset to the left to avoid overlapping with loading indicator */
.validation-warning {
  position: fixed;
  top: 8px;
  right: 120px;
  background: hsla(37, 100%, 96%, 0.85);
  color: white;
  padding: 4px 8px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 999;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.validation-warning:hover {
  background: rgba(255, 152, 0, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.validation-warning:active {
  transform: translateY(0);
}

.validation-warning:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.4);
}

.validation-warning .warning-icon {
  font-size: 12px;
  line-height: 1;
}

.validation-warning .warning-count {
  background: rgba(203, 44, 44, 1);
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: bold;
  min-width: 16px;
  text-align: center;
}

/* Pulse animation for warning button */
@keyframes pulse-warning {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
  }
}

/* Character count flash */
.char-count-flash {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 167, 69, 0.9);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  margin-top: 2px;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.4s ease-in-out;
  white-space: nowrap;
}

.char-count-flash.show {
  opacity: 1;
}

.char-count-flash.warning {
  background: rgba(255, 165, 0, 0.9);
  color: white;
}

.char-count-flash.danger {
  background: rgba(220, 53, 69, 0.9);
  color: white;
}

/* Loading indicator in top right */
.loading-indicator {
  position: fixed;
  top: 8px;
  right: 8px;
  background: rgba(0, 123, 255, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transition: opacity 0.3s ease-in-out;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.loading-indicator.show {
  opacity: 1;
}

/* Loading spinner animation */
.loading-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === HEX STATS SECTION === */
.hex-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Push square containers down to align with hexagons */
.hex-container:has(.shape-square) {
  margin-top: 20px;
}

/* Adjust title spacing for square shapes */
.hex-container:has(.shape-square) .hex-title {
  margin-top: 15px;
}

/* Push double-up containers down to align with hexagons */
.hex-container:has(.shape-double-up) {
  margin-top: 20px;
}

/* Adjust title spacing for double-up shapes */
.hex-container:has(.shape-double-up) .hex-title {
  margin-top: 15px;
}

/* Push clock containers down to align with hexagons and squares */
.hex-container:has(.stat-clock) {
  margin-top: -40px;
}

.hex-input-wrapper {
  width: 120px;
  aspect-ratio: 1;
  /* Default: black outline when not focused */
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,1 95,25 95,75 50,99 5,75 5,25" stroke="%23000000" stroke-width="2" fill="white"/></svg>') no-repeat center/contain;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  box-sizing: border-box;
  transition: background 0.3s ease;
}

/* Blue outline when input is focused */
.hex-input-wrapper:focus-within {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,1 95,25 95,75 50,99 5,75 5,25" stroke="%23007bff" stroke-width="2" fill="white"/></svg>') no-repeat center/contain;
}

/* Square shape variant */
.hex-input-wrapper.shape-square {
  width: 100px;
  height: 100px;
  background: white;
  border: none;
  position: relative;
  filter: url(#rough-edge);
  padding: 8px;
}

.hex-input-wrapper.shape-square::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 5px solid #000000;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 
    inset 1px 1px 0 rgba(0,0,0,0.1),
    inset -1px -1px 0 rgba(0,0,0,0.1),
    0 0 0 1px rgba(0,0,0,0.05);
  clip-path: polygon(
    0% 3%, 2% 0%, 4% 2%, 6% 0%, 8% 3%, 10% 1%, 
    12% 3%, 14% 0%, 16% 4%, 18% 1%, 20% 3%, 22% 0%,
    24% 2%, 26% 4%, 28% 1%, 30% 3%, 32% 0%, 34% 2%,
    36% 4%, 38% 1%, 40% 3%, 42% 0%, 44% 4%, 46% 2%,
    48% 4%, 50% 0%, 52% 2%, 54% 4%, 56% 1%, 58% 0%,
    60% 3%, 62% 1%, 64% 4%, 66% 2%, 68% 0%, 70% 3%,
    72% 1%, 74% 4%, 76% 0%, 78% 2%, 80% 4%, 82% 1%,
    84% 0%, 86% 3%, 88% 1%, 90% 0%, 92% 4%, 94% 2%,
    96% 0%, 98% 3%, 100% 1%, 100% 4%,
    /* Right edge */
    100% 6%, 98% 8%, 100% 10%, 97% 12%, 100% 14%, 98% 16%,
    100% 18%, 97% 20%, 100% 22%, 98% 24%, 100% 26%, 97% 28%,
    100% 30%, 98% 32%, 100% 34%, 97% 36%, 100% 38%, 98% 40%,
    100% 42%, 97% 44%, 100% 46%, 98% 48%, 100% 50%, 97% 52%,
    100% 54%, 98% 56%, 100% 58%, 97% 60%, 100% 62%, 98% 64%,
    100% 66%, 97% 68%, 100% 70%, 98% 72%, 100% 74%, 97% 76%,
    100% 78%, 98% 80%, 100% 82%, 97% 84%, 100% 86%, 98% 88%,
    100% 90%, 97% 92%, 100% 94%, 98% 96%, 100% 98%, 97% 100%,
    /* Bottom edge */
    96% 100%, 94% 98%, 92% 100%, 90% 97%, 88% 100%, 86% 98%,
    84% 100%, 82% 97%, 80% 100%, 78% 98%, 76% 100%, 74% 97%,
    72% 100%, 70% 98%, 68% 100%, 66% 97%, 64% 100%, 62% 98%,
    60% 100%, 58% 97%, 56% 100%, 54% 98%, 52% 100%, 50% 97%,
    48% 100%, 46% 98%, 44% 100%, 42% 97%, 40% 100%, 38% 98%,
    36% 100%, 34% 97%, 32% 100%, 30% 98%, 28% 100%, 26% 97%,
    24% 100%, 22% 98%, 20% 100%, 18% 97%, 16% 100%, 14% 98%,
    12% 100%, 10% 97%, 8% 100%, 6% 98%, 4% 100%, 2% 97%, 0% 100%,
    /* Left edge */
    0% 97%, 2% 95%, 0% 93%, 3% 91%, 0% 89%, 2% 87%,
    0% 85%, 3% 83%, 0% 81%, 2% 79%, 0% 77%, 3% 75%,
    0% 73%, 2% 71%, 0% 69%, 3% 67%, 0% 65%, 2% 63%,
    0% 61%, 3% 59%, 0% 57%, 2% 55%, 0% 53%, 3% 51%,
    0% 49%, 2% 47%, 0% 45%, 3% 43%, 0% 41%, 2% 39%,
    0% 37%, 3% 35%, 0% 33%, 2% 31%, 0% 29%, 3% 27%,
    0% 25%, 2% 23%, 0% 21%, 3% 19%, 0% 17%, 2% 15%,
    0% 13%, 3% 11%, 0% 9%, 2% 7%, 0% 5%, 3% 3%
  );
}

.hex-input-wrapper.shape-square:focus-within::before {
  border-color: #007bff;
}

/* Double-up shape variant (two half-height rectangles stacked) */
.hex-input-wrapper.shape-double-up {
  width: 100px;
  height: 148px;
  background: white;
  border: none;
  position: relative;
  filter: url(#rough-edge);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hex-input-wrapper.shape-double-up::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 5px solid #000000;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 
    inset 1px 1px 0 rgba(0,0,0,0.1),
    inset -1px -1px 0 rgba(0,0,0,0.1),
    0 0 0 1px rgba(0,0,0,0.05);
  clip-path: polygon(
    0% 3%, 2% 0%, 4% 2%, 6% 0%, 8% 3%, 10% 1%, 
    12% 3%, 14% 0%, 16% 4%, 18% 1%, 20% 3%, 22% 0%,
    24% 2%, 26% 4%, 28% 1%, 30% 3%, 32% 0%, 34% 2%,
    36% 4%, 38% 1%, 40% 3%, 42% 0%, 44% 4%, 46% 2%,
    48% 4%, 50% 0%, 52% 2%, 54% 4%, 56% 1%, 58% 0%,
    60% 3%, 62% 1%, 64% 4%, 66% 2%, 68% 0%, 70% 3%,
    72% 1%, 74% 4%, 76% 0%, 78% 2%, 80% 4%, 82% 1%,
    84% 0%, 86% 3%, 88% 1%, 90% 0%, 92% 4%, 94% 2%,
    96% 0%, 98% 3%, 100% 1%, 100% 4%,
    /* Right edge */
    100% 6%, 98% 8%, 100% 10%, 97% 12%, 100% 14%, 98% 16%,
    100% 18%, 97% 20%, 100% 22%, 98% 24%, 100% 26%, 97% 28%,
    100% 30%, 98% 32%, 100% 34%, 97% 36%, 100% 38%, 98% 40%,
    100% 42%, 97% 44%, 100% 46%, 98% 48%, 100% 50%, 97% 52%,
    100% 54%, 98% 56%, 100% 58%, 97% 60%, 100% 62%, 98% 64%,
    100% 66%, 97% 68%, 100% 70%, 98% 72%, 100% 74%, 97% 76%,
    100% 78%, 98% 80%, 100% 82%, 97% 84%, 100% 86%, 98% 88%,
    100% 90%, 97% 92%, 100% 94%, 98% 96%, 100% 98%, 97% 100%,
    /* Bottom edge */
    96% 100%, 94% 98%, 92% 100%, 90% 97%, 88% 100%, 86% 98%,
    84% 100%, 82% 97%, 80% 100%, 78% 98%, 76% 100%, 74% 97%,
    72% 100%, 70% 98%, 68% 100%, 66% 97%, 64% 100%, 62% 98%,
    60% 100%, 58% 97%, 56% 100%, 54% 98%, 52% 100%, 50% 97%,
    48% 100%, 46% 98%, 44% 100%, 42% 97%, 40% 100%, 38% 98%,
    36% 100%, 34% 97%, 32% 100%, 30% 98%, 28% 100%, 26% 97%,
    24% 100%, 22% 98%, 20% 100%, 18% 97%, 16% 100%, 14% 98%,
    12% 100%, 10% 97%, 8% 100%, 6% 98%, 4% 100%, 2% 97%, 0% 100%,
    /* Left edge */
    0% 97%, 2% 95%, 0% 93%, 3% 91%, 0% 89%, 2% 87%,
    0% 85%, 3% 83%, 0% 81%, 2% 79%, 0% 77%, 3% 75%,
    0% 73%, 2% 71%, 0% 69%, 3% 67%, 0% 65%, 2% 63%,
    0% 61%, 3% 59%, 0% 57%, 2% 55%, 0% 53%, 3% 51%,
    0% 49%, 2% 47%, 0% 45%, 3% 43%, 0% 41%, 2% 39%,
    0% 37%, 3% 35%, 0% 33%, 2% 31%, 0% 29%, 3% 27%,
    0% 25%, 2% 23%, 0% 21%, 3% 19%, 0% 17%, 2% 15%,
    0% 13%, 3% 11%, 0% 9%, 2% 7%, 0% 5%, 3% 3%
  );
}

/* Middle divider line */
.hex-input-wrapper.shape-double-up::after {
  content: '';
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  height: 5px;
  background: #000000;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.hex-input-wrapper.shape-double-up .double-up-half::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  pointer-events: none;
  z-index: 1;
}

.hex-input-wrapper.shape-double-up .double-up-top-half:focus-within::before {
  border-color: #007bff;
  border-bottom: none;
}

.hex-input-wrapper.shape-double-up .double-up-bottom-half:focus-within::before {
  border-color: #007bff;
  border-top: none;
}

.hex-input-wrapper.shape-double-up:focus-within::after {
  background: #007bff;
}

.hex-input-wrapper.shape-double-up .double-up-half {
  width: 100%;
  height: 50px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hex-input-wrapper.shape-double-up .double-up-middle-title {
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: white;
  border-top: 2px solid #000000;
  border-bottom: 2px solid #000000;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  padding: 4px 5px;
}

.hex-input-wrapper.shape-double-up .double-up-bottom-title {
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: white;
  border-top: 2px solid #000000;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  padding: 4px 5px;
}

.hex-input-wrapper.shape-double-up .double-up-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  background: transparent;
  color: #333;
  padding: 0 8px;
  box-sizing: border-box;
}

.hex-input-wrapper.shape-double-up .double-up-input::placeholder {
  color: #999;
  font-size: clamp(7px, 1.2vw, 9px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  opacity: 0.7;
}

.hex-input-wrapper.shape-double-up .double-up-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.hex-input-wrapper input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  background: transparent;
  color: #333;
}

/* Placeholder text styling to fit in hexagon */
.hex-input-wrapper input::placeholder {
  color: #999;
  font-size: clamp(7px, 1.2vw, 9px); /* Smaller to fit CONVICTION */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px; /* Even tighter spacing */
  opacity: 0.7;
  line-height: 1.1;
  max-width: 80px; /* Constrain to hex width */
  word-wrap: break-word;
}

/* Less restrictive placeholder for square */
.hex-input-wrapper.shape-square input::placeholder {
  font-size: clamp(7px, 1.2vw, 9px);
  max-width: none;
  letter-spacing: 0.2px;
}

/* Remove focus outline specifically for hex inputs */
.hex-input-wrapper input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.hex-title {
  text-align: center;
  font-weight: bold;
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === CLOCK STYLES === */
.clock-wrapper {
  position: relative;
  display: inline-block;
}

.stat-clock {
  width: 130px;
  height: 130px;
  cursor: pointer;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Clock floating inputs */
input.clock-floating-input {
  position: absolute;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.9);
  container-type: size;
  font-size: clamp(6px, 50cqh, 16px);
  padding: 1px;
  box-sizing: border-box;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

input.clock-floating-input:focus {
  outline: 1px solid #007bff;
  background: rgba(255, 255, 255, 1);
}

/* Clock error state */
.clock-error,
.stat-clock.clock-error {
  border: 2px solid #d9534f;
  background-color: #f8d7da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #721c24;
}

/* Debuffed modifier placeholder (red text) */
.debuffed-modifier::placeholder {
  color: #d9534f;
  opacity: 0.8;
}

/* === STAT TRACK COUNTER STYLES === */
.stat-track-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 10px;
  color: #555;
}

.stat-individual-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.stat-track-label {
  font-weight: 600;
  color: #666;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
}

/* Shapes wrapper allows placing a small end label after shapes */
.stat-track-shapes-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-track-end-label {
  font-size: 9px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.8;
}

/* Reuse track-shapes and track-shape styles from move tracks */
/* The .track-shapes and .track-shape classes are already defined below */

.hex-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 20px 0;
}

/* === MOVES SECTION === */
#moves-container {
  margin-top: 30px;
}

.move {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  margin-left: 24px;
  border-left: 2px solid #e9ecef;
  transition: box-shadow 0.2s, border-left-color 0.2s;
  position: relative;
}

.move:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-left-color: #007bff;
}

.move-title {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.move-title label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.move-title input[type="checkbox"] {
  transform: scale(1.2);
  margin: 0;
  flex-shrink: 0;
}

/* === MOVE COLLAPSE/EXPAND === */

.move-collapse-toggle {
  position: absolute;
  right: 3px;
  top: 3px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  font-size: 16px;
  font-weight: bold;
  color: #495057;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
  pointer-events: none; /* Clicks pass through to the title container */
  user-select: none;
}

/* Simple + and - symbols, no special collapsed styling needed */

/* Hide collapse functionality for moves nested inside granted cards and learned moves */
.granted-card .move-collapse-toggle,
.learned-move .move-collapse-toggle {
  display: none;
}

.granted-card .move-title,
.learned-move .move-title {
  cursor: default;
}

.granted-card .move-title[role="button"],
.learned-move .move-title[role="button"] {
  pointer-events: none;
}

/* === RESPONSIVE LAYOUT FOR MOVE TITLE === */
/* At medium screen sizes, ensure enough space for button */
@media (max-width: 1100px) {
  .move-title {
    padding-right: 35px; /* Make room for collapse button */
  }
}

/* === RESPONSIVE TRACK COUNTER === */
@media (max-width: 768px) {
  .track-counter {
    position: static;
    margin-top: 8px;
    margin-bottom: 8px;
    justify-content: flex-end;
    gap: 10px;
  }
  
  .move-title {
    flex-wrap: wrap;
    padding-right: 35px; /* Continue to make room for button */
  }
  
  .move-collapse-toggle {
    top: 3px; /* Keep close to border on mobile too */
    right: 5px;
  }
}

/* Move content styling for collapse/expand */
.move-content {
  transition: all 0.3s ease-out;
  overflow: hidden;
}

.move-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Multiple checkboxes styling */
.move-title-text {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
}

.move-checkboxes {
  display: flex;
  gap: 2px;
  align-items: center;
  margin: 0;
  padding: 0;
}

.move-checkboxes input[type="checkbox"] {
  margin: 0;
  padding: 0;
  transform: scale(1.2);
  cursor: pointer;
}

/* === SUBMOVES === */
.submove {
  margin: 15px 0;
}

.submove-title {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 8px;
}

.submove-description {
  background: #f8f9fa;
  border-left: 3px solid #6c757d;
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
}

.submove-description p {
  margin: 0;
}

/* === MOVE DESCRIPTIONS === */
.move-description {
  background: #f8f9fa;
  border-left: 3px solid #6c757d;
  padding: 8px 12px;
  margin: 10px 0;
  border-radius: 0 4px 4px 0;
}

.move-description p {
    margin: 0;
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
}

/* === MOVE DETAILS INPUT === */
.move-details {
    background: #f8f9fa;
    border-left: 3px solid #28a745;
    padding: 10px 12px;
    margin: 10px 0;
    border-radius: 0 4px 4px 0;
}

.move-details label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.move-details textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    resize: none; /* Disable manual resize since we auto-grow */
    overflow: hidden; /* Hide scrollbar since we auto-grow */
    font-family: inherit;
    line-height: 1.5;
    min-height: 48px; /* Minimum height for 2 rows */
}

.move-details textarea:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* === OUTCOMES === */
.outcome {
  background: white;
  border-left: 4px solid #17a2b8;
  padding: 10px;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
}

.outcome p {
  margin: 0 0 10px 0;
  color: #2c3e50;
}

.outcome-range {
  color: #17a2b8;
  font-weight: 600;
  display: inline;
}

.outcome-text {
  color: #2c3e50;
  display: inline;
}

.outcome ul {
  margin: 10px 0;
  padding-left: 20px;
}

.outcome li {
  margin-bottom: 5px;
  color: #495057;
}

/* === PICK OPTIONS === */
.pick-options {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding-left: 5px;
  padding-right: 5px;
  margin-top: 10px;
}

.pick-options label {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.pick-options label:hover {
  color: #007bff;
}

.pick-options input[type="checkbox"] {
  margin-right: 10px;
  transform: scale(1.1);
}

/* === PICK ONE OPTIONS === */
.pick-one-options {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding-left: 5px;
  padding-right: 5px;
  margin-top: 10px;
}

.pick-one-options label {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.pick-one-options label:hover {
  color: #007bff;
}

.pick-one-options input[type="radio"] {
  margin-right: 10px;
  transform: scale(1.1);
}

/* === MULTIPLE PICK INLINE === */
.pick-option-item,
.pick-one-option-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.pick-checkboxes,
.pick-one-radios {
  display: flex;
  gap: 0;
  margin-right: 10px;
}

.pick-checkboxes input,
.pick-one-radios input {
  margin: 0;
  transform: scale(1.1);
}

.pick-option-text,
.pick-one-option-text {
  font-weight: normal;
  color: #2c3e50;
}

/* === 2-COLUMN LAYOUT FOR LARGE PICK LISTS === */
.pick-list-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  list-style: none;
  padding: 0;
  margin: 10px 0;
}

/* On smaller screens, fallback to single column */
@media (max-width: 768px) {
  .pick-list-columns {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* === TAKEFROM OPTIONS === */
.takeFrom-options {
  /* Minimal container - no background or border */
  margin-top: 10px;
}

.takeFrom-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.takeFrom-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #555;
  font-size: 13px;
}

.takeFrom-controls select {
  min-width: 140px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  font-size: 13px;
}

.takeFrom-controls select:focus {
  border-color: #1976d2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.takeFrom-controls select:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

/* === MULTIPLE TAKEFROM INSTANCES === */
.takeFrom-instances {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.takeFrom-instance {
  /* Minimal - just a subtle left border */
  border-left: 3px solid #e0e0e0;
  padding-left: 10px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.takeFrom-instance:first-child {
  /* No special styling */
}

.learned-moves-container {
  margin-top: 15px;
}

.learned-moves-container .learned-move-container {
  margin-top: 10px;
}

.learned-moves-container .learned-move-container:first-child {
  margin-top: 0;
}

/* === GRANTED CARD DISPLAY === */
.granted-card-options {
  /* Minimal - just a label, no heavy borders */
  margin-top: 10px;
  padding-left: 5px;
}

.granted-card-options strong {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.granted-card-container {
  margin-top: 8px;
}

.granted-card {
  /* No extra wrapper styling - let the card speak for itself */
  margin: 0;
}

.granted-card .card {
  background: #ffffff;
  border: 1px solid #ddd;
  margin: 0;
}

.granted-card .card-title {
  margin-bottom: 10px;
}

/* === LEARNED MOVE DISPLAY === */
.learned-move-container {
  margin-top: 8px;
}

.learned-move {
  /* Minimal - no heavy background or border */
  border-left: 3px solid #1976d2;
  padding-left: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.learned-move::before {
  /* Remove the "Learned Move:" label for cleaner look */
  display: none;
}

.learned-move .move-title {
  margin-bottom: 8px;
}

.learned-move .outcome {
  background: #fafafa;
  border-left: 3px solid #1976d2;
  margin: 6px 0;
}

.learned-move .pick-options {
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.card-wrapper {
  margin-bottom: 25px;
  position: relative;
}

.card {
  background: #ffffff;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s;
}

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

.card-title {
  color: #2c3e50;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === CARD COLLAPSE/EXPAND === */
.card-collapse-toggle {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  font-size: 16px;
  font-weight: bold;
  color: #495057;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  margin-left: 10px;
}

.card-collapse-toggle:hover {
  background: #e9ecef;
}

/* Card content styling for collapse/expand */
.card-content {
  transition: all 0.3s ease-out;
  overflow: hidden;
}

.card-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Reduce card title padding when collapsed */
.card-wrapper.collapsed .card-title {
  padding-bottom: 2px;
  margin-bottom: 2px;
}

/* Reduce card padding when collapsed */
.card-wrapper.collapsed .card {
  padding: 8px 12px;
}

/* Reduce card wrapper margin when collapsed */
.card-wrapper.collapsed {
  margin-bottom: 4px;
}

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

.card-section:last-child {
  margin-bottom: 0;
}

.card-section h4 {
  color: #495057;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 15px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card .form-field {
  margin-bottom: 15px;
}

.card .form-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #555;
}

.card input[type="text"],
.card input[type="number"],
.card select,
.card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.card input[type="text"]:focus,
.card input[type="number"]:focus,
.card select:focus,
.card textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.card textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}


/* Error state */
.card-error {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.card-error h3 {
  color: #721c24;
  margin: 0 0 10px 0;
}

.card-error p {
  margin: 0;
  font-weight: normal;
}

.card-error .error-help {
  margin-top: 10px;
  padding: 10px;
  background: #fff3cd;
  border-left: 3px solid #856404;
  font-size: 0.9em;
}

.card-error .error-details {
  margin-top: 10px;
  opacity: 0.7;
  font-size: 0.85em;
}

/* Loading state */
.card-loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-style: italic;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* === SECTION STYLING === */
h3 {
  color: #2c3e50;
  font-size: 1.2em;
  margin: 20px 0 15px 0;
  font-weight: 600;
}

/* === TREE-STYLE CATEGORY COLLAPSE === */
.category-header.tree-node {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
  padding: 4px 8px;
  margin: 15px 0 8px 0;
  border-radius: 4px;
  font-size: 1.1em;
  font-weight: 600;
  color: #2c3e50;
  background: transparent;
}

.category-header.tree-node:hover {
  background: #f8f9fa;
}

.category-header.tree-node:focus {
  outline: none;
  background: #e9ecef;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.tree-triangle {
  font-size: 12px;
  color: #6c757d;
  transition: color 0.2s ease;
  min-width: 16px;
  text-align: center;
  pointer-events: none;
}

.category-header-text {
  flex-grow: 1;
  font-weight: 600;
  color: inherit;
}

.category-move-count {
  font-size: 0.9em;
  color: #6c757d;
  font-weight: normal;
  opacity: 0.8;
}

/* Tree hierarchy is now handled by the main .move styles above */


/* === DIVIDERS === */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, #dee2e6, transparent);
  margin: 30px 0;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
  form {
    padding: 20px;
    margin: 10px;
  }
  
  /* Character info box - remove margins in compact mode */
  .character-info-box {
    margin-bottom: 8px;
    padding: 12px;
  }
  
  .basic-info {
    gap: 8px;
    margin-bottom: 10px;
  }
  
  /* Role controls - reduce gap on mobile */
  .role-controls {
    gap: 10px;
  }

  .hex-container:has(.stat-clock) {
    margin-top: -10px;
  }

  .move {
    padding: 15px;
  }
  
  .move-checkboxes {
    gap: 1px;
  }
  
  .move-checkboxes input[type="checkbox"] {
    transform: scale(1.0);
  }
}

/* === VERY NARROW SCREENS (Foldable phones and narrow devices) === */
/* Breakpoint: 480px - change here and in ship/card.css if needed */
@media (max-width: 480px) {
  /* Remove ALL margins and minimal padding */
  * {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  html {
    margin: 0 !important;
    padding: 0 !important;
  }
  
  body {
    padding: 8px 2px !important;
    margin: 0 !important;
  }
  
  /* Reduce form margins and padding */
  form {
    padding: 12px 4px !important;
    margin: 0 !important;
    border-radius: 4px;
    max-width: none !important;
    width: calc(100vw - 4px) !important;
    box-sizing: border-box !important;
  }
  
  /* Reduce card padding */
  .card {
    padding: 12px 8px;
    border-radius: 4px;
  }
  
  .card-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 8px;
  }
  
  /* Reduce move padding */
  .move {
    padding: 12px 8px;
    margin-bottom: 15px;
  }

  .hex-container:has(.stat-clock) {
    margin-top: 0px;
  }

  /* Reduce various section margins */
  .card-section {
    margin-bottom: 15px;
  }
  
  h3 {
    margin: 15px 0 10px 0;
    font-size: 1.1em;
  }
  
  /* Compress pick options */
  .pick-options,
  .pick-one-options,
  .takeFrom-options {
    padding: 10px 8px;
    margin-top: 10px;
  }
  
  /* Reduce form field spacing */
  .form-field {
    margin-bottom: 8px;
  }
  
  .form-controls {
    margin-bottom: 12px;
  }
  
  /* Reduce outcome padding */
  .outcome {
    padding: 12px 10px;
    margin: 8px 0;
  }
  
  /* Compress track counter */
  .track-counter {
    gap: 10px;
  }
  
  .track-counter-grid .track-shape {
    width: 12px;
    height: 12px;
  }
  
  .track-shape {
    width: 12px;
    height: 12px;
  }
  
  /* Reduce divider margins */
  hr {
    margin: 20px 0;
  }
  
  
  .card-wrapper {
    margin-bottom: 20px;
  }
}

/* === TRACK COUNTER STYLES === */
.track-counter {
  position: absolute;
  top: 0;
  right: 32px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 12px;
  color: #555;
  z-index: 200;
  pointer-events: auto; /* Re-enable clicks even when parent has pointer-events: none */
}

/* Override absolute positioning for tracks inside cards */
.card .track-counter {
  position: static;
  margin: 8px 0;
  justify-content: flex-start;
}

/* Grid layout for many tracks (>3) - using flex flow */
.track-counter-grid {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  margin: 8px 0;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 12px;
  color: #555;
}

.individual-track {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 1;
}

/* Individual tracks within flex layout */
.track-counter-grid .individual-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  transition: box-shadow 0.2s;
  flex: 0 0 auto;
  min-width: 70px;
  max-width: 200px;
}

.track-counter-grid .individual-track:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.track-counter-grid .track-label {
  text-align: center;
  font-size: 10px;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.track-counter-grid .track-shapes {
  justify-content: center;
  gap: 2px;
  flex-wrap: wrap;
}

.move-title {
  position: relative; /* Needed for absolute positioning of track counter */
}

.track-label {
  font-weight: 600;
  color: #495057;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.track-max-button {
  font-size: 9px;
  padding: 1px 4px;
  margin-left: 4px;
  background: #f8f9fa;
  border: 1px solid #6c757d;
  border-radius: 2px;
  cursor: pointer;
  color: #495057;
  font-weight: normal;
  text-transform: lowercase;
  transition: all 0.2s ease;
}

.track-max-button:hover {
  background: #e9ecef;
  border-color: #495057;
}

.track-shapes {
  display: flex;
  gap: 2px;
  align-items: center;
}

.track-dash {
  font-size: 18px;
  font-weight: bold;
  color: #6c757d;
  padding: 0 4px;
}

.track-shape {
  width: 16px;
  height: 16px;
  border: 2px solid #6c757d;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.track-shape:hover {
  border-color: #495057;
  transform: scale(1.1);
}

.track-shape.filled:not(.track-triangle):not(.track-hexagon) {
  background: #b0b0b0; /* soft medium gray */
  border-color: #8c8c8c; /* slightly darker gray */
}

.track-shape.filled:hover:not(.track-triangle):not(.track-hexagon) {
  background: #8c8c8c; /* darker gray on hover */
  border-color: #6e6e6e; /* even darker border on hover */
}

/* Shape-specific styles */
.track-square {
  border-radius: 2px;
}

.track-circle {
  border-radius: 50%;
}

.track-hexagon {
  width: 16px;
  height: 16px;
  border: none;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,1 95,25 95,75 50,99 5,75 5,25" stroke="%236c757d" stroke-width="12" fill="transparent"/></svg>') no-repeat center/contain;
  transition: all 0.2s ease;
}

.track-hexagon:hover {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,1 95,25 95,75 50,99 5,75 5,25" stroke="%23495057" stroke-width="12" fill="transparent"/></svg>') no-repeat center/contain;
  transform: scale(1.1);
}

.track-shape.track-hexagon.filled {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,1 95,25 95,75 50,99 5,75 5,25" stroke="%238c8c8c" stroke-width="12" fill="%23b0b0b0"/></svg>') no-repeat center/contain;
}

.track-shape.track-hexagon.filled:hover {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,1 95,25 95,75 50,99 5,75 5,25" stroke="%236e6e6e" stroke-width="12" fill="%238c8c8c"/></svg>') no-repeat center/contain;
  transform: scale(1.1);
}

.track-triangle {
  width: 16px;
  height: 16px;
  border: none;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" style="background:transparent"><polygon points="50,10 85,80 15,80" stroke="%236c757d" stroke-width="8" fill="transparent"/></svg>') no-repeat center/contain;
  background-color: transparent;
  transition: all 0.2s ease;
}

.track-triangle:hover {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,10 85,80 15,80" stroke="%23495057" stroke-width="8" fill="transparent"/></svg>') no-repeat center/contain;
  transform: scale(1.1);
}

.track-shape.track-triangle.filled {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,10 85,80 15,80" stroke="%238c8c8c" stroke-width="8" fill="%23b0b0b0"/></svg>') no-repeat center/contain;
}

.track-shape.track-triangle.filled:hover {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,10 85,80 15,80" stroke="%236e6e6e" stroke-width="8" fill="%238c8c8c"/></svg>') no-repeat center/contain;
  transform: scale(1.1);
}


/* Add a subtle inner shadow for filled shapes */
.track-shape.filled::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  bottom: 1px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: inherit;
}

.stats-help
{
  font-style: italic;
  text-align: center;
  font-size: small;
}

/* Responsive adjustments for track display */
@media (max-width: 768px) {
  .track-counter {
    position: static;
    align-items: flex-start;
    margin-top: 8px;
  }
  
  .track-counter-grid {
    gap: 4px;
    padding: 6px;
  }
  
  .track-counter-grid .individual-track {
    padding: 4px;
    min-width: 60px;
  }
  
  .track-shape {
    width: 14px;
    height: 14px;
  }
  
  .takeFrom-controls {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  .takeFrom-controls label {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .takeFrom-controls select {
    min-width: 100%;
  }
  
  /* Card responsive styles */
  .card {
    padding: 15px;
  }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Focus indicators - exclude hex inputs */
*:focus:not(.hex-input-wrapper input) {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* === WIZARD MODAL === */
.wizard-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.wizard-content {
  background: white;
  padding: 24px;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.wizard-content h3 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-size: 22px;
}

.wizard-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.wizard-close:hover {
  color: #2c3e50;
}

.wizard-auto-items {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}

.wizard-auto-items h4 {
  margin: 0 0 12px 0;
  color: #495057;
  font-size: 16px;
  font-weight: 600;
}

.wizard-auto-items ul {
  margin: 0;
  padding-left: 24px;
  list-style-type: disc;
}

.wizard-auto-items li {
  color: #495057;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 4px;
}

.wizard-choices {
  margin-bottom: 20px;
}

.wizard-choice-group {
  margin-bottom: 20px;
  padding: 16px;
  background: #ffffff;
  border: 2px solid #e1e5e9;
  border-radius: 6px;
}

.wizard-choice-group h4 {
  margin: 0 0 12px 0;
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
}

.wizard-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wizard-option {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.wizard-option:hover {
  background: #f8f9fa;
  border-color: #007bff;
}

.wizard-option input[type="radio"],
.wizard-option input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
}

.wizard-option label {
  flex: 1;
  cursor: pointer;
  margin: 0;
}

.wizard-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e9ecef;
}

.wizard-actions button {
  padding: 10px 20px;
  border-radius: 4px;
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.wizard-cancel {
  background: #6c757d;
  color: white;
}

.wizard-cancel:hover {
  background: #5a6268;
}

.wizard-ok {
  background: #28a745;
  color: white;
}

.wizard-ok:hover {
  background: #218838;
}

@media (max-width: 640px) {
  .wizard-content {
    padding: 16px;
    max-height: 90vh;
  }

  .wizard-content h3 {
    font-size: 18px;
  }

  .wizard-option {
    padding: 8px 10px;
  }
}

/* === STATS PICKER - Drag and Drop Interface === */
.stats-picker-active {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: #666;
}

.stats-picker-header {
  font-size: 12px;
  font-weight: 500;
}

.stats-picker-values {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#stats-picker-close-btn {
  padding: 4px 12px;
  font-size: 12px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#stats-picker-close-btn:hover {
  background: #5a6268;
}

.stat-value-chip {
  background: #f0f0f0;
  color: #333;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  cursor: grab;
  user-select: none;
  border: 1px solid #ddd;
  transition: all 0.15s ease;
  min-width: 28px;
  text-align: center;
}

.stat-value-chip:hover {
  background: #e8e8e8;
  border-color: #bbb;
}

.stat-value-chip:active,
.stat-value-chip.dragging {
  cursor: grabbing;
  opacity: 0.5;
  transform: scale(0.95);
}

/* Drop target highlighting */
.clock-floating-input.stat-drop-target {
  background: #e3f2fd !important;
  border: 2px dashed #667eea !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Highlight entire clock when it's a valid drop target */
.stat-clock.stat-drop-target {
  outline: 3px solid #667eea;
  outline-offset: 2px;
  opacity: 0.9;
}

/* Responsive design */
@media (max-width: 640px) {
  .stats-picker-active {
    gap: 6px;
  }

  .stats-picker-header {
    font-size: 11px;
  }

  .stat-value-chip {
    padding: 3px 8px;
    font-size: 12px;
    min-width: 24px;
  }

  .stats-picker-values {
    gap: 4px;
  }
}
