/*
 * Çinko TV — yansıtma ekranı. Palet CinkoTheme.xaml'daki adların CSS karşılığıdır;
 * ekranlarda renk doğrudan yazılmaz, bu değişkenler kullanılır.
 * Eski/yavaş TV tarayıcıları hedeflendiği için animasyonlar transform/opacity ile sınırlı.
 */

:root {
    --background-start: #B92E34;
    --background-end: #3D0C02;
    --surface: #F7ECD2;
    --surface-muted: #E4D2A8;
    --surface-border: #D8C4A0;
    --accent: #8C1C13;
    --accent-deep: #2B1B17;
    --mark-red: #C1121F;
    --gold: #F0C05A;
    --text-on-surface: #2B1B17;
    --text-on-surface-muted: #6B5A50;
    --text-on-dark: #F7ECD2;
    --text-on-dark-muted: #E4D2A8;
    --outline-on-dark: #C87F76;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: "Open Sans", "Segoe UI", sans-serif;
    background: var(--background-end);
    overflow: hidden;
}

.tv-root {
    position: relative;
    height: 100vh;
    background: linear-gradient(326deg, var(--background-start) 0%, var(--background-end) 74%);
    color: var(--text-on-dark);
}

/* --- Bekleme ve eşleştirme ------------------------------------------------ */

.tv-waiting, .tv-pairing {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    text-align: center;
}

/* Marka kilidi: satır imzası + ÇİNKO + alt yazı (logo-dark.svg, vektör). */
.tv-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.tv-brand-logo {
    width: min(24rem, 60vw);
    height: auto;
}

.tv-brand-badge {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    padding-left: 0.35em;
    color: var(--gold);
}

.tv-subtitle {
    font-size: 1.4rem;
    color: var(--text-on-dark-muted);
}

.tv-status {
    font-size: 1.1rem;
    color: var(--text-on-dark);
}

.tv-qr {
    width: min(38vh, 40vw);
    height: min(38vh, 40vw);
    border-radius: 1.2rem;
    background: var(--surface);
    padding: 0.8rem;
}

/* Kod elle de girilebilsin: iri, harf aralıklı. */
.tv-code {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.45em;
    padding-left: 0.45em; /* harf aralığı son harfin sağına da boşluk koyar; dengele */
    color: var(--gold);
}

/* --- Yansıtma düzeni ------------------------------------------------------ */

.tv-mirror {
    height: 100%;
    box-sizing: border-box;
    padding: 1.2rem;
    display: flex;
    gap: 1.4rem;
}

.tv-left {
    width: 17rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.tv-number-card {
    background: var(--surface);
    border-radius: 1.3rem;
    padding: 1rem 0.5rem 1.1rem;
    text-align: center;
}

.tv-rolling {
    font-size: 5rem;
    line-height: 1.1;
    font-weight: 700;
    color: var(--accent);
}

.tv-rolling.rolling {
    opacity: 0.75;
}

.tv-phase {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-on-surface);
}

.tv-remaining {
    font-size: 0.95rem;
    color: var(--text-on-surface-muted);
}

.tv-awards {
    border: 1px solid var(--outline-on-dark);
    border-radius: 1.1rem;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tv-award-title {
    font-size: 0.9rem;
    color: var(--text-on-dark-muted);
}

.tv-award-state {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-on-dark-muted);
}

.tv-award-state.expected { color: var(--text-on-dark); }
.tv-award-state.won { color: var(--gold); }

.tv-recent-title {
    font-size: 0.95rem;
    color: var(--text-on-dark-muted);
    margin-bottom: 0.4rem;
}

/* Kısayol ipucu: ekranın altında kısa süreli şerit. */
.tv-hint {
    position: fixed;
    left: 50%;
    bottom: 2.5rem;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: var(--text-on-dark);
    border: 1px solid var(--text-on-dark-muted);
    border-radius: 0.75rem;
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
    z-index: 50;
}

/* Odadan çıkış: göz almasın, ama kumanda ve fare bulabilsin. */
.tv-detach {
    margin-top: auto;
    align-self: flex-start;
    background: transparent;
    border: 1px solid var(--text-on-dark-muted);
    border-radius: 0.5rem;
    color: var(--text-on-dark-muted);
    font: inherit;
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
    opacity: 0.7;
    cursor: pointer;
}

.tv-detach:hover,
.tv-detach:focus {
    opacity: 1;
    outline: 2px solid var(--text-on-dark);
}

/* İlk basış yapıldı: tuş dikkat çeksin, ikinci basış kapatır. */
.tv-detach.armed {
    opacity: 1;
    color: var(--text-on-dark);
    border-color: var(--text-on-dark);
    background: rgba(255, 255, 255, 0.12);
}

.tv-recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tv-recent-cell {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.55rem;
    background: var(--surface-muted);
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-width: 0;
}

/* Yansıtma başlığı: düz yazı yerine marka kilidi. */
.tv-title-logo {
    height: 3.4rem;
    width: auto;
    align-self: center;
}

.tv-pending {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
}

/* 1..90 tablosu: 10 sütun × 9 satır. */
.tv-board {
    flex: 1;
    border: 1px solid var(--outline-on-dark);
    border-radius: 1.1rem;
    padding: 0.8rem;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-auto-rows: 1fr;
    gap: 0.35rem;
}

.tv-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.35rem;
    font-weight: 700;
    background: rgba(43, 27, 23, 0.55);
    color: var(--outline-on-dark);
}

.tv-cell.drawn {
    background: var(--surface);
    color: var(--accent);
}

.tv-cell.newest {
    animation: tv-pop 0.6s ease-out;
    box-shadow: 0 0 0 3px var(--gold);
}

@keyframes tv-pop {
    0% { transform: scale(1.45); }
    100% { transform: scale(1); }
}

/* --- Kutlama -------------------------------------------------------------- */

.tv-celebration {
    position: absolute;
    inset: 0;
    background: rgba(61, 12, 2, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tv-celebration-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    z-index: 1;
}

.tv-celebration-title {
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--gold);
}

.tv-celebration-subtitle {
    font-size: 1.3rem;
    color: var(--text-on-dark-muted);
}

.tv-card {
    background: var(--surface);
    border: 0.55rem solid var(--accent);
    border-radius: 1.4rem;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: 0 0.9rem 2.5rem rgba(61, 12, 2, 0.45);
}

.tv-card-row {
    display: flex;
    gap: 0.4rem;
}

.tv-card-cell {
    width: 4.2rem;
    height: 4.2rem;
    border-radius: 0.6rem;
    background: var(--surface-muted);
    color: var(--text-on-surface);
    font-size: 1.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tv-card-cell.empty {
    background: transparent;
    border: 1px solid var(--surface-border);
}

/* Kademeyle ilgisi olmayan sayılar gizli: kartın kalan satırları hâlâ oyunda. */
.tv-card-cell.masked {
    color: var(--text-on-surface-muted);
}

.tv-card-cell.marked {
    background: var(--mark-red);
    color: var(--surface);
    animation: tv-pop 0.35s ease-out;
}

.tv-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Oyundaki ConfettiView ile aynı dil: alttan yukarı süzülen baloncuklar.
   Boy/renk/sürüklenme parça başına satır içi değişkenlerle verilir. */
.tv-confetti-piece {
    position: absolute;
    bottom: -5vh;
    border-radius: 50%;
    opacity: 0;
    animation-name: tv-rise;
    animation-timing-function: ease-out;
    animation-iteration-count: infinite;
}

@keyframes tv-rise {
    0% { transform: translate(0, 0); opacity: 0.9; }
    70% { opacity: 0.7; }
    100% { transform: translate(var(--drift, 0px), -115vh); opacity: 0; }
}
