@charset "utf-8";

/* CSS Document */

:root {
  --background-video: #000;
  --background-chat: #111;
  --scroll-to-end-bg: #fff;
  --midground: #888;
  --foreground: #bbb;
  --accent: #0055ff;
  --success: #009632;
  --leader-hint: #00963288;
  --warning: #ffb800;
  --error: #ff0800;
  --border: #333;
  --box-shadow: 0rem .25rem 1rem rgba(0, 0, 0, .25);
}

html {
  box-sizing: border-box;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 1rem;
  line-height: 1.4;
  color: var(--foreground);
  background: var(--background-video);
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-areas: "video gutter chat";
  overflow-y: hidden;
  width: 100%;
  height: 100vh;
}

body.swap {
  grid-template-areas: "chat gutter video";
}

@media only screen and (orientation: portrait) {
  body {
    display: flex;
    font-size: .875rem;
    grid-template-areas: none;
    overflow-y: auto;
    height: auto;
    flex-direction: column;
  }

  body.swap {
    grid-template-areas: none;
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  display: inline;
}

h1 {
  font-size: 2.441rem;
}

h2 {
  font-size: 1.953rem;
}

h3 {
  font-size: 1.563rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1rem;
}

h6 {
  font-size: .8rem;
}

a {
  color: var(--accent);
}

ul {
  list-style: none outside none;
  padding: 0;
  margin: 0;
}

input,
button,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

code,
textarea {
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

input[type="text"]:focus,
input[type="password"]:focus,
button:focus,
textarea:focus {
  outline: none;
}

/* Button */

button {
  display: inline-flex;
  align-items: center;
  text-align: center;
  background-color: var(--background-chat);
  color: var(--midground);
  line-height: 1;
  cursor: pointer;
  padding: .5rem;
  border-radius: .5rem;
  border: 0;
  transition: background-color ease-in-out .15s, color ease-in-out .15s;
}

button:not(:first-child) {
  margin-left: .5rem;
}

.server-whisper button {
  margin-left: 0;
  font-style: italic;
}

button:hover,
button.active {
  background-color: rgba(0, 0, 0, .5);
  color: var(--foreground);
}

/* Disable hover on touch devices */
@media (hover: none) {
  button:hover:not(.active) {
    background-color: var(--background-chat);
  }

  .info header button:hover:not(.active) {
    background-color: transparent;
  }
}

button:hover ion-icon,
button.active ion-icon,
button:focus,
button:focus ion-icon {
  color: var(--foreground);
}

button[disabled],
button[disabled]:hover {
  background-color: var(--background-chat);
  color: var(--midground);
  opacity: 0.5;
  cursor: default;
}

button>* {
  line-height: 1;
}

ion-icon {
  pointer-events: none;
  font-size: 1.2rem;
  color: var(--midground);
  transition: background-color ease-in-out .15s, color ease-in-out .15s;
}

button span {
  pointer-events: none;
}

#leader_btn {
  border: .125rem solid;
  border-color: transparent;
  transition: border-color ease-in-out 500ms;
}

#leader_btn.hint {
  border-radius: .5rem;
  border: .125rem solid;
  color: var(--foreground);
  border-color: var(--leader-hint);
}

/* Input */

.checkbox-row {
  text-align: left;
  padding-left: 1.7rem;
}

.checkbox-row-item {
  display: inline-flex;
  align-items: center;
  text-align: left;
  white-space: nowrap;
  padding: 0.3rem;
  padding-right: .3rem;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-right: .3rem;
}

input,
textarea {
  color: var(--foreground);
}

input[type=text],
input[type="password"],
textarea {
  padding: .5rem;
  border-radius: .5rem;
  color: var(--foreground);
  background-color: var(--background-video);
  border: .125rem solid;
  border-color: var(--border);
  transition: border-color ease-in-out .15s;
}

input[type=text]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
}

/* States */

button.success,
button.success ion-icon,
button.success:hover,
button.success:focus,
.server-msg-reconnect {
  color: var(--success);
}

button.success-bg,
button.success-bg ion-icon,
button.success-bg:hover,
button.success-bg:focus {
  color: var(--foreground);
  background-color: var(--success);
}

button.danger,
button.danger ion-icon,
button.danger:hover,
button.danger:focus,
.server-msg-disconnect {
  color: var(--error);
}

button.danger-bg,
button.danger-bg ion-icon,
button.danger-bg:hover,
button.danger-bg:focus {
  color: var(--foreground);
  background-color: var(--error);
}

.server-msg-disconnect,
.server-msg-reconnect {
  text-align: center;
}

.collapsible {
  overflow: hidden;
  transition: height 200ms;
}

.collapse-list {
  padding: 1rem;
  margin: 0 auto;
  max-width: 32rem;
}

.collapse {
  height: 0;
}

.display-flex {
  display: flex;
}

.unselectable {
  -webkit-user-select: none;
  user-select: none;
}

/* Info */

.info {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
}

@media only screen and (orientation: portrait) {
  .info {
    flex-wrap: wrap;
  }
}

#currenttitle {
  text-overflow: ellipsis;
  overflow: hidden;
}

.info header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: hidden;
  white-space: nowrap;
}

.info header:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-right: .5rem;
}

.info header>*:not(:last-child) {
  margin-right: .5rem;
}

.info header button {
  background-color: var(--background-video);
}

header h4 {
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
}

.controls span {
  display: flex;
  align-items: center;
}

/*
 * Start main
 */

/* Video */

#video {
  display: flex;
  flex-direction: column;
  order: 2;
  background: var(--background-video);
}

#ytapiplayer {
  display: flex;
}

@media only screen and (orientation: landscape) {
  #video {
    grid-area: video;
    width: 100%;
    height: 100%;
    /* Breaks subs after viewport overflow on FF+Linux (SyncTube#28) */
    /* overflow: auto; */
    overflow: scroll;
    background: var(--background-video);
  }
}

@media only screen and (orientation: portrait) {
  #video {
    display: contents;
  }

  #player {
    display: contents;
  }

  #ytapiplayer {
    background: var(--background-video);
  }

  .video-info {
    order: 2;
  }

  #playlist {
    order: 3;
  }

  #footer {
    order: 4;
  }
}

/* Embed responsive */

.embed-responsive:empty {
  min-height: 60vh;
}

.embed-responsive {
  background-color: var(--background);
  width: 100%;
  max-height: 80vh;
}

.temp-videoplayer {
  display: none;
}

#videoplayer {
  width: 100%;
  max-height: 80vh;
}

.videoplayerIframeParent {
  width: 100%;
  height: 100%;
}

iframe#videoplayer {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  position: unset !important;
}

@media only screen and (orientation: portrait) {
  .embed-responsive:empty {
    min-height: 20vh;
  }

  .embed-responsive {
    max-height: 30vh;
  }

  #videoplayer {
    max-height: 30vh;
  }
}

/* Playlist */

#playlist {
  display: flex;
  flex-direction: column;
  border-top: .063rem solid;
  border-color: var(--border);
}

/* Metadata */

.metadata {
  display: flex;
  align-items: center;
  padding: 1rem;
  color: var(--midground);
  padding-top: 0;
}

.metadata>span {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}

.metadata ion-icon {
  margin-right: .25rem;
}

/* Add video */

#insert_template {
  min-width: 2rem;
}

#insert_template>div:first-child {
  text-align: center;
  flex-grow: 1;
}

#addfromurl>*>*,
#customembed>*>* {
  margin-bottom: 1rem;
}

#mediatitle,
#subsurl,
#voiceoverurl {
  margin-left: 2rem;
  flex-grow: 1;
}

.mediaurl-wrap {
  display: flex;
  flex-grow: 2;
  position: relative;
}

#mediaurl {
  display: flex;
  flex: 1;
  padding-right: 2rem;
}

#mediaurl-upload {
  display: flex;
  position: absolute;
  right: 0.1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
}

#customembed>*>input,
#customembed>*>textarea {
  display: flex;
  width: 100%;
}

/* Queue */

.queue-buttons {
  text-align: right;
}

.queue_temp {
  background-color: var(--background-chat);
}

.queue_entry {
  padding: 1rem;
  border-bottom: .063rem solid;
  border-color: var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  transition: background-color ease-in-out .15s;
}

.queue_entry:first-child {
  border-top: .063rem solid;
  border-color: var(--border);
}

.queue_entry a {
  color: var(--foreground);
  text-decoration: none;
}

.queue_entry.queue_active {
  border-left: .25rem solid;
  border-left-color: var(--accent);
}

/* Footer */

footer#footer {
  text-align: center;
  padding: 1rem;
}

/*
 * End main
 */

.gutter {
  display: none;
}

@media only screen and (orientation: landscape) {
  .gutter {
    grid-area: gutter;
    display: flex;
    cursor: col-resize;
    background-color: var(--border);
    transition: background-color ease-in-out .15s;
  }

  .gutter:hover {
    background-color: var(--accent);
  }
}

/*
 * Start chat
 */

#chat {
  background: var(--background-chat);
  position: relative;
  display: flex;
  order: 0;
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 1rem;
  height: 40vh;
}

@media only screen and (orientation: landscape) {
  #chat {
    grid-area: chat;
    height: 100vh;
  }
}

#chat header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chat .controls {
  display: flex;
  justify-content: space-between;
  padding-bottom: 1rem;
}

/* Users online */

#userlist-wrap {
  overflow-y: auto;
  background-color: var(--background-video);
  border-right: 0;
  border-radius: 1rem;
  flex-shrink: 0;

  transition: 0ms;
  height: 0;
  margin-bottom: 1rem;
}

#userlist {
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.userlist_item {
  display: flex;
  align-items: center;
  margin-bottom: .25em;
  cursor: pointer;
}

.userlist_item>*:not(:last-child) {
  margin-right: .25em;
}

.userlist_owner {
  color: var(--accent);
  font-weight: bold;
}

.userlist_guest {
  color: var(--midground);
}

.userlist_banned {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

#userlisttoggle {
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
}

#pause-indicator-portrait {
  padding-left: 0.2rem;
}

.md.hydrated {
  flex-shrink: 0;
}

#usercount {
  display: block;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Options */

#optionsPanel {
  z-index: 1;
  background-color: var(--background-chat);
  overflow-y: scroll;
  position: absolute;
  top: 4rem;
  left: 1rem;
  bottom: 1rem;
  right: 1rem;
  transition: opacity 200ms;
  opacity: 0;
}

#optionsList div {
  display: flex;
  flex-direction: column;
  margin-bottom: .5rem;
}

#optionsList div:not(:first-child) {
  border-top: .063rem solid;
  border-color: var(--border);
  padding-top: 1rem;
}

#optionsList li button {
  padding: 1rem 0;
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: 0;
  text-align: left;
}

#optionsList li button:hover {
  background-color: var(--background-chat);
}

@media only screen and (orientation: portrait) {
  #swapLayoutBtn {
    display: none !important;
  }
}

/* Message buffer */

#messagebuffer {
  display: flex;
  flex-direction: column;
  flex-grow: 2;
  flex-shrink: 8;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  width: 100%;
  height: 100%;
}

#messagebuffer>* {
  margin-bottom: 1em;
}

.head {
  display: flex;
  align-items: center;
}

.username {
  display: flex;
}

.timestamp {
  margin-left: .5em;
  line-height: 1;
  font-size: .8em;
  font-style: normal;
  color: var(--midground);
  flex-shrink: 0;
}

#messagebuffer .text {
  color: var(--midground);
}

.server-whisper {
  font-style: italic;
  word-break: break-word;
}

#scroll-to-chat-end {
  transition: opacity 200ms;
  position: absolute;
  margin-left: auto;
  top: -4em;
  right: 1em;
  padding: 0.8em;
  border-radius: 50%;
  background-color: var(--scroll-to-end-bg);
}

#scroll-to-chat-end ion-icon {
  color: var(--midground);
}

/* Chat input */

#chat-inputs-wrapper {
  position: relative;
}

#dynamic-chin {
  display: flex;
  padding: 0.5rem;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  transition: 200ms ease-in-out;
}

#dynamic-chin.collapsed {
  padding-top: 0;
  padding-bottom: 0;
  height: 0;
}

#dynamic-chin button {
  display: flex;
  margin-left: 0;
  outline: var(--accent) solid;
  flex-grow: 1;
  justify-content: center;
}

#chatbox {
  padding-top: 1rem;
  border-top: .063rem solid;
  border-color: var(--border);
  display: flex;
  flex-direction: row;
}

#chatbox>*:not(:first-child) {
  margin-left: .5rem;
}

#chatline {
  flex-grow: 2;
  width: 2rem;
}

/* Emotes */

#smiles-wrap {
  display: flex;
  height: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 1rem;
  overflow-y: scroll;
  text-align: center;
}

#smiles-list {
  display: grid;
  width: 100%;
  height: 12rem;
  padding: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  grid-gap: .5rem;
  gap: .5rem;
}

.smile-preview {
  height: 4rem;
  width: 4rem;
  object-fit: scale-down;
  cursor: pointer;
}

.channel-emote {
  max-width: 10rem;
  max-height: 10rem;
}

.chat-img {
  max-width: 12.5rem;
  max-height: 12.5rem;
}

#guestlogin,
#guestpassword {
  display: flex;
  flex-direction: column;
  padding-top: 1rem;
  border-top: .063rem solid;
  border-color: var(--border);
}

/* Guest login */

#guestlogin label,
#guestpassword label {
  display: flex;
  margin-bottom: 1em;
}

#guestpassword span>*:not(:first-child) {
  margin-left: .5rem;
}

#guestpass_icon:hover {
  cursor: pointer;
}

#passwordbox {
  display: flex;
  flex-direction: row;
}

#guestpass {
  flex-grow: 2;
  width: 2rem;
}

/*
 * End chat
 */

/*
 * Scrollbar
 */

html {
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile page fullscreen */

.mobile-view #chatbox {
  padding-top: 0;
  border-top: 0;
}

.mobile-view #chat {
  padding: 0 1rem;
}

.mobile-view #chat .controls {
  padding-bottom: 0;
}

.mobile-view #optionsPanel {
  top: 2.2rem;
  bottom: 0;
}
