/* =============================================================
   RESET
   ============================================================= */
* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

/* =============================================================
   BODY

   The background belongs to the application, not the canvas,
   so it does not move when the world is scrolled.
   ============================================================= */
body {
    overflow: hidden;

    font-family: sans-serif;
    color: white;

    background:
        radial-gradient(
            circle at 20% 20%,
            #304060,
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #101522,
            #080b12
        );

    background-attachment: fixed;
}

/* =============================================================
   VIEWPORT
   ============================================================= */
#viewport {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100%;

    overflow: auto;

    -webkit-overflow-scrolling: touch;

    overscroll-behavior: contain;
}

/* =============================================================
   LOGICAL WORLD
   ============================================================= */
#workspace {
    position: relative;

    width: 2400px;
    height: 1050px;

    flex: none;
}

/* =============================================================
   COMMON BOX
   ============================================================= */
.box {
    position: absolute;

    min-width: 80px;
    min-height: 50px;

    border: 1px solid rgba(255, 255, 255, 0.35);

    border-radius: 8px;

    background: rgba(20, 25, 35, 0.88);

    overflow: hidden;

    touch-action: none;
    user-select: none;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.25);
}

/* =============================================================
   BUTTONS
   ============================================================= */
button {
    border: 0;

    border-radius: 5px;

    padding: 6px 10px;

    background: #39445a;
    color: white;

    cursor: pointer;

    touch-action: manipulation;
}

button:active {
    background: #566783;
}

button.active {
    background: #4a7bd0;
}

/* =============================================================
   VIDEO
   ============================================================= */
.video-box {
    left: 150px;
    top: 120px;

    width: 360px;
    height: 240px;
}

.video-box video {
    display: block;

    width: 100%;
    height: calc(100% - 66px);

    object-fit: contain;

    background: black;
}

.video-scrub {
    height: 28px;

    display: flex;
    align-items: center;

    padding: 0 6px;

    position: relative;
    z-index: 1;
}

.video-scrub input {
    width: 100%;
    margin: 0;
}

.video-controls {
    height: 38px;

    display: flex;
    align-items: center;

    gap: 6px;

    padding: 4px;

    position: relative;
    z-index: 1;
}

/* =============================================================
   LINKS
   ============================================================= */
.link-box {
    width: 180px;
    height: 70px;

    display: flex;

    align-items: center;
    justify-content: center;
}

#linkBox1 {
    left: 750px;
    top: 150px;
}

#linkBox2 {
    left: 750px;
    top: 270px;
}

#linkBox3 {
    left: 750px;
    top: 390px;
}

.link-box a {
    color: white;

    font-size: 18px;

    text-decoration: none;
}

.link-box a:hover {
    text-decoration: underline;
}

/* robot_view: larger click target around the text */
#linkBox3 a {
    padding: 14px 28px;
}

/* robot_view: hidden until the floater is opened */
#linkBox3 .robot-auth,
#linkBox3 .robot-frame,
#linkBox3 .robot-bar {
    display: none;
}

/* robot_view: opened = content fills the floater tile itself */
#linkBox3.open {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    touch-action: auto;
}

#linkBox3.open a {
    display: none;
}

#linkBox3.open .resize-handle {
    touch-action: none;
}

#linkBox3.open .robot-bar {
    display: flex;
    flex: none;
    justify-content: flex-end;
    align-items: center;
    height: 30px;
    padding: 0 4px;
    touch-action: none;
}

#linkBox3.open .robot-close {
    padding: 2px 8px;
    font-size: 12px;
}

#linkBox3.open .robot-auth {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px;
    overflow: auto;
}

#linkBox3.open .robot-auth > * {
    flex: none;
    align-self: center;
    width: min(320px, 100%);
}

#linkBox3.open.authed .robot-auth {
    display: none;
}

#linkBox3.open.authed .robot-frame {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    border: 0;
    background: #fff;
}

.robot-auth label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}

.robot-auth input {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    background: #0d111a;
    color: white;
    font-size: 16px;
    user-select: text;
}

/* =============================================================
   BANNER
   ============================================================= */
.banner-box {
    left: 150px;
    top: 20px;

    width: 260px;
    height: 50px;

    display: flex;
    align-items: center;
}

.banner-track {
    flex: none;
    position: relative;

    width: 100%;
    height: 100%;
}

.banner-item {
    position: absolute;
    top: 0;
    left: 0;

    height: 100%;

    display: flex;
    align-items: center;

    padding-left: 100%;

    white-space: nowrap;
    font-size: 20px;

    animation: banner-scroll 24s linear infinite;
}

.banner-item:nth-child(2) {
    animation-delay: 8s;
}

.banner-item:nth-child(3) {
    animation-delay: 16s;
}

@keyframes banner-scroll {
    from {
        transform: translateX(0);
    }
    33.333% {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(-100%);
    }
}

/* =============================================================
   USER
   ============================================================= */
.user-box {
    width: 160px;
    height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 0 8px;

    font-size: 14px;

    white-space: nowrap;
}

.user-label {
    opacity: 0.7;
}

#userName {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =============================================================
   RESIZE HANDLE
   ============================================================= */
.resize-handle {
    position: absolute;

    right: 0;
    bottom: 0;

    z-index: 2;

    width: 20px;
    height: 20px;

    cursor: nwse-resize;

    background:
        linear-gradient(
            135deg,
            transparent 45%,
            rgba(255, 255, 255, 0.7) 46%,
            rgba(255, 255, 255, 0.7) 55%,
            transparent 56%
        );
}

/* =============================================================
   SMALL SCREENS

   World coordinates do NOT change.

   Only the default object dimensions become slightly smaller.
   ============================================================= */
@media (max-width: 600px) {

    .video-box {
        width: 300px;
        height: 210px;
    }

    .link-box {
        width: 160px;
        height: 65px;
    }
}
