:root {
    --main-bg: #181A20;
    --container-bg: #22242B;
    --accent: #3D8BFF;
    --accent-light: #5FA8FF;
    --danger: #F34B5E;
    --border: #2A2D35;
    --border-strong: #393B40;
    --text: #E5E7EB;
    --text-secondary: #A1A6B2;
    --input-bg: #23252C;
    --input-border: #39404E;
    --input-focus: #3D8BFF77;
    --input-placeholder: #686C7A;
    --button-hover: #2560D9;
    --shadow: 0 6px 32px rgba(0,0,0,0.55);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    background: var(--main-bg);
    color: var(--text);
}

body, .container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 430px;
    margin: auto;
    padding: 2em 1.5em 1.7em 1.5em;
    box-sizing: border-box;
    background: var(--container-bg);
    border-radius: 1.1em;
    box-shadow: var(--shadow);
    border: 1.5px solid var(--border);
    transition: background 0.3s, border 0.3s;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

h1 {
    font-size: 2.1em;
    margin-bottom: 1em;
    color: var(--accent);
    text-align: center;
    letter-spacing: 0.01em;
}

video, canvas, .preview-container img {
    width: 100%;
    max-width: 380px;
    border-radius: 0.8em;
    border: 2px solid var(--border-strong);
    margin-bottom: 1em;
    aspect-ratio: 3/4;
    background: #1B1D23;
    object-fit: cover;
    box-shadow: 0 4px 24px rgba(0,0,0,0.22);
    transition: border 0.2s;
}

.field-group {
    margin-bottom: 1.3em;
    width: 100%;
}

label {
    font-weight: 500;
    margin-bottom: .32em;
    display: block;
    letter-spacing: 0.015em;
    color: var(--text-secondary);
}

.input-optional {
    color: var(--input-placeholder);
    font-size: 0.96em;
    font-weight: 400;
    margin-left: .5em;
}

/* NEW: Wrapper for input and toggle */
.input-wrapper {
    position: relative;
    width: 100%;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 1em 1.1em;
    font-size: 1.08em;
    background: var(--input-bg);
    border: 1.7px solid var(--input-border);
    border-radius: .6em;
    margin-top: .18em;
    box-sizing: border-box;
    transition: border 0.18s, box-shadow 0.18s, background 0.22s;
    outline: none;
    line-height: 1.45;
    color: var(--text);
    font-family: inherit;
    box-shadow: none;
    /* Add padding to the right to make space for the toggle */
    padding-right: 6em; 
}

/* NEW: Styles for the visibility toggle */
#toggle-key-visibility {
    position: absolute;
    right: 1.2em;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 600;
    user-select: none; /* Prevent text selection on double click */
    transition: color 0.2s;
}

#toggle-key-visibility:hover {
    color: var(--accent-light);
}

input[type="text"]:focus, input[type="password"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 5px var(--input-focus);
    background: #232636;
}

input[type="text"]::placeholder, input[type="password"]::placeholder {
    color: var(--input-placeholder);
    font-style: italic;
    opacity: 1;
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: .55em;
    padding: .85em 1.4em;
    font-size: 1.08em;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1em;
    transition: background .18s, box-shadow .18s;
    box-shadow: 0 2px 18px rgba(61,139,255,0.08);
    letter-spacing: 0.01em;
    width: 100%;
    max-width: 100%;
    min-height: 52px;
    box-sizing: border-box;
    display: block;
}

button:hover, button:focus {
    background: var(--button-hover);
    outline: none;
}

button:disabled {
    background: #3d8bff44;
    cursor: not-allowed;
    color: #b5bbc7;
    box-shadow: none;
}

#error-msg {
    color: var(--danger);
    font-weight: 600;
    margin-top: .8em;
    text-align: center;
    min-height: 2em;
    letter-spacing: 0.01em;
}

.preview-container {
    margin: 0.7em 0 1.1em 0;
    text-align: center;
}

@media (max-width: 600px) {
    html, body {
        min-height: 100vh;
        height: 100vh;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .container {
        max-width: 100vw;
        width: 100vw;
        min-height: 100vh;
        padding: 1em 0.5em 1em 0.5em;
        border-radius: 0;
        box-shadow: none;
        border: none;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }
    video, .preview-container img {
        max-width: 98vw;
    }
    button {
        font-size: 1.15em;
        min-height: 54px;
        padding: 1em 0.3em;
        width: 100vw;
        max-width: 100vw;
        border-radius: 0.8em;
        margin-bottom: 1em;
    }
    form#upload-form {
        width: 100%;
        max-width: 100vw;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
}

/* Gallery (live.html) */
#gallery-container {
    width: 100vw;
    height: 100vh;
    background: var(--main-bg);
    overflow: hidden;
    position: relative;
}
.slides-track {
    display: flex;
    height: 100vh;
    transition: transform 1s cubic-bezier(.77,0,.175,1);
    will-change: transform;
}
.slide {
    min-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 100vw;
    box-sizing: border-box;
    position: relative;
    opacity: 1 !important;
    left: 0 !important;
    background: var(--container-bg);
    border-right: 1px solid var(--border-strong);
}
.slide img {
    max-width: 92vw;
    max-height: 77vh;
    object-fit: contain;
    border-radius: 1em;
    box-shadow: 0 0 24px rgba(0,0,0,0.32);
    background: #23262D;
    margin: 0 auto;
    display: block;
    border: 2px solid var(--border);
    transition: border 0.2s;
}
.desc {
    color: var(--text);
    background: rgba(28,31,41,0.77);
    padding: .7em 1.3em;
    border-radius: .9em;
    font-size: 1.17em;
    margin-top: 1.1em;
    text-align: center;
    max-width: 87vw;
    word-break: break-all;
    box-shadow: 0 2px 9px rgba(0,0,0,0.13);
    letter-spacing: 0.01em;
}
.timestamp {
    color: var(--text-secondary);
    font-size: 1em;
    margin-top: .5em;
    text-align: center;
    letter-spacing: 0.01em;
}
@media (orientation: landscape) {
    .slide img { max-height: 85vh; }
}
@media (max-width: 600px) {
    .slide img { max-width: 98vw; max-height: 58vh; }
    .desc, .timestamp { font-size: 1em; }
}