@keyframes bgcolor {
    0% {
        background-color: #45a3e5
    }

    30% {
        background-color: #66bf39
    }

    60% {
        background-color: #eb670f
    }

    90% {
        background-color: #f35
    }

    100% {
        background-color: #864cbf
    }
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Raleway', sans-serif;
    color: #fff;
    background: linear-gradient(135deg, #0f162a, #1c2d4b);
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.page-shell{
    max-width: 1100px;
    margin: 30px auto 70px auto;
    padding: 0 20px 40px;
    width: 100%;
    flex: 1;
}

.hidden{
    display: none !important;
}

#back{
    display: inline-block;
    margin: 16px 0 0 16px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    background: rgba(255,255,255,0.12);
    padding: 8px 14px;
    border-radius: 999px;
    transition: transform 0.2s ease, background 0.2s ease;
    align-self: flex-start;
}
#back:hover{
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}
#title{
    color: white;
    text-align: center;
    font-size: 50px;
    margin-bottom: 6px;
}
.top-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.top-actions{
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.btn-small{
    padding: 8px 10px;
    font-size: 14px;
}
.lang-switch{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.14);
}
.lang-switch select{
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
}
#subtitle{
    color: white;
    text-align: center;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 30px;
}
#link{
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

.panel{
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 18px 20px 22px;
    margin-bottom: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.panel label,
.panel .checkbox-inline span,
.panel .eyebrow,
.panel .subtext{
    color: #f8fbff;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}

.panel-header{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}
.panel-header h3{
    margin: 0;
}
.auth-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.auth-grid input{
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    box-sizing: border-box;
}
.auth-grid input::placeholder{
    color: rgba(255,255,255,0.8);
}
.auth-grid input{
    width: 100%;
}
.subpanel{
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.04);
}
.share-controls{
    margin-top: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}
.share-row{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 6px 0;
}
.actions-row{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.share-controls select{
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.share-controls label{
    font-weight: 700;
}
.checkbox-label{
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.checkbox-label input{
    width: auto;
}
.eyebrow{
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0 0 4px 0;
    opacity: 0.8;
}
.subtext{
    margin: 4px 0 0 0;
    opacity: 0.75;
    font-size: 14px;
}

#ia-box{
    margin-top: 10px;
}
details.panel > summary{
    list-style: none;
    cursor: pointer;
    user-select: none;
}
details.panel > summary::-webkit-details-marker{
    display: none;
}
details.panel[open] > summary{
    margin-bottom: 12px;
}
.checkbox-inline{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}
.ia-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.split-import{
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.split-import form{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#kahoot-form #kahoot-url{
    flex: 1 1 420px;
    min-width: 280px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
    box-sizing: border-box;
}
#ia-box input, #ia-box select, #ia-box textarea{
    width: 100%;
    box-sizing: border-box;
    margin-top: 4px;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
}
#ia-box button{
    margin: 6px 6px 6px 0;
    padding: 8px 12px;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: #1b1b1b;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
#ia-box button.secondary{
    background: #eee;
    color: #222;
}
#ia-prompt{
    background: rgba(0,0,0,0.5);
    color: #eee;
    padding: 10px;
    border-radius: 6px;
    max-height: 200px;
    overflow: auto;
}
#ia-status{
    color: white;
    font-weight: bold;
}

.ia-preview{
    display: grid;
    gap: 10px;
    margin-top: 8px;
}
.ia-preview__q{
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 12px;
}
.ia-preview__qtitle{
    font-weight: 700;
    margin-bottom: 8px;
}
.ia-preview__answers{
    display: grid;
    gap: 6px;
}
.ia-preview__answer{
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    align-items: start;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
}
.ia-preview__answer.is-correct{
    background: rgba(102,191,57,0.18);
    border: 1px solid rgba(102,191,57,0.22);
}
.ia-preview__bullet{
    font-weight: 900;
}

#csv-import{
    color: white;
    margin-bottom: 24px;
}
#csv-form input, #csv-form button{
    margin: 5px;
}
#csv-form input{
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
}
#csv-form button{
    padding: 10px 16px;
    border-radius: 999px;
    border: none;
    background: #fff;
    color: #1b1b1b;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#csv-form button:hover,
#ia-box button:hover{
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
#csv-status{
    color: white;
}

#library{
    color: #fff;
}
.pill{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
}
.pill-muted{
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
}
.moodle-icon-img{
    width: 20px;
    height: 20px;
    object-fit: contain;
}
.filter-bar{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    background: rgba(15,22,42,0.65);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 10px 12px;
    color: #f5f8ff;
}
.filter-bar.extra-gap{
    gap: 14px;
}
.filter-bar input[type="search"]{
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    flex: 1;
    min-width: 220px;
}
.sort-control{
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.sort-control label{
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase;
}
.sort-control select{
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-weight: 600;
}
.filter-bar .checkbox-inline{
    margin: 0;
}
.tag-suggestions{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px 0;
    align-items: center;
}
.tag-suggestions .label{
    font-size: 14px;
    opacity: 0.85;
}
.tag-suggestions .tag{
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fefefe;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    transition: background 0.2s ease, transform 0.2s ease;
}
.tag-suggestions .tag.active{
    background: #fff;
    color: #0f162a;
    border-color: #fff;
}

.tag-suggestions .tag:hover{
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.tag-suggestions .tag.tag-more{
    font-weight: 800;
    opacity: 0.9;
}

.game-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.game-card{
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 14px 14px 12px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.game-card-head{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.game-title{
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    word-break: break-word;
}
.badge{
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    letter-spacing: 0.5px;
}
.tag-wrap{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: -4px;
}

.tag-editor{
    display:flex;
    gap:8px;
    align-items:center;
    flex-wrap:wrap;
    margin-top:6px;
}

.tag-editor input{
    flex:1;
    min-width: 180px;
    max-width: 100%;
}

.tag.tag-editable{
    display:inline-flex;
    align-items:center;
    gap:6px;
}

.tag .tag-remove{
    border:0;
    background:transparent;
    cursor:pointer;
    line-height:1;
    padding:0 2px;
    font-size: 16px;
}
.tag{
    font-size: calc(12px + 6px * var(--tag-weight, 0.2));
    padding: 6px 12px;
    background: rgba(255,255,255, calc(0.08 + 0.12 * var(--tag-weight, 0.2)));
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255, calc(0.15 + 0.25 * var(--tag-weight, 0.2)));
    box-shadow: 0 10px 26px rgba(0, 0, 0, calc(0.12 + 0.18 * var(--tag-weight, 0.2)));
    opacity: calc(0.7 + 0.2 * var(--tag-weight, 0.2));
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.tag.active{
    background: #fff;
    color: #0f162a;
    border-color: #fff;
    opacity: 1;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
.tag:hover{
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}
.game-meta{
    margin: 4px 0;
    font-size: 14px;
    opacity: 0.85;
}
.game-stats{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    opacity: 0.9;
    margin-top: -4px;
}
.game-stats__item{
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: capitalize;
    color: #f5f7ff;
}
.game-subtitle{
    margin: 0;
    font-size: 13px;
    opacity: 0.8;
}
.game-actions{
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.game-actions .icon-only{
    min-width: 42px;
    padding: 10px 0;
    text-align: center;
}
.btn{
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn.btn-with-icon{
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-icon{
    width: 18px;
    height: 18px;
    object-fit: cover;
    border-radius: 4px;
}
.export-select{
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-weight: 600;
}
.btn-primary{
    background: linear-gradient(135deg, #ffee70, #ffb347);
    color: #1b1b1b;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}
.btn-ghost{
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.16);
}
.btn-ghost#tag-mode-toggle{
    letter-spacing: 0.04em;
    text-transform: none;
}
.btn-ghost#tag-mode-toggle.is-active{
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
}
.btn-danger{
    background: rgba(255,80,80,0.14);
    color: #ffdede;
    border: 1px solid rgba(255,80,80,0.35);
}
.btn:hover{
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}
.empty-state{
    grid-column: 1 / -1;
    text-align: center;
    padding: 26px;
    border: 1px dashed rgba(255,255,255,0.25);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: #f5f5f5;
}
.empty-state p{
    margin: 4px 0;
    font-weight: 700;
}

.pagination{
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}
.pagination span{
    font-weight: 600;
    color: #fff;
}
.pagination button:disabled{
    opacity: 0.5;
    cursor: not-allowed;
}

body.modal-open{
    overflow: hidden;
}

.modal{
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal__backdrop{
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
}
.modal__content{
    position: relative;
    width: min(920px, 100%);
    max-height: 90vh;
    overflow: auto;
}
.modal .panel{
    background: rgba(15,22,42,0.92);
    border: 1px solid rgba(255,255,255,0.18);
}
.modal__close{
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.site-footer{
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

.site-footer__link{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
}

.site-footer__logo{
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
}

.site-footer__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.site-footer__about {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
}

@media (max-width: 600px){
    .page-shell{
        margin: 16px auto 46px auto;
        padding: 0 14px 26px;
    }

    #back{
        margin: 12px 0 0 12px;
    }

    .top-row{
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 10px;
    }
    .top-actions{
        display: flex;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    #title{
        font-size: 32px;
        margin: 6px 0 0 0;
        line-height: 1.1;
    }
    #subtitle{
        font-size: 16px;
        margin-bottom: 18px;
    }

    .panel{
        padding: 14px 14px 16px;
        border-radius: 14px;
    }

    .actions-row{
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input[type="search"]{
        min-width: 0;
        flex-basis: 100%;
    }

    .split-import form{
        flex-direction: column;
        align-items: stretch;
    }
    #kahoot-form #kahoot-url{
        min-width: 0;
        flex-basis: auto;
        width: 100%;
    }

    #csv-form{
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    #csv-form input, #csv-form button{
        margin: 0;
        width: 100%;
    }

    #ia-box button{
        width: 100%;
        margin: 6px 0;
    }
}
