:root {
  --accent: #d00024;
  --gray: #888;
  --bg: #fafafa;
  --border: #ddd;
  --pad: 2rem;
  --radius: .5rem;
  --mpad: 1rem;
}

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

body {
  font-family: Roboto, 'Noto Sans HK', Arial, sans-serif;
  background: #474a51;
  color: #ffffff;
  padding-bottom: 60px;
}

h1, h2, h3 {
  text-align: center;
  margin: 1rem 0;
}

h3 {
  margin-bottom: 1rem;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: var(--pad);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
}

#product-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding-bottom: 4rem;
}

.product-option {
  position: relative;
  text-align: center;
  height: 210px;
  display: grid;
  align-items: center;
  justify-content: center;
}

.product-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.product-option img {
  max-width: 100%;
  max-height: 210px;
  object-fit: contain;
  border: 2px solid transparent;
  border-radius: var(--radius);
  display: block;
}

.product-option input:checked+img {
  border-color: var(--accent);
  border-width: medium;
}

.product-option span {
  display: block;
  font-size: .9rem;
  margin-top: .25rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.controls label {
  font-size: .9rem;
  margin-right: .25rem;
}

.controls input[type="text"] {
  width: 250px;
  height: 33px;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.controls select {
  height: 33px;
  border-radius: 7px;
}

select[id^="weight-"] {
  width: 133px;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 1168px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #eaeaea;
  overflow: hidden;
  touch-action: none;
  margin: auto;
}

.canvas-wrapper canvas {
  border-radius: var(--radius);
}

canvas {
  display: block;
  touch-action: none;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #555;
  visibility: hidden;
  z-index: 10;
}

.bbox {
  position: absolute;
  border: 1px dashed #000;
  pointer-events: none;
  display: none;
  z-index: 30;
}

.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1px solid #000;
  pointer-events: auto;
  z-index: 31;
}

.handle[data-handle="nw"] {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}

.handle[data-handle="ne"] {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}

.handle[data-handle="sw"] {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}

.handle[data-handle="se"] {
  bottom: -5px;
  right: -5px;
  cursor: nwse-resize;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  margin: 0 .25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

button[disabled] {
  opacity: .4;
  cursor: not-allowed;
}

button.off {
  background: var(--gray);
}

.material-symbols-outlined {
  font-size: 24px;
  vertical-align: middle;
}

#edit-zone .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

.same-content {
  display: block;
  margin-top: .5rem;
}

.knife-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 1rem;
}

.navigation {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: rgb(51, 57, 68);
  padding: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  z-index: 100;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  margin: 20px 0;
  width: auto;
  max-width: 510px;
  border-radius: 18px;
  box-shadow: 0px 0px 5px #2f3138;
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-item {
  text-align: center;
}

.preview-item img {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.preview-item span {
  display: block;
  font-size: .9rem;
  margin-top: .5rem;
}

.preview-description {
  text-align: center;
  font-size: .9rem;
  color: #666;
  margin-bottom: 1rem;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .5rem;
}

.modal img {
  max-width: 90%;
  max-height: 85%;
  border-radius: var(--radius);
}

.modal span {
  color: #fff;
  font-size: 1rem;
}

#lang-toggle {
  display: none;
  margin: 0 auto 1rem;
  padding: .5rem 1rem;
  text-align: center;
}

#page-1.active #lang-toggle {
  display: block;
}

.knife-section p {
  margin: 11px 0px;
  color: #a5a5a5 !important;
}

div#page-1 {
  color: #4c4c4c;
}

.button-guide {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 1rem;
}

.button-guide h3 {
  margin-bottom: 1rem;
  color: #000;
}

.button-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.button-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.guide-button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .6rem;
  border-radius: var(--radius);
  cursor: default;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.button-desc h4 {
  font-size: 1rem;
  margin-bottom: .25rem;
  color: #333;
}

.button-desc p {
  font-size: .9rem;
  color: #666;
  margin-bottom: .25rem;
}

.alert-content {
  background: #fff;
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  max-width: 90%;
  width: 400px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.alert-content p {
  color: #333;
  font-size: 1rem;
  margin-bottom: 1rem;
}

#alert-close {
  background: var(--accent);
  color: #fff;
  padding: .5rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-block;
}

.disclaimer {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 1rem;
}

.disclaimer h3 {
  margin-bottom: 1rem;
  color: #000;
}

.disclaimer p {
  font-size: .9rem;
  color: #666;
  line-height: 1.5;
}
.progress-section {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem auto;
  padding: 0.5rem;
  gap: 0.5rem; /* Adjust gap for steps and separators */
  /* background-color: #fff; */
  width: 100%;
  max-width: 1200px; /* Match .container width, adjust if different */
  box-sizing: border-box;
  flex-wrap: wrap;
  border: 1px solid #ddd; /* Match assumed .page/.section border */
  border-radius: 8px; /* Match assumed .page/.section radius */
}

.progress-step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: #e0e0e0;
  color: #666;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.3s, color 0.3s;
}

.progress-step.active {
  background-color: var(--accent, #007bff); /* Fallback to #007bff if --accent undefined */
  color: #fff;
  font-weight: bold;
}

.progress-step.preview {
  background-color: #e0e0e0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-step.preview.active {
  background-color: #ff0000;
  color: #fff;
}

.progress-step .material-symbols-outlined {
  font-size: 1.5rem;
  color: #666;
}

.progress-step.preview.active .material-symbols-outlined {
  color: #fff;
}

.progress-separator {
  color: #666;
  font-size: 1rem;
  display: flex;
  align-items: center;
}

@media (max-width: 600px) {
  .container {
    padding: var(--mpad);
  }

  .controls {
    flex-direction: column;
    align-items: flex-start;
    display: block;
  }

  .controls div {
    margin: 10px 0px;
  }

  .controls input[type="text"] {
    width: 100%;
    max-width: 250px;
  }

  button {
    padding: .5rem;
    font-size: .9rem;
  }

  .material-symbols-outlined {
    font-size: 20px;
  }

  #lang-toggle {
    margin: 0 auto .5rem;
    padding: .4rem .8rem;
    font-size: .9rem;
  }

  .modal span {
    font-size: .9rem;
  }

  .button-guide {
    padding: .5rem;
  }

  .button-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .guide-button {
    padding: .5rem;
    min-width: 36px;
  }

  .button-desc h4 {
    font-size: .9rem;
  }

  .button-desc p {
    font-size: .8rem;
  }

  .disclaimer {
    padding: .5rem;
  }

  .disclaimer h3 {
    font-size: 1rem;
  }

  .disclaimer p {
    font-size: .8rem;
  }
  .progress-section {
    padding: 0.5rem;
    border-radius: 6px; /* Slightly smaller radius on mobile, adjust if needed */
  }

  .progress-step {
    font-size: 0.9rem;
  }

  .progress-step .material-symbols-outlined {
    font-size: 1.2rem;
  }

  .progress-separator {
    font-size: 0.9rem;
  }
}
