:root {
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  background-color: #242424;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0; /* Remove default margin */
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s;
  color: white;
}

button:hover {
  border-color: #646cff;
}

textarea {
  width: 100%;
  margin-bottom: 1rem;
  background-color: #1a1a1a;
  color: inherit;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 0.5rem;
  box-sizing: border-box;
  resize: vertical;
}

#remote-audio {
  width: 100%;
  margin-top: 1rem;
  display: none; /* Hidden until a track is received */
}

#app-layout {
  display: grid;
  grid-template-columns: 300px 1fr; /* Sidebar and main content */
  flex: 1; /* Make the main layout fill the available space */
  overflow: hidden; /* Prevent this container from scrolling */
}

#side-panel {
  background-color: #1a1a1a;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  text-align: center;
}

#peer-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #3a3a3a;
  text-align: left;
}

#peer-list li:last-child {
  border-bottom: none;
}

#gm-layer-controls {
    text-align: left;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 1rem;
}

#gm-token-scale-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #2f2f2f;
    border-radius: 4px;
    justify-content: center;
    font-size: 0.9em;
}

#gm-layer-controls h2 {
    margin-top: 0;
    text-align: center;
}

#layer-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layer-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: #2f2f2f;
    border-radius: 4px;
}

.layer-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.layer-edit-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.layer-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.layer-item-controls button,
.button-like-label {
    padding: 0.2em 0.6em;
    font-size: 0.8em;
    min-width: 40px;
    text-align: center;
}

.clear-bg-btn {
    min-width: auto !important; /* Override shared style */
    width: 24px;
    height: 24px;
    padding: 0 !important;
    border-radius: 50%;
    line-height: 1;
    background-color: #4a2a2a;
    border-color: #804040;
}

.clear-bg-btn:hover {
    background-color: #6a3a3a;
    border-color: #ff6d6d;
}

.bg-scale-btn {
    min-width: 24px !important;
    width: 24px;
    height: 24px;
    padding: 0 !important;
}

.editing-background {
  cursor: move;
  border: 2px dashed #646cff;
  box-sizing: border-box;
}

#vtt-board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background-color: #242424; /* Match body background */
}

#vtt-board {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #3a3a3a;
  border: 2px solid #666;
  margin: 0 auto;
  overflow: hidden;
}

.vtt-layer {
  position: absolute;
  top: 0;
  left: 0;
  background-size: 100% 100%;
  background-position: top left;
  background-repeat: no-repeat;
  transform-origin: top left;
}

.token {
  position: absolute;
  border-radius: 50%;
  border: 2px solid white;
  box-sizing: border-box;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  user-select: none;
  pointer-events: auto; /* Tokens must always be interactive */
  text-shadow: 1px 1px 2px black;
}

.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
}

.modal-content {
  background-color: #2f2f2f;
  margin: 15% auto; /* 15% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
  position: relative;
}

.close-button {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
}

.close-button:hover,
.close-button:focus {
  color: white;
  text-decoration: none;
  cursor: pointer;
}

#app-header {
  background-color: #1a1a1a;
  padding: 0 1rem;
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #3a3a3a;
  flex-shrink: 0; /* Prevent header from shrinking */
  gap: 1rem;
}

#app-header h1 {
  font-size: 1.2em;
  margin: 0.5rem 0;
}

#app-footer {
  background-color: #1a1a1a;
  padding: 0.25rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid #3a3a3a;
  font-size: 0.8em;
  flex-shrink: 0; /* Prevent footer from shrinking */
}

#app-footer p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hamburger-button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.87);
  padding: 0.5rem;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.25s;
}

.hamburger-button:hover {
  background-color: #3a3a3a;
}

#main-menu {
  position: absolute;
  top: 50px; /* Match header height */
  left: 0;
  background-color: #2f2f2f;
  padding: 0;
  border-right: 1px solid #3a3a3a;
  border-bottom: 1px solid #3a3a3a;
  border-bottom-right-radius: 8px;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
  transition: transform 0.3s ease-in-out, visibility 0.3s;
  z-index: 900; /* Below modals (1000) */
}

#main-menu.main-menu-hidden {
  transform: translateX(-110%);
  visibility: hidden;
}

#main-menu.main-menu-visible {
  transform: translateX(0);
  visibility: visible;
}

.menu-link {
  display: block;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.87);
  transition: background-color 0.25s;
  cursor: pointer;
}

.menu-link:hover {
  background-color: #3a3a3a;
}

.menu-separator {
  border: none;
  border-top: 1px solid #3a3a3a;
  margin: 0.5rem 0;
}

.peer-id-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 1rem;
  font-size: 0.9em;
}

.peer-audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0; /* Prevent controls from shrinking */
}

.mute-btn {
  padding: 0.2em 0.6em;
  font-size: 0.8em;
  min-width: 60px; /* To prevent layout shift between Mute/Unmute */
}

.volume-slider {
  width: 80px;
  accent-color: #646cff;
}

.button-like-label {
    display: inline-block;
    font-weight: 500;
    font-family: inherit;
    background-color: #1a1a1a;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.25s;
    color: white;
}

.saved-state-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid #3a3a3a;
}

.saved-state-item:last-child {
  border-bottom: none;
}

.saved-state-item span {
  font-weight: bold;
}

.saved-state-item button {
  margin-left: 0.5rem;
}

.delete-save-btn {
    background-color: #4a2a2a;
    border-color: #804040;
}

.delete-save-btn:hover {
    background-color: #6a3a3a;
    border-color: #ff6d6d;
}

#saved-states-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
    max-height: 40vh;
    overflow-y: auto;
    border: 1px solid #555;
    border-radius: 8px;
}