:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #2563eb;
  --accent-soft: #1d4ed8;
  --danger: #dc2626;
  --border: #374151;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 80%) minmax(200px, 20%);
  min-height: 100vh;
  gap: 16px;
  padding: 16px;
}

.left-column,
.right-column {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.left-column h1 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.player-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #000;
}

#player-host {
  width: 100%;
  height: 100%;
  position: relative;
}

.product-overlay {
  position: absolute;
  max-width: 22%;
  min-width: 110px;
  display: none;
  z-index: 8;
}

.product-overlay--topleft   { top: 12px;  left: 12px;  right: auto; bottom: auto; }
.product-overlay--topcenter { top: 12px;  left: 50%;   right: auto; bottom: auto; transform: translateX(-50%); }
.product-overlay--topright  { top: 12px;  right: 12px; left: auto;  bottom: auto; }
.product-overlay--botleft   { bottom: 52px; left: 12px;  right: auto; top: auto; }
.product-overlay--botcenter { bottom: 52px; left: 50%;   right: auto; top: auto; transform: translateX(-50%); }
.product-overlay--bottomright { bottom: 52px; right: 12px; left: auto;  top: auto; }

.product-overlay-mini,
.product-overlay-full {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.product-overlay-mini {
  font-size: 0.9rem;
  background: #fff;
  color: #000;
  padding: 6px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.product-overlay-mini a {
  color: #000;
  text-decoration: underline;
}

.product-overlay-expand-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.product-overlay-full {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.product-overlay--display-full .product-overlay-mini { display: none; }
.product-overlay--display-full .product-overlay-full { display: flex; }
.product-overlay--display-full .product-overlay-collapse-btn { display: none; }

.product-overlay--display-mini .product-overlay-full { display: none; }
.product-overlay--display-mini.is-expanded .product-overlay-mini { display: none; }
.product-overlay--display-mini.is-expanded .product-overlay-full { display: flex; }

.product-overlay-collapse-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 4px;
  background: #fff;
  color: #000;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  order: -1;
}

.product-overlay-full a {
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.product-overlay-full img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  background: #111;
}

.custom-scrub {
  margin-top: 10px;
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: #111827;
  border: 1px solid var(--border);
  overflow: hidden;
}

.custom-scrub-progress {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width 120ms linear;
}

.custom-scrub-markers {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.custom-scrub-markers--hidden {
  visibility: hidden;
  opacity: 0;
}

.custom-marker {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
}

.custom-marker-segment {
  min-width: 2px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.section {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.section h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.section-subtitle {
  margin: 14px 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
}
.section-subtitle:first-child {
  margin-top: 0;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.84rem;
  color: #d1d5db;
}

.status {
  margin-top: 8px;
  min-height: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: #fca5a5;
}

.status.success {
  color: #86efac;
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.86rem;
  color: #d1d5db;
  display: block;
  margin-bottom: 4px;
}

input,
select,
button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0b1220;
  color: var(--text);
  padding: 9px 10px;
  font-size: 0.9rem;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 1px;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.toggle-btn {
  width: auto;
  min-width: 72px;
  cursor: pointer;
  background: #1e293b;
}

.submit-btn {
  background: var(--accent);
  border-color: #1d4ed8;
  cursor: pointer;
  font-weight: 600;
  margin-top: 2px;
}

.submit-btn:hover {
  background: #1d4ed8;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #111827;
  font-weight: 600;
}

.empty-data {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
