/* =========================================================
   GLOBAL
   ========================================================= */

:root {
    --bg: #020617;
    /* slate-950 */
    --panel: rgba(15, 23, 42, .8);
    --panel-2: rgba(2, 6, 23, .86);
    --border: rgba(255, 255, 255, .10);
    --border-2: rgba(255, 255, 255, .15);
    --text: #f1f5f9;
    /* slate-100 */
    --muted: rgba(226, 232, 240, .65);
    --muted2: rgba(226, 232, 240, .45);
    --brand: rgba(99, 102, 241, .35);
    /* indigo-ish */
    --brandText: #c7d2fe;
    /* indigo-200 */
    --danger: rgba(244, 63, 94, .20);
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --shadow: 0 20px 60px rgba(0, 0, 0, .45);
    --inset: inset 0 1px 0 rgba(255, 255, 255, .06);
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#poryBackground {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

.container,
.site-footer,
.modal,
.overlay {
    position: relative;
    z-index: 1;
}

/* =========================================================
   DEBUG COLUMN
   ========================================================= */

.debug-col {
    display: none;
}

.show-debug .debug-col {
    display: table-cell;
}


/* =========================================================
   LAYOUT HELPERS
   ========================================================= */

.container {
    max-width: 80rem;
    /* ~max-w-7xl */
    margin: 0 auto;
    padding: 1.5rem 1rem;
    /* py-6 px-4 */
    background: rgba(2, 6, 23, .68);
    border-radius: 1.5rem;
    width: min(100%, 80rem);
}

.card {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow);
}

.card-inner {
    padding: 1.25rem;
}

.panel {
    border: 1px solid var(--border);
    background: var(--panel-2);
    border-radius: var(--radius-2xl);
    box-shadow: var(--inset);
}


/* =========================================================
   BUTTONS / INPUTS
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: var(--radius-xl);
    padding: .5rem 1rem;
    font-weight: 600;
    font-size: .875rem;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, transform .05s ease, opacity .15s ease, color .15s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, .10);
}

.btn:active {
    transform: scale(.99);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-primary {
    background: rgba(99, 102, 241, .15);
    color: var(--brandText);
}

.btn-primary:hover {
    background: rgba(99, 102, 241, .25);
}

.btn-danger {
    background: rgba(244, 63, 94, .12);
    color: #fecdd3;
}

.btn-danger:hover {
    background: rgba(244, 63, 94, .20);
}

.btn-xs {
    padding: .375rem .625rem;
    font-size: .75rem;
    border-radius: .625rem;
}

.btn-full {
    width: 100%;
}

.file-btn {
    position: relative;
    overflow: hidden;
}

.file-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.input-range {
    width: 100%;
}


/* =========================================================
   HEADER BLOCK
   ========================================================= */

.header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
}

@media (min-width: 768px) {
    .header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.logo-box {
    height: 2.75rem;
    width: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(129, 140, 248, .35);
    background: rgba(99, 102, 241, .20);
}

.logo-box img {
    height: 2rem;
    width: 2rem;
    opacity: .8;
    transition: opacity .15s ease;
}

.logo-box img:hover {
    opacity: 1;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}


/* =========================================================
   “TIP / MINI BAR”
   ========================================================= */

.mini-bar {
    margin-top: .75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    color: rgba(226, 232, 240, .75);
    font-size: .875rem;
}

.mini-bar .muted-xs {
    font-size: .75rem;
    color: rgba(226, 232, 240, .55);
}

.link-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: .75rem;
    padding: .375rem .75rem;
    font-weight: 700;
    color: #a5b4fc;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.link-pill:hover {
    background: rgba(255, 255, 255, .10);
    color: #c7d2fe;
}


/* =========================================================
   DROPZONE
   ========================================================= */

.dropzone {
    margin-top: 1rem;
    border-radius: var(--radius-2xl);
    border: 2px dashed var(--border-2);
    background: var(--panel);
    padding: 1.5rem;
    text-align: center;
    outline: none;
    transition: border-color .15s ease, background .15s ease;
}

.dropzone.is-over {
    border-color: rgba(52, 211, 153, .60);
    background: rgba(52, 211, 153, .08);
}

.drop-grid {
    margin-top: .75rem;
    display: grid;
    gap: .5rem;
    font-size: 11px;
    color: rgba(226, 232, 240, .65);
}

@media (min-width: 768px) {
    .drop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.drop-hint {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, .20);
    padding: .5rem;
}

.drop-hint .title {
    font-weight: 700;
    color: rgba(226, 232, 240, .92);
}


/* =========================================================
   RESULTS WRAP
   ========================================================= */

.results {
    margin-top: 1rem;
    overflow: auto;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: 0 12px 35px rgba(0, 0, 0, .35);
}


/* =========================================================
   TABLE
   ========================================================= */

.table {
    width: 100%;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .75rem;
}

.table thead {
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, .96);
    border-bottom: 1px solid var(--border);
}

.table th {
    padding: .75rem;
    font-weight: 700;
    color: rgba(226, 232, 240, .92);
    white-space: nowrap;
}

.table td {
    padding: .75rem;
    vertical-align: top;
    color: rgba(226, 232, 240, .85);
    border-top: 1px solid rgba(255, 255, 255, .10);
}

.sprite {
    height: 3rem;
    width: 3rem;
    border-radius: .75rem;
    border: 1px solid var(--border);
    background: var(--panel);
    object-fit: contain;
}

.codebox {
    border-radius: .75rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .05);
    padding: .75rem;
}

.codebox pre {
    margin: 0;
    white-space: pre-wrap;
    font-size: 11px;
    line-height: 1.35;
}


/* =========================================================
   LOADING OVERLAY
   ========================================================= */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, .9);
}

.overlay.is-open {
    display: flex;
}

.overlay-card {
    width: min(28rem, 90vw);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, .92);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}

.progress-rail {
    height: .5rem;
    width: 100%;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
}

.progress-bar {
    height: .5rem;
    width: 0%;
    border-radius: 999px;
    background: rgba(99, 102, 241, .85);
    transition: width .2s ease;
}


/* =========================================================
   MODALS (both example + frame)
   ========================================================= */

body.modal-open {
    overflow: hidden;
}

.modal {
    -webkit-overflow-scrolling: touch;
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    background: rgba(0, 0, 0, .70);
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: .75rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}

.modal.is-open {
    display: block;
}

@media (min-width: 640px) {
    .modal {
        padding: 1.5rem;
        padding-bottom: calc(6rem + env(safe-area-inset-bottom));
    }
}

.modal-shell {
    min-height: 100svh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-card {
    width: 100%;
    max-width: 64rem;
    /* ~max-w-5xl */
    margin: 1rem 0 2.5rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, .95);
    box-shadow: var(--shadow);
    overflow: hidden;
}

@media (min-width: 640px) {
    .modal-card {
        margin: 1.5rem 0 3rem;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(to bottom, rgba(15, 23, 42, .95), rgba(15, 23, 42, .85));
}

.modal-title {
    font-weight: 800;
    font-size: .875rem;
    color: white;
}

.modal-sub {
    margin-top: .25rem;
    font-size: .75rem;
    line-height: 1.4;
    color: rgba(226, 232, 240, .70);
}

.modal-body {
    padding: 1rem;
}

@media (min-width: 640px) {
    .modal-body {
        padding: 1.25rem;
    }
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: .75rem 1.25rem;
    background: rgba(15, 23, 42, .85);
    font-size: 11px;
    color: rgba(226, 232, 240, .55);
}

.modal-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .modal-grid {
        grid-template-columns: 1fr 1fr;
    }
}


/* Scrollbox (progress/log areas) */

.scrollbox {
    overflow: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .05);
    padding: .5rem;
    font-size: 11px;
    color: rgba(226, 232, 240, .75);
    max-height: 11rem;
}

.scrollbox::-webkit-scrollbar {
    width: 10px;
}

.scrollbox::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .12);
    border-radius: 999px;
}

.scrollbox::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .04);
}


/* Button grid for responsive side-by-side */

.btn-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
}

@media (min-width: 640px) {
    .btn-grid {
        grid-template-columns: 1fr 1fr;
    }
}


/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
    margin-top: 2.5rem;
    border-top: 1px solid var(--border);
    background: rgba(2, 6, 23, .88);
    flex-shrink: 0;
}

.site-footer {
    margin-top: auto;
}

.site-footer .inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 12px;
    color: rgba(226, 232, 240, .60);
}

.footer-links {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.footer-tagline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    font-size: 11px;
    color: rgba(226, 232, 240, .45);
    white-space: nowrap;
}


/* Simple link style */

a {
    color: inherit;
}

a.link {
    color: #a5b4fc;
    text-decoration: underline;
    text-underline-offset: 2px;
}

a.link:hover {
    color: #c7d2fe;
}

.is-hidden {
    display: none !important;
}

.exampleTab.is-active {
    border-color: rgba(99, 102, 241, .45);
    background: rgba(99, 102, 241, .18);
    color: rgba(224, 231, 255, 1);
}

.preview-media {
    margin-top: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
}

.preview-media img,
.preview-media video {
    max-height: 60vh;
    width: auto;
    max-width: 100%;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    object-fit: contain;
}
