/* ============================================================
   UCplus Vendespil – Sikringsteknik
   Stylesheet v1.0.1 | Forfatter: Vander Web
   ============================================================ */

.ucplus-vendespil {
    font-family: inherit;
    max-width: 900px;
    margin: 2em auto;
    box-sizing: border-box;
}

/* --- Titel --- */
.uvs-title {
    font-size: 1.4em;
    margin: 0 0 .75em;
    color: #1a5276;
    border-bottom: 2px solid #1a5276;
    padding-bottom: .3em;
}

/* ============================================================
   OPSÆTNINGSSKÆRM
   ============================================================ */
.uvs-setup {
    background: #eaf4fb;
    border: 2px solid #a9cce3;
    border-radius: 12px;
    padding: 1.8em 2em;
    max-width: 520px;
}

.uvs-setup-intro {
    margin: 0 0 1.2em;
    color: #1a5276;
    font-size: .97em;
}

.uvs-setup-row {
    display: flex;
    align-items: center;
    gap: .7em;
    flex-wrap: wrap;
    margin-bottom: 1em;
}

.uvs-setup-label {
    font-weight: 700;
    color: #1a5276;
    white-space: nowrap;
}

.uvs-slider {
    flex: 1;
    min-width: 120px;
    accent-color: #1a5276;
    cursor: pointer;
    height: 6px;
}

.uvs-slider-value {
    font-size: 1.4em;
    font-weight: 700;
    color: #1a5276;
    min-width: 2em;
    text-align: right;
}

.uvs-slider-max {
    color: #7f8c8d;
    font-size: .9em;
}

/* Preset-knapper */
.uvs-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: .4em;
    margin-bottom: 2em;
}

.uvs-preset {
    background: #d6eaf8;
    color: #1a5276;
    border: 1px solid #a9cce3;
    padding: .3em .75em;
    border-radius: 20px;
    font-size: .85em;
    cursor: pointer;
    transition: background .15s;
}

.uvs-preset:hover,
.uvs-preset:focus {
    background: #a9cce3;
}

/* Start-knap */
.uvs-btn-start {
    background: #1a5276;
    color: #fff;
    border: none;
    padding: .65em 1.8em;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}

.uvs-btn-start:hover,
.uvs-btn-start:focus {
    background: #154360;
    outline: 2px solid #a9cce3;
    outline-offset: 2px;
}

/* ============================================================
   SPILSKÆRM
   ============================================================ */
.uvs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
    flex-wrap: wrap;
    gap: .5em;
}

.uvs-stats {
    display: flex;
    gap: 1.5em;
    font-size: .95em;
}

.uvs-header-btns {
    display: flex;
    gap: .5em;
    flex-wrap: wrap;
}

.uvs-btn {
    background: #1a5276;
    color: #fff;
    border: none;
    padding: .5em 1.2em;
    border-radius: 6px;
    cursor: pointer;
    font-size: .9em;
    transition: background .2s;
}

.uvs-btn:hover,
.uvs-btn:focus {
    background: #154360;
    outline: 2px solid #a9cce3;
    outline-offset: 2px;
}

/* "Skift antal"-knap – lidt lysere */
.uvs-btn-setup {
    background: #5d8aa8;
}

.uvs-btn-setup:hover,
.uvs-btn-setup:focus {
    background: #1a5276;
}

/* "Nulstil"-knap – neutral grå */
.uvs-btn-reset {
    background: #717d7e;
}

.uvs-btn-reset:hover,
.uvs-btn-reset:focus {
    background: #4d5656;
}

/* ============================================================
   KORTGRID
   ============================================================ */
.uvs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 12px;
}

.uvs-card {
    height: 130px;
    perspective: 700px;
    cursor: pointer;
}

.uvs-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .4s ease;
}

.uvs-card.flipped .uvs-card-inner {
    transform: rotateY(180deg);
}

.uvs-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    border: 2px solid #bdc3c7;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    overflow: hidden;
}

/* Par-label (kun bagside) */
.uvs-par-label {
    font-size: .68em;
    font-weight: 700;
    letter-spacing: .03em;
    color: #1a5276;
    white-space: nowrap;
}

.uvs-icon,
.uvs-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px 8px;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.35;
}

/* Forside */
.uvs-card-face.uvs-front {
    background: #1a5276;
    color: #fff;
    border-color: #1a5276;
    justify-content: center;
}

.uvs-front .uvs-icon {
    font-size: 1.8em;
}

/* Bagside */
.uvs-card-face.uvs-back {
    background: #fff;
    color: #222;
    font-size: .78em;
    transform: rotateY(180deg);
    position: relative;
}

/* Par-label række (label + TTS knap side om side) */
.uvs-back-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    background: #d6eaf8;
    padding: 3px 6px;
    flex-shrink: 0;
}

/* Match */
.uvs-card.matched .uvs-card-inner {
    transform: rotateY(180deg);
}

.uvs-card.matched .uvs-card-face.uvs-back {
    background: #d4efdf;
    border-color: #27ae60;
}

.uvs-card.matched .uvs-back-header {
    background: #a9dfbf;
}

.uvs-card.matched .uvs-par-label {
    color: #1e8449;
}

/* Fejl */
.uvs-card.wrong .uvs-card-face.uvs-back {
    background: #fadbd8;
    border-color: #e74c3c;
}

/* Sejr */
.uvs-win {
    background: #d4efdf;
    border: 2px solid #27ae60;
    border-radius: 10px;
    padding: 1.5em;
    text-align: center;
    font-size: 1.1em;
    margin-top: 1em;
}

/* ============================================================
   RESPONSIV
   ============================================================ */
@media (max-width: 480px) {
    .uvs-setup { padding: 1.2em; }
    .uvs-grid  { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .uvs-card  { height: 110px; }
    .uvs-par-label { font-size: .62em; }
}

/* ============================================================
   FORHÅNDSVISNING (skærm 2)
   ============================================================ */
.uvs-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: .8em;
    margin-bottom: 1.2em;
}

.uvs-preview-intro {
    margin: 0;
    color: #1a5276;
    font-size: .97em;
}

.uvs-preview-btns {
    display: flex;
    gap: .5em;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* "Bland og start"-knap lidt mere fremtrædende */
.uvs-btn-play {
    background: #1e8449;
    font-weight: 700;
}

.uvs-btn-play:hover,
.uvs-btn-play:focus {
    background: #196f3d;
}

/* Tabelramme */
.uvs-preview-table {
    border: 1px solid #d0dce8;
    border-radius: 8px;
    overflow: hidden;
}

/* Kolonneoverskrifter */
.uvs-preview-col-head {
    display: grid;
    grid-template-columns: 90px 1fr 1fr;
    background: #1a5276;
    color: #fff;
    font-weight: 700;
    font-size: .85em;
}

.uvs-preview-col-head span {
    padding: .55em .8em;
    border-right: 1px solid rgba(255,255,255,.2);
}

.uvs-preview-col-head span:last-child {
    border-right: none;
}

.uvs-col-par {
    text-align: center;
}

/* Par-rækker */
.uvs-pair-row {
    display: grid;
    grid-template-columns: 90px 1fr 1fr;
    border-bottom: 1px solid #e8eef4;
    font-size: .88em;
    line-height: 1.4;
}

.uvs-pair-row:last-child {
    border-bottom: none;
}

.uvs-pair-row:nth-child(even) {
    background: #f5f9fd;
}

.uvs-pair-cell {
    padding: .55em .8em;
    vertical-align: middle;
}

.uvs-pair-label {
    font-size: .78em;
    font-weight: 700;
    color: #1a5276;
    background: #d6eaf8;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #d0dce8;
}

.uvs-pair-front {
    border-right: 1px solid #d0dce8;
    color: #222;
}

.uvs-pair-back {
    color: #1e6b3a;
}

@media (max-width: 480px) {
    .uvs-preview-col-head,
    .uvs-pair-row {
        grid-template-columns: 72px 1fr 1fr;
    }

    .uvs-pair-cell {
        padding: .4em .5em;
        font-size: .82em;
    }

    .uvs-preview-header {
        flex-direction: column;
    }
}

/* ============================================================
   TTS – OPLÆSNINGSKNAPPER
   ============================================================ */

/* Fælles base */
.uvs-speak-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .95em;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: .65;
    transition: opacity .15s, background .15s;
    vertical-align: middle;
}

.uvs-speak-btn:hover,
.uvs-speak-btn:focus {
    opacity: 1;
    background: rgba(0,0,0,.07);
    outline: none;
}

/* Aktiv / taler */
.uvs-speak-btn.uvs-speaking {
    opacity: 1;
    animation: uvs-pulse .8s ease-in-out infinite alternate;
}

@keyframes uvs-pulse {
    from { transform: scale(1);    opacity: .8; }
    to   { transform: scale(1.15); opacity: 1;  }
}

/* Knap i forhåndsvisnings-rækker */
.uvs-speak-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 5px auto 0;
    width: 28px;
    height: 28px;
    background: #1a5276;
    color: #fff;
    border-radius: 50%;
    font-size: .85em;
    opacity: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.uvs-speak-row:hover,
.uvs-speak-row:focus {
    background: #154360;
    opacity: 1;
}

/* Knap på kortets bagside (inline ved siden af label) */
.uvs-speak-card {
    font-size: .8em;
    padding: 1px 4px;
    opacity: 1;
    line-height: 1;
    background: rgba(255,255,255,.5);
    border-radius: 3px;
    border: 1px solid rgba(26,82,118,.25) !important;
}

.uvs-speak-card:hover,
.uvs-speak-card:focus {
    opacity: 1;
    background: rgba(255,255,255,.9);
}
