:root {
  --primary: #1a365d;
  --secondary: #c53030;
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --border: #e2e8f0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}


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


.c-stage-product {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
}

.c-stage-product__title {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.c-stage-product__subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.c-stage-product__grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .c-stage-product__grid {
    grid-template-columns: 1fr;
  }
  .c-stage-product {
    padding: 0;
    box-shadow: none;
  }
  .container .c-product-details {
    padding: 0;
    box-shadow: none;
  }
}

.c-stage-product__description {
  font-size: 15px;
  line-height: 1.7;
}

.c-stage-product__description p {
  margin-bottom: 16px;
}

.c-stage-product__description strong {
  color: var(--primary);
}

.c-stage-product__image {
  width: 260px;
  height: 260px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}

.c-stage-product__image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (max-width: 900px) {
  .c-stage-product__image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 420px;
    margin: 0 auto;
  }
}

.c-product-detail-image {
  margin: 30px 0;
  text-align: center;
}

.c-product-detail-image a {
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.c-product-detail-image img {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.img-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}


.c-product-details {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
}

.c-product-details__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

.c-product-detail-specifications {
  background: var(--bg-secondary);
  font-size: 15px;
  line-height: 1.7;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.c-product-table__table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  border-radius: 1px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  min-width: 800px;
}

th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  padding: 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

tr[position="2"] th,
tr[position="3"] th {
  background: #0f2942;
  font-size: 12px;
  padding: 2px;
}

td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-primary);
}

td[attname="SIZE_ROTEX_ROTEX-GS_SEL"] {
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-secondary);
}

td[lookup*="92 ShA"] {
  background: #fff7ed;
  color: #9a3412;
  font-weight: 600;
}

td[lookup*="98 ShA"] {
  background: #faf5ff;
  color: #6b21a8;
  font-weight: 600;
}

td[lookup*="64 ShD"] {
  background: #f0fdf4;
  color: #166534;
  font-weight: 600;
}

tbody tr:hover td {
  background-color: #f8fafc;
}

tr[thissize]:nth-child(even) td {
  background-color: #fafafa;
}

tr[thissize]:nth-child(even):hover td {
  background-color: #f1f5f9;
}

.c-button {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--primary);
  margin-top: 15px;
}

.c-button:hover {
  background: var(--primary);
  color: white;
}

.c-product-table__toggle {
  width: 100%;
}

.c-product-table__table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 90vh;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

tr[position="1"] {
  position: sticky;
  top: 0;
  z-index: 22;
  height: 44px;
}

tr[position="2"] {
  position: sticky;
  top: 44px;
  z-index: 21;
  height: 32px;
}

tr[position="3"] {
  position: sticky;
  top: 76px;  /* 44 + 32 */
  z-index: 20;
  height: 32px;
}

tr[islast="true"][position="2"] {
  top: 44px;
  z-index: 20;
}

tr[islast="true"][position="2"] ~ tr[position="3"] {
  display: none;
}

tr[position="1"] th,
tr[position="2"] th,
tr[position="3"] th {
  height: 100% !important;
  min-height: unset !important;
  max-height: none !important;
  box-sizing: border-box;
  line-height: 1.2;
}

tr[position="1"] th {
  background: var(--primary);
  padding: 12px;
  font-size: 14px;
}

tr[position="2"] th,
tr[position="3"] th {
  background: #0f2942;
  font-size: 12px;
  padding: 2px 12px;
}

tr[position="1"] th:first-child {
  position: sticky;
  left: 0;
  z-index: 32;
  box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

td[attname="SIZE_ROTEX_ROTEX-GS_SEL"] {
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  min-width: 800px;
}

td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-primary);
}

@media screen and (max-width: 768px) {
  table { font-size: 12px; }
  th, td { padding: 8px; }
}


@media screen and (max-width: 768px) {
  table { font-size: 12px; }
  th, td { padding: 8px; }
}


.c-text-media__text-box {
  max-width: 100%;
}

.richtext p {
  margin-bottom: 16px;
  color: var(--text-primary);
  line-height: 1.7;
}

.richtext strong {
  color: var(--primary);
  font-weight: 700;
}

debug, result {
  display: none;
}

tr[thissize] {
  cursor: pointer;
  transition: all 0.2s ease;
}

tr[thissize].selected {
  background-color: #e3f2fd;
  outline: 2px solid #2196f3;
}

tr[thissize].selected td {
  font-weight: bold;
  color: #1565c0;
}

tr[thissize]:hover {
  background-color: #f5f5f5;
}

.c-stage-product__media {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}
 
.grid {
    display: grid;
    width: 100%;
    gap: 25px;
}
 
.card {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
 
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
 
.card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background-color: #ffffff;
}
 
.card-title {
    padding: 15px;
    text-align: center;
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    border-top: 1px solid #eee;
}

.viewer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(240, 240, 240, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
 
.viewer-overlay.active {
    display: flex;
}
 
.viewer-wrapper {
    display: flex;
    flex-direction: row;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.doubleclick {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    
    color: rgba(79, 79, 79, 0.85);
    font-size: 16px;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
    z-index: 5;
}
 
.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px 20px;
    overflow: hidden;
    background: #fff;
    min-width: 400px;
    min-height: 300px;
}
 
.viewer-iframe {
    width: 100%;
    height: 100%;
    min-width: 760px;
    min-height: 460px;
    border: none;
    background: white;
    border-radius: 8px;
    transition: transform 0.2s ease;
}
 
.viewer-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 15px;
    background: #f5f5f5;
    border-left: 1px solid #e0e0e0;
    min-width: 60px;
}
 
.viewer-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    max-height: 200px;
    overflow: hidden;
}
 
.close-btn {
    background: #ff4444;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
}
 
.close-btn:hover {
    background: #ff6666;
    transform: scale(1.05);
}
 
.zoom-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}
 
.zoom-slider-track {
    position: relative;
    width: 6px;
    height: 160px;
    background: #d0d0d0;
    border-radius: 3px;
    cursor: pointer;
    touch-action: none;
}
 
.zoom-slider-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #4a90d9;
    border-radius: 3px;
    pointer-events: none;
}
 
.zoom-slider-thumb {
    position: absolute;
    width: 32px;
    height: 32px;
    left: 50%;
    margin-left: -16px;
    background: #4a90d9;
    border: 3px solid #ffffff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    touch-action: none;
    transition: box-shadow 0.15s ease;
}
 
.zoom-slider-thumb:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
 
.zoom-slider-thumb:active {
    cursor: grabbing;
}
 
.zoom-slider-thumb svg {
    width: 16px;
    height: 16px;
    fill: white;
    pointer-events: none;
}
 
.zoom-btn-end {
    background: #6c757d;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}
 
.zoom-btn-end:hover {
    background: #5a6268;
    transform: scale(1.05);
}
 
.zoom-btn-end.plus {
    background: #28a745;
}
 
.zoom-btn-end.plus:hover {
    background: #218838;
}
 
.zoom-btn-end.minus {
    background: #dc3545;
}
 
.zoom-btn-end.minus:hover {
    background: #c82333;
}
 
.video-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
}

.video-container .ktr-video {
    flex: 1 1 auto;
    width: 100%;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.video-container div:last-child {
    flex-shrink: 0;
    background: #000000;
    padding: 10px;
}
 
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
 
@media (max-width: 900px) {
    h1 {
        font-size: 1.5rem;
    }
 
    .c-stage-product__media {
        grid-template-columns: 1fr;
        align-items: start;
    }
 
    .viewer-wrapper {
        flex-direction: column;
        max-width: 95vw;
        max-height: 95vh;
    }
 
    .viewer-sidebar {
        flex-direction: row;
        border-left: none;
        border-top: 1px solid #e0e0e0;
        padding: 10px 15px;
        justify-content: center;
        align-items: center;
    }
 
    .viewer-title {
        display: none;
    }
 
    .viewer-content {
        min-width: 300px;
        min-height: 200px;
    }
 
    .viewer-iframe {
        min-width: 300px;
        min-height: 200px;
    }
 
    .zoom-slider-container {
        flex-direction: row;
        height: 44px;
    }
 
    .zoom-btn-end.minus { order: -1; }
    .zoom-btn-end.plus  { order:  1; }
 
    .zoom-slider-track {
        width: 160px;
        height: 6px;
    }
 
    .zoom-slider-fill {
        bottom: auto;
        top: 0;
        left: 0;
        height: 100%;
        width: 0;
    }
 
    .zoom-slider-thumb {
        left: 0;
        margin-left: -16px;
        top: 50%;
        margin-top: -16px;
        bottom: auto;
    }
    .doubleclick {
        display: none;
    }
}

.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}
 
@keyframes spin {
    to { transform: rotate(360deg); }
}