/* =============================================================================
   PLATFORM STYLESHEET INDEX
   =============================================================================
   * MS01 - Imports & CSS Reset
   * MS02 - Basics
   * MS03 - Typography
   * MS04 - Page Structure
   * MS05 - Content & Media
   * MS06 - Controls (Generation & Navigation)
   * MS07 - Miscellaneous
   * MS08 - Makers (Comic Builder & GIF Maker)
   ========================================================================== */

/* =============================================================================
   MS01 - Imports & CSS Reset
   =============================================================================
   Source:  http://meyerweb.com/eric/tools/css/reset/
   Author:  Eric Meyer
   Version: 2.0
   ========================================================================== */


html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* =============================================================================
   MS02 - Basics
   ========================================================================== */

html {
    min-height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: black;
    color: white;
    font-family: "Open Sans", sans-serif;
    font-size: 1em;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-style: normal;
    font-weight: 300;
    line-height: 1.4em;
    text-rendering: optimizeLegibility;
}

/* =============================================================================
   MS03 - Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6, p {
    font-family: inherit;
    font-style: inherit;
}

h1 {
    font-size: 2.250em;
    font-weight: 300;
    line-height: 1.4em;
    text-align: center;
}

h2 {
    font-size: 2em;
    line-height: 1.4em;
}

h3 {
    font-size: 1.5em;
    line-height: 1.75em;
    margin-top: 1em;
}

h4 {
    font-size: 1.125em;
    line-height: 1.375em;
    margin-bottom: 1.375em;
}

h5 {
    font-size: 1.4em;
    letter-spacing: 0.063em;
    line-height: 1.750em;
    text-shadow: 2px 2px 2px #090F1C;
    text-transform: uppercase;
}

@media (max-width: 375px) {
      h1 { font-size: 1.5em }
      h2 { font-size: 1.75em }
      h3 { font-size: 1.250em }
}

p, pre, table, blockquote {
    font-size: 1em;
    font-weight: 300;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
    line-height: 1.600em;
    margin-top: 0em;
    margin-bottom: 0.375em;
}

ul, ol {
    font-size: 0.938em;
    font-weight: 300;
    margin-left: 1em;
    line-height: 1.6em;
    list-style-position: inside;
    list-style-type: circle;
}

label {
    display: block;
    float: left;
    font-size: 0.625em;
    letter-spacing: 0.063em;
    vertical-align: top;
}

small { font-size: 0.750em; }

.faq p { font-size: 0.938em; }

/* =============================================================================
   MS04 - Page Structure
   ========================================================================== */

.row {
    margin: 0 !important;
}

header {
    border-bottom: 1px solid #D8D8D8;
    padding: 0.750em 1.500em;
    vertical-align: middle;
}

nav {
    margin: 0.500em;
    padding-bottom: 1em;
    padding-left: 0 !important;
}

.content {
    margin: 0 auto;
    max-width: 90%;
    padding: 2em 0;
}

.faq {
    margin: 0 auto;
    max-width: 40em;
}

.result {
    padding: 5px !important;
}

.result-frame {
    border-radius: 3px;
    overflow: hidden;
}

.result-frame--loading {
    min-height: 120px;
    background: #1a1a1a;
    animation: result-pulse 1.5s ease-in-out infinite;
}

@keyframes result-pulse {
    0%   { background: #1a1a1a; }
    50%  { background: #2a2a2a; }
    100% { background: #1a1a1a; }
}

.empty-container {
    box-sizing: border-box;
    bottom: -1em;
    left: 0;
    margin: 0 auto;
    max-width: 50%;
    position: fixed;
    right: 0;
    z-index: -1;
}

@media screen and (max-width: 320px), (max-height: 600px) {
    .empty-container {
        display: none;
    }
}

.btn-row {
    padding-top: 2em;
}

.nav-bar {
    padding: 0.250em;
}

.nav-prompt {
    padding-top: 1.5em;
}

.episode-subtitle {
    box-sizing: border-box;
    border-top: 1px solid #808080;
    padding: 0.500em 0;
}

/* =============================================================================
   MS05 - Content & Media
   ========================================================================== */

img {
    height: auto;
    display: inline-block;
    vertical-align: middle;
    width: 100%;
}

input, textarea {
    outline: none;
    overflow: auto;
    resize: none;
    width: 100%;
}

.center {
    text-align: center;
    display: inline-block;
}

.search-wrapper {
    margin: 0.500em 0;
}

.logo img {
    float: left;
    max-width: 10em;
}

.empty-container img {
    height: auto;
    vertical-align: bottom;
    width: 50%;
}

.nav-item {
    padding-bottom: 0.500em;
    padding-left: 0 !important;
    padding-right: 0.500em !important;
}

.selected img {
    border: 1px solid #D8D8D8;
}

.full-image {
    position: relative;
    background-color: black;
    border-radius: 5px;
    display: inline-block;
    padding: 0.500em;
    margin-bottom: 1em;
}

.glow img {
    margin: 1rem;
    max-height: 90px;
    -webkit-filter: drop-shadow( 0px 0px 16px rgba(255,255,255, 0.8) );
    filter: drop-shadow( 0px 0px 16px rgba(255,255,255, 0.8) );
    width: auto;
}

.scene-subtitle {
    border-top: 2px solid white;
    padding: 1em 0 2em;
}

.gif-grid img {
    width: 100%;
}

.gif-grid .frame {
    padding: 0.250em;
}

.gif-grid .frame {
    text-align: center;
}

.gif-grid .frame.active {
    background-color: white;
}

.gif-grid {
    margin-top: 1em;
}


/* =============================================================================
   MS06 - Controls
   ========================================================================== */

a,
a:link,
a:hover,
a:active,
a:visited {
    border: none;
    cursor: pointer;
    outline: 0;
    text-decoration: none;
}

button {
    background-color: transparent;
    border: 1px solid white;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    font-size: 1em;
    letter-spacing: 0.063em;
    line-height: 1.500em;
    margin-bottom: 0.500em;
    padding: 0.500em 1.250em;
    text-transform: uppercase;
    text-align: center;
    vertical-align: middle;
}

button:hover:enabled {
    background-color: white;
    color: black;
    transition-timing-function: ease;
}

button.panel-icon-btn:hover:enabled {
    background-color: #333;
    color: white;
}

button:disabled {
    cursor: default;
    opacity: 0.75;
}

button.small {
    font-size: 6pt;
}

.logo img {
    cursor: pointer;
    vertical-align: middle;
}

.search-box {
    border: 1px solid black;
    border-radius: 36px;
    box-sizing: border-box;
    font-size: 1em;
    height: 36px;
    outline: none;
    padding: 0 12px;
    position: relative;
    vertical-align: middle;
    width: 100%;
}

.season-picker {
    position: relative;
    flex-shrink: 0;
}

.season-picker-btn {
    border: 1px solid black;
    border-radius: 36px;
    box-sizing: border-box;
    font-size: 0.85em;
    height: 42px;
    outline: none;
    padding: 0 10px;
    cursor: pointer;
    background: transparent;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0;
}

.season-picker-arrow {
    font-size: 0.7em;
}

.season-picker-popover {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    margin-top: 4px;
    background: #222;
    color: #fff;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    min-width: 236px;
}

.season-preset-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.season-preset-btn {
    font-size: 0.75em;
    padding: 2px 8px;
    border: 1px solid #888;
    border-radius: 12px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0;
}

.season-preset-btn:hover:enabled {
    background: #444;
    color: #fff;
}

.season-preset-btn--active {
    background: #555;
    color: #fff;
    border-color: #aaa;
}

.season-fav-x {
    margin-left: 4px;
    color: #888;
    font-size: 0.9em;
    cursor: pointer;
}

.season-fav-x:hover {
    color: #fff;
}

.season-preset-btn--danger {
    background: rgba(255,68,68,0.15);
    border-color: #ff4444;
    color: #ff4444;
}

.season-preset-btn--danger:hover:enabled {
    background: rgba(255,68,68,0.3);
    color: #ff4444;
}

.season-preset-btn--add {
    padding: 2px 6px;
    font-size: 0.85em;
    line-height: 1.2;
}

.season-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 3px;
}

.season-pill {
    font-size: 0.75em;
    padding: 4px 0;
    border: 1px solid #555;
    border-radius: 4px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0;
}

.season-pill:hover:enabled {
    background: #444;
    color: #fff;
}

.season-pill--selected {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
}

.season-pill--in-range {
    background: rgba(74, 158, 255, 0.3);
    color: #fff;
    border-color: rgba(74, 158, 255, 0.4);
}

.search-mode-toggle {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 42px;
    justify-content: center;
    gap: 1px;
}

.search-mode-btn {
    font-size: 0.75em;
    padding: 1px 8px;
    border: 1px solid #888;
    border-radius: 8px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0;
    white-space: nowrap;
}

.search-mode-btn:hover:enabled {
    background: #444;
    color: #fff;
}

.search-mode-btn--active {
    background: #555;
    color: #fff;
    border-color: #aaa;
}

.btn-text {
    font-size: 1.250em;
    text-align: center;
    text-transform: uppercase;
}

.nav {
    padding-right: 0.500em;
}

.chevron {
    font-size: 1.6em;
    line-height: 1;
    vertical-align: middle;
}

.btn-row button {
    width: 100%;
}

.opener-button {
    color: white;
    display: inline-block;
    padding: 2px 8px;
    margin-top: 0.500em;
    width: 2em;
    height: 2em;
    text-align: center;
}

.opener-button.right {
    float: right;
}

.opener-button a {
    padding-right: 8px;
    font-size: 18pt;
    text-transform: uppercase;
}

.opener-button:hover a {
    color: red;
    text-shadow: 0px 0px 4px rgba(255,0,0, 0.8);
}

button.share-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
}

button.share-btn:hover:enabled {
    background: none;
    /* Fallback is magenta so missing --site-accent is obvious */
    color: var(--site-accent, magenta);
}

.faq-link img {
    width: auto;
    height: 100px;
    position: fixed;
    z-index: 10;
    bottom: 0;
    right: 0;
    margin: 1em;
}

.faq-link img:hover {
    -webkit-filter: drop-shadow( 0px 0px 16px rgba(255,255,255, 0.8) );
    filter: drop-shadow( 0px 0px 16px rgba(255,255,255, 0.8) );
}

.nav-bar .nav-item button {
    height: 100%;
}

.random {
    width: 100%;
}

.random button {
    width: auto;
    height: 42px;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1;
}


.navigator-link,
.navigator-link:link,
.navigator-link:visited,
.navigator-link:active {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #FFD700;
    border-radius: 4px;
    background: transparent;
    color: #FFD700;
    text-decoration: none;
    font-family: "Akbar", "Open Sans", sans-serif;
    font-size: 1.05em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.navigator-link:hover {
    border-color: #FFD700;
    background: #FFD700;
    color: #1E2430;
    transition-timing-function: ease;
}

.navigator-page {
    width: 100%;
    padding-left: 56px;
    box-sizing: border-box;
}

.navigator-season {
    margin-bottom: 22px;
}

.navigator-season-title {
    margin: 0 0 10px;
    font-size: 1.35em;
}

.navigator-season-range {
    color: #bbb;
    font-size: 0.75em;
    font-weight: 400;
}

.navigator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
}

.navigator-card {
    cursor: pointer;
}

.navigator-card-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 4px;
    overflow: hidden;
    background: #111;
}

.navigator-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.navigator-frame-placeholder {
    background: #1a1a1a;
}

.navigator-frame-current {
    opacity: 1;
}

.navigator-frame-incoming {
    opacity: 0;
    transition: opacity 250ms ease;
}

.navigator-frame-incoming.navigator-frame-reveal {
    opacity: 1;
}

@keyframes navigator-pulse-glow {
    0%   { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); transform: scale(1); }
    50%  { box-shadow: 0 0 12px 4px rgba(255, 215, 0, 0.7); transform: scale(1.03); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); transform: scale(1); }
}

@keyframes navigator-pulse-brightness {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(1.15); }
    100% { filter: brightness(1); }
}

.navigator-card-frame-pulse {
    animation: navigator-pulse-glow 800ms ease-out;
}

.navigator-card-frame-pulse > .navigator-frame-current {
    animation: navigator-pulse-brightness 800ms ease-out;
}

.navigator-card:hover .navigator-card-frame {
    outline: 1px solid rgba(255, 215, 0, 0.3);
    outline-offset: -1px;
}

.navigator-scrubber {
    position: fixed;
    left: 8px;
    top: 78px;
    bottom: 14px;
    width: 44px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(22, 22, 22, 0.38);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    z-index: 30;
    touch-action: none;
    user-select: none;
    cursor: ns-resize;
}

.navigator-scrubber-track {
    height: 100%;
    width: 100%;
    padding: 8px 0;
    box-sizing: border-box;
    display: grid;
    grid-auto-rows: 1fr;
    align-items: center;
}

.navigator-scrubber-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.navigator-scrubber-tick {
    width: 9px;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.42);
    transition: background-color 120ms ease, transform 120ms ease;
}

.navigator-scrubber-label {
    font-size: 9px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.62);
    font-family: "Akbar", "Open Sans", sans-serif;
    letter-spacing: 0.03em;
    min-width: 13px;
    text-align: left;
    transition: color 120ms ease;
}

.navigator-scrubber-marker.is-current .navigator-scrubber-tick {
    background: #FFD700;
    transform: scaleX(1.2);
}

.navigator-scrubber-marker.is-current .navigator-scrubber-label {
    color: #FFD700;
}

.navigator-scrubber.is-scrubbing {
    background: rgba(32, 32, 32, 0.48);
    border-color: rgba(255, 255, 255, 0.32);
}

@media (max-width: 768px) {
    .navigator-page {
        padding-left: 48px;
    }

    .navigator-scrubber {
        left: 6px;
        width: 42px;
    }

    .navigator-scrubber-marker {
        gap: 2px;
    }

    .navigator-scrubber-tick {
        display: none;
    }

    .navigator-scrubber-label {
        display: block;
        min-width: 18px;
        text-align: center;
        font-size: 10px;
    }

}

/* Filmstrip zoom crossfade */
@keyframes filmstrip-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.filmstrip-fadein {
    animation: filmstrip-fadein 200ms ease;
}

/* Pan arrow buttons on filmstrip edges */
.pan-arrow:not(:disabled):hover {
    background: #3a3a4e !important;
    color: #fff !important;
}
.pan-arrow:not(:disabled):active {
    background: #4a4a5e !important;
    color: #fff !important;
}

/* =============================================================================
   MS08 - Makers (Comic Builder & GIF Maker)
   ========================================================================== */

/* Scoped button reset — kills the global margin-bottom: 0.5em */
.cm button, .gm button { margin-bottom: 0; }

/* Shared maker page layout */
.maker-page { min-height: 100vh; padding-bottom: 40px; }

.maker-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}

.maker-editor {
    padding: 16px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.maker-canvas-col { flex: 1 1 400px; min-width: 0; max-width: 640px; }
.maker-props-col { flex: 1 1 280px; min-width: 280px; }

.maker-divider { border-bottom: 1px solid rgba(255,255,255,0.1); }

.maker-canvas-wrap {
    display: block;
    width: 100%;
    position: relative;
    padding: 0;
    border-radius: 4px;
}

.maker-canvas-wrap canvas {
    width: 100%;
    display: block;
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* --- Overlay properties panel --- */

.overlay-panel {
    background: #1e1e30;
    border: 1px solid #3a3a55;
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
}

.overlay-panel-body { padding: 12px; }

.overlay-input {
    background: #12122a;
    color: #eee;
    border: 1px solid #3a3a55;
    border-radius: 4px;
    font-size: 13px;
}

.overlay-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 1;
    font-size: 13px;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: rgba(200,60,60,0.18);
    color: #f88;
    border: 1px solid rgba(200,60,60,0.35);
    border-radius: 4px;
    cursor: pointer;
}

.overlay-remove-btn:hover:enabled {
    background: rgba(200,60,60,0.35);
    color: #f88;
}

/* --- Shared UI elements --- */

.shortcuts-popup {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    margin-top: 4px;
    background: #222;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    white-space: nowrap;
    font-size: 12px;
}

.toolbar-btn { font-size: 11px; padding: 2px 8px; }
.toolbar-btn-sm { font-size: 11px; padding: 2px 6px; }

/* --- ComicMaker --- */

.cm-filmstrip {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 8px 12px 2px;
}

.cm-panel-thumb {
    position: relative;
    min-width: 60px;
    flex-shrink: 1;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.cm-panel-thumb canvas {
    display: block;
    height: 72px;
    width: auto;
    max-width: 100%;
}

.cm-tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.cm-tab {
    padding: 3px 10px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* --- BetterGifMaker --- */

.gm-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    padding: 0 8px;
    gap: 6px;
    flex-wrap: wrap;
}

.gm-toolbar-group { display: flex; align-items: stretch; gap: 6px; }
.gm-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.gm-filmstrip-dim {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(0,0,0,0.55);
    pointer-events: none;
}

.gm-trim-bar {
    width: 12px;
    height: 100%;
    background: #F7D629;
    opacity: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-trim-touch {
    position: absolute;
    top: -6px;
    width: 30px;
    height: calc(100% + 12px);
    cursor: col-resize;
    z-index: 2;
}

.gm-track-label {
    flex: 1;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 10px;
}

.gm-grip { font-size: 8px; line-height: 1; pointer-events: none; }
