#mode-divider {
  width: 100%;
  height: 2px;
  background-color: #009688;
  margin: 20px 0;
}

#options-inline-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  margin-top: 20px;
}

/* Center columns by default, but keep the LEFT column left-aligned
   so the two checkbox rows line up nicely. */
#options-inline-container > div{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;     /* default = centered */
  padding: 0;
  margin: 0;
}
#options-inline-container > div:first-child{
  align-items: flex-start; /* only the left column is left-aligned */
}

/* vertical dividers between columns */
#options-inline-container > div:not(:last-child),
#advanced-options-section,
#game-options-controls {
  border-right: 2px solid #009688;
}

#game-options-controls {
  justify-content: flex-start;
  height: 100%;
}

.external-player-controls {
  margin-top: auto;
  align-items: center;
  text-align: center;
}

.option-item {
  margin-bottom: 15px;
  width: 100%;
}

.teal-label {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
}

/* Checkbox labels: fixed first column for the 18px box + tight gap */
.teal-label:has(input[type="checkbox"]) {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  column-gap: 6px;
}

.teal-label input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #009688;
  border-radius: 3px;
  margin-right: 0; /* override any generic margin */
  cursor: pointer;
  position: relative;
}

/* No stray margins inside the gridified label */
.teal-label:has(input[type="checkbox"]) input[type="checkbox"]{
  margin: 0;
}

.teal-label input[type="checkbox"]:checked {
  background-color: #009688;
  border-color: #00796B;
}

/* --- Middle column tidy widths & centering --- */
#options-inline-container > .options-column:nth-child(2) .label-block{
  text-align: center;
}
#options-inline-container > .options-column:nth-child(2) .styled-input{
  align-self: center;
}
#options-inline-container > .options-column:nth-child(2) .styled-select{
  width: auto;           /* stop stretching full column */
  min-width: 220px;
  max-width: 280px;
  align-self: center;
}

/* Optical centering between the two vertical dividers */
#options-inline-container > .options-column:nth-child(2){
  padding-right: 16px;   /* nudge content slightly left */
}
/* keep left column content from hugging its divider too tightly */
#options-inline-container > .options-column:first-child{
  padding-right: 4px;
}

.button {
  background-color: #009688;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  margin: 10px 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s;
  min-width: 120px;
}

.button:hover,
.button.selected {
  background-color: #00796B;
}

.button.selected {
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Scoped slider (no global range overrides) */
.styled-slider {
  -webkit-appearance: none;
  width: 60%;
  margin: 8px 0;
  background: transparent;
}

/* WebKit track */
.styled-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: #009688;
  border-radius: 5px;
}

/* WebKit thumb */
.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  border: 2px solid #004D40;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #00796B;
  cursor: pointer;
  margin-top: -6px;
}

/* Firefox track */
.styled-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: #009688;
  border-radius: 5px;
}

/* Firefox thumb */
.styled-slider::-moz-range-thumb {
  border: 2px solid #004D40;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #00796B;
  cursor: pointer;
}

/* Focus glow */
.styled-slider:focus { outline: none; }
.styled-slider:focus::-webkit-slider-thumb,
.styled-slider:focus::-moz-range-thumb {
  box-shadow: 0 0 5px rgba(0,150,136,0.8);
}

/* ACCENTED dropdown, matching teal-label typography */
.styled-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 2px solid #009688;
  border-radius: 12px;
  background:
    #fff
    url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iIzAwOTY4OCIgZD0iTTcgMTBsNSA1IDUtNSIvPjwvc3ZnPg==")
    no-repeat right 12px center;
  background-size: 16px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}

.styled-select:hover,
.styled-select:focus {
  border-color: #14b8a6;
  background-color: #f5fffc;
  box-shadow: 0 0 0 4px rgba(0,150,136,0.15);
  outline: none;
}

/* Active press feedback */
.styled-select:active {
  box-shadow: 0 0 0 3px rgba(0,150,136,0.18);
}

/* Options (where supported) */
.styled-select option {
  font-size: 16px;
  color: #333;
}

/* High-contrast/dark body safety */
@media (prefers-contrast: more) {
  .styled-select {
    border-width: 3px;
  }
}

.label-block {
  display: block;
  margin-bottom: 5px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background-color: black;
  font-family: Arial, sans-serif;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

:root {
  --tile-gap: 10vh;
  --tile-size: 40vh;
  --hover-duration: 2000ms;
}

#tile-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--tile-gap);
  padding: 20px;
  box-sizing: border-box;
  min-height: 100vh;
}

#tile-container.two-tiles {
  --pair-target-size: var(
    --two-tile-size,
    var(--tile-size, min(40vh, 40vw))
  );
  --pair-desired-gap: var(--two-tile-gap, var(--tile-gap, min(10vh, 10vw)));
  --pair-gap: clamp(
    72px,
    max(
      var(--pair-desired-gap),
      calc(var(--pair-target-size) / 2.4)
    ),
    max(
      72px,
      calc(var(--pair-target-size)),
      var(--pair-desired-gap)
    )
  );
  --pair-size: min(
    var(--pair-target-size),
    calc((100vw - 3 * var(--pair-gap)) / 2),
    calc(100vh - 2 * var(--pair-gap))
  );
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: var(--pair-gap);
  padding: var(--pair-gap);
  width: min(calc(2 * var(--pair-size) + 3 * var(--pair-gap)), 100%);
  margin: 0 auto;
  box-sizing: border-box;
}

#tile-container.two-tiles .tile {
  width: var(--pair-size);
  height: var(--pair-size);
  flex: 0 0 var(--pair-size);
}

#tile-container .tile {
  width: var(--tile-size, 40vh);
  height: var(--tile-size, 40vh);
  background-size: cover;
  background-position: center;
  position: relative;
  border: 2px solid #ffffff;
  box-sizing: border-box;
  transition: transform 0.3s ease, border-color 0.2s ease;
  transform-origin: center;
}

#tile-container .tile .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  text-align: center;
  padding: 10px;
  font-size: 16px;
}

#tile-container .tile::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 0, 0, 0.4);
  transform: scale(0);
  transform-origin: center center;
  pointer-events: none;
  z-index: 1;
}

#tile-container .tile:hover::after {
  animation: overlayExpand var(--hover-duration) linear forwards;
}

@keyframes overlayExpand {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

#tile-container.pointer-motion-required .tile::after,
#tile-container.pointer-motion-required .tile:hover::after {
  animation: none !important;
  transform: scale(0) !important;
}

#tile-container .tile.selected {
  border-color: yellow;
  transform: scale(1.2);
  animation: pulse 1.5s ease-in-out infinite;
  z-index: 2;
}

#video-container {
  width: 100%;
  height: 100vh;
  background-color: black;
  display: flex;
  justify-content: center;
  align-items: center;
}

.styled-input {
  width: 100%;
  max-width: 160px;
  padding: 10px 14px;
  font-size: 18px;
  font-weight: bold;
  color: #000;
  border: 2px solid #009688;
  border-radius: 8px;
  background-color: #fff;
  text-align: center;
  box-shadow: none;
  transition: border-color .2s, box-shadow .2s;
}

.styled-input:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(0,150,136,0.15);
  outline: none;
}

#video-player {
  max-width: 100%;
  max-height: 100%;
}

@media (max-width: 600px) {
  #tile-container .tile {
    width: 15vh;
    height: 15vh;
  }
  #tile-container .tile .caption {
    font-size: 14px;
    padding: 6px;
  }
}

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

#game-options #control-panel-options {
  background-color: white;
  color: black;
  border: 6px solid #008080;
  border-radius: 8px;
  padding: 20px;
  width: 90%;
  max-width: 740px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#tile-picker-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  overflow: auto;
}

#tile-picker-modal #control-panel-options {
  background-color: white;
  color: black;
  border-radius: 8px;
  padding: 20px;
  width: 90vw;
  max-width: 1200px;
  height: auto;
  max-height: 90vh;
  margin: 0 auto;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#tile-picker-modal #control-panel-title {
  font-size: 24px;
  color: black;
  margin-bottom: 20px;
}

#tile-picker-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 1200px;
  box-sizing: border-box;
  margin-bottom: 20px;
}

#tile-picker-grid .tile {
  width: 100px;
  height: 100px;
  background-size: cover;
  background-position: center;
  border: 2px solid #777;
  border-radius: 5px;
  transition: border-color 0.2s ease, transform 0.2s ease;
  position: relative;
}

#tile-picker-grid .tile .caption {
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  padding: 4px 0;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#tile-picker-grid .tile:hover {
  cursor: pointer;
  border-color: #009688;
}

#tile-picker-grid .tile.selected {
  border-color: green;
  transform: scale(1.05);
}

#start-game-button {
  background-color: #009688;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s;
  min-width: 120px;
}

#start-game-button:hover:enabled {
  background-color: #00796B;
}

#start-game-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.styled-input {
  width: 100%;
  max-width: 150px;
  padding: 12px;
  font-size: 16px;
  border: 2px solid #00796B;
  border-radius: 50px;
  background-color: #009688;
  color: #fff;
  text-align: center;
  margin-top: 10px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.styled-input:focus {
  border-color: #004D40;
  box-shadow: 0 0 8px rgba(0,150,136,0.3);
}

.styled-input-small {
  width: 60px;
  padding: 6px;
  font-size: 16px;
  border: 1px solid #00796B;
  border-radius: 5px;
  text-align: center;
  margin-top: 5px;
}

.control-label,
.duration-label,
.temps-label {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

#mode-selection .button {
  width: 120px;
}

#advanced-options-modal {
  display: none;
}

#advanced-options-modal #control-panel-options {
  background-color: white;
  color: black;
  border: 2px solid #008080;
  border-radius: 8px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#advanced-options-modal #control-panel-options h2 {
  color: #008080;
}

#advanced-options-modal #close-advanced-options.button {
  background-color: #008080;
  color: #fff;
}

#advanced-options-modal #close-advanced-options.button:hover {
  background-color: #006666;
}

#options-title-bar {
  position: absolute;
  top: 4vh;
  left: 50%;
  width: 600px;
  transform: translateX(-50%);
  background-color: #009688;
  padding: 15px 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 10;
}

#options-title-bar h2 {
  margin: 0;
  font-size: 1.6rem;
  color: #fff;
}

#choose-tiles-button,
#startButton {
  background-color: #FF5722;
  color: white;
  border: none;
  border-radius: 30px;
  padding: 15px 30px;
  font-size: 18px;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#choose-tiles-button:hover:enabled,
#startButton {
  background-color: #E64A19;
  transform: scale(1.05);
}

#choose-tiles-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.advanced-options-container .option-item,
#sliders-column .option-item {
  margin-bottom: 15px;
}

/* =========================
   YouTube import controls
   ========================= */
#yt-import-controls {
  width: 100%;
  margin-top: 10px;
}

#yt-input-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
  flex-wrap: wrap;
}

#yt-input-row .actions-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: auto;
  flex: 0 0 auto;
  margin-top: 0;
}

#yt-input-row .actions-row .control-panel-input {
  width: 300px;
  flex: 0 0 auto;
}

#yt-input-row .actions-row .button {
  width: auto;
  margin-top: 10px;
}

.actions-row .button {
  width: auto;
  max-width: none;
  margin-top: 0;
}

.control-panel-input {
  padding: 12px;
  font-size: 16px;
  border: 2px solid #00796B;
  border-radius: 50px;
}

.control-panel-input:focus {
  border-color: #004D40;
  outline: none;
}

#clear-videos-button {
  background-color: #e53935;
}

#clear-videos-button:hover {
  background-color: #c62828;
}

/* =========================
   Eyegaze pointer shared styles
   ========================= */
.hide-native-cursor,
.hide-native-cursor * {
  cursor: none !important;
}

#gazePointerOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483647;
  overflow: visible;
}

#gazePointer {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--gp-size, 36px);
  height: var(--gp-size, 36px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

#gazePointer::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ff0000;
}

#gazePointer.gp-dwell::before {
  animation: gpPulse 700ms ease-in-out infinite alternate;
}

@keyframes gpPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  #gazePointer.gp-dwell::before { animation: none; }
}

.gp-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gp-summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
  opacity: 0.85;
}

.gp-advanced {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 2px;
}

.gp-row {
  display: grid;
  grid-template-columns: 1fr minmax(140px, 1.4fr);
  align-items: center;
  gap: 10px;
}

.gp-label {
  white-space: nowrap;
}

.gp-range {
  width: 100%;
}

details#gpDetails {
  border-left: 3px solid rgba(0,150,136,0.25);
  padding-left: 10px;
}

details#gpDetails[open] .gp-summary {
  opacity: 1;
}

#external-player-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 2rem;
  text-align: center;
  z-index: 9999;
}

#external-player-message {
  padding: 1.5rem 2rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
}

#external-player-status {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #0d47a1;
}
