/* === CSS Custom Properties (Theme) === */
:root {
  --bg-primary: #000;
  --bg-menu: #111;
  --bg-button: linear-gradient(to bottom, #242424, #121212);
  --bg-button-hover: linear-gradient(to bottom, #262626, #333);
  --bg-button-active: linear-gradient(to bottom, #333, #555);
  --text-muted: #4d4d4d;
  --text-light: #ccc;
  --text-active: #fff;
  --accent-red: #ee0000;
  --border-dark: #121212;
  --border-light: #333;
  --mute-base: rgba(128, 128, 128, 0.0);
  --mute-hover: rgba(255, 255, 255, 0.6);
}

/* === Body & Main Container === */
body {
  background-color: var(--bg-primary);
  font-family: Arial, sans-serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.aspect-ratio-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  max-width: calc(100vh * 16 / 9);
  margin: auto;
  overflow: hidden;
  position: relative;
  background: #000;
}

/* === Menu Wrapper – 50% transparent when minimized === */
#menu-wrapper {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(calc(-100% + 18px));
  width: 150px;
  height: 120px;
  background: var(--bg-menu);
  z-index: 10000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  transition: transform 0.35s ease, opacity 0.35s ease;
  transition-delay: 1.0s;
  opacity: 0.5;
}

#menu-wrapper:hover {
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s;
  opacity: 1;
}

/* === Menu Tabs Grid === */
.menu-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 6px;
  padding: 8px 12px 6px;
  box-sizing: border-box;
}

/* === Dropdown === */
.menu-select {
  grid-column: 1 / -1;
  width: 100%;
  background: var(--bg-button);
  color: var(--text-muted);
  border: 2px solid var(--border-dark);
  padding: 7px 12px;
  font-size: 10px;
  font-family: Arial, sans-serif;
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

/* Dropdown options */
.menu-select option {
  background: #242424;
  color: #ccc;
  text-align: center;
  padding: 10px 30px;
  font-size: 10px;
}

/* Switch wrappers */
#switch1,
#switch2 {
  display: contents;
}

/* === Buttons === */
.menu-btn,
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 20px;
  padding: 3px 2px;
  font-size: 10px;
  box-sizing: border-box;
  white-space: nowrap;
  background: var(--bg-button);
  border-radius: 0;
  font-family: Arial, sans-serif;
  color: var(--text-muted);
  border: 2px solid var(--border-dark);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-btn:hover,
.btn:hover {
  background: var(--bg-button-hover);
  color: var(--text-light);
  border-color: #555;
}

.menu-btn.active,
.btn.active {
  background: var(--bg-button-active);
  color: var(--text-active);
  border-color: #777;
}

/* === Name Toggle Button === */
.name-toggle-wrapper {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.name-toggle-wrapper .btn {
  width: 100%;
  max-width: 100px;
}

/* === Menu Header === */
.menu-header {
  width: 100%;
  text-align: center;
  padding: 2px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: #1a1a1a;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  margin-top: auto;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Display Name Layer (bottom center) === */
.name-layer {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgb(0 0 0 / 75%);
  color: #ffffff;
  font-family: 'Lucida Console', 'Courier New', monospace;
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  padding: 6px 18px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 10001;
  pointer-events: none;
}

/* Hide names when toggled off */
.aspect-ratio-box.names-hidden .name-layer {
  display: none !important;
}

/* === Containers & Video Elements === */
div[id^="container"],
.mute-layer {
  position: absolute;
  transition: border 0.3s ease;
}

video,
iframe {
  width: 100%;
  height: 100%;
  z-index: 1;
  object-fit: contain;
}

iframe {
  border: 0;
  background: #000;
}

.unmuted-border {
  border: 2px solid var(--accent-red) !important;
  box-shadow: 0 0 0 3px rgba(238, 0, 0, 0.2);
}

.mute-layer {
  width: 128px;
  height: 128px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2em;
  color: var(--mute-base);
  z-index: 100;
  transition: color 0.25s ease, transform 0.2s ease;
  top: 8px;
  right: 8px;
  border-radius: 8px;
}

.mute-layer:hover,
.mute-layer:active {
  color: var(--mute-hover);
  transform: scale(2.15);
}

.menu-btn:focus-visible,
.btn:focus-visible,
.mute-layer:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Minor polish */
#menu-wrapper,
.menu-tabs,
.menu-header,
.menu-btn,
.btn,
.menu-select {
  user-select: none;
}