/* Reset-ish */
* { box-sizing: border-box; }
html, body { height: 100%; }

:root{
    --bg-start: #141727;
    --bg-end: #2a2f4f;
    --card: #1e2240;
    --card-glow: rgba(0, 188, 212, .25);
    --text: #e6e8f1;
    --muted: #9aa0b7;
    --primary: #00BCD4;
    --primary-2: #00acc1;
    --ok: #34d399;
    --warn: #fbbf24;
    --bad: #ef476f;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
}

body.theme{
    margin: 0;
    font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
    color: var(--text);
    background: radial-gradient(1200px 800px at 20% -10%, #243b55 0%, transparent 60%),
                radial-gradient(900px 900px at 100% 0%, #141e30 0%, transparent 60%),
                linear-gradient(160deg, var(--bg-start), var(--bg-end));
}

/* App shell */
.app-shell{
    min-height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

/* Header */
.app-header{
    padding: 32px 20px 10px;
    text-align: center;
}
.brand{
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.brand-badge{
    display: inline-grid;
    place-items: center;
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #6ee7f9);
    color: #0b1025;
    font-weight: 700;
    box-shadow: 0 8px 20px var(--card-glow);
}
.brand-title{
    margin: 0;
    font-size: 32px;
    letter-spacing: .5px;
}
.subtitle{
    margin: 8px 0 0;
    color: var(--muted);
}

/* Card */
.card{
    width: min(960px, 94%);
    margin: 28px auto 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)) , var(--card);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 16px;
    box-shadow: var(--shadow), 0 12px 40px var(--card-glow);
    padding: 22px 22px 28px;
    position: relative;
    overflow: hidden;
}

/* Status bar */
.status{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.status-item{
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    padding: 12px 14px;
    min-height: 84px;
}
.status-item .icon{
    vertical-align: middle;
    margin-right: 6px;
    font-size: 22px;
}
.icon.info{ color: var(--primary); }
.icon.warn{ color: var(--warn); }
.icon.ok{ color: var(--ok); }
.icon.bad{ color: var(--bad); }

.status-item .label{
    display: inline-block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.status-item .value{
    float: right;
    font-weight: 700;
    font-size: 22px;
}
.chips{
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip{
    font-weight: 600;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
}
.chip.ok{ border-color: rgba(52,211,153,.5); color: #b8f7d8; background: rgba(52,211,153,.12); }
.chip.bad{ border-color: rgba(239,71,111,.5); color: #ffd1dc; background: rgba(239,71,111,.12); }
.empty{ color: var(--muted); }

/* Word area */
.word-area{
    margin: 24px 8px 10px;
}
.word-list{
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.box{
    width: 42px;
    height: 56px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 -6px 12px rgba(0,0,0,.15);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 1px;
}

/* Controls */
.controls{
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.input-wrap{
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 12px;
    padding: 10px 12px;
}
.input-wrap i{
    color: var(--muted);
}
.input-wrap input{
    flex: 1;
    height: 42px;
    font-size: 18px;
    border: none;
    outline: none;
    color: var(--text);
    background: transparent;
}
.input-wrap input::placeholder{ color: #a7adc7; }

/* On-screen keyboard */
.keyboard{
    margin-top: 6px;
    display: grid;
    gap: 8px;
    justify-content: center;
}
.kb-row{
    display: flex;
    justify-content: center;
    gap: 8px;
}
.key{
    min-width: 36px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: var(--text);
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    transition: transform .05s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
    box-shadow: 0 6px 14px rgba(0,0,0,.25);
}
.key:hover{ transform: translateY(-1px); }
.key:active{ transform: translateY(0); }
.key.used,
.key[disabled]{
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Buttons row */
.buttons{
    display: flex;
    justify-content: center;
    gap: 12px;
}
.btn{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #0c122b;
    background: #e2e8f0;
    cursor: pointer;
    transition: transform .05s ease, box-shadow .2s ease, background .2s ease;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn[disabled]{
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
}
.btn.primary{
    background: linear-gradient(135deg, var(--primary), #6ee7f9);
}
.btn.warning{
    background: linear-gradient(135deg, var(--warn), #ffd166);
}
.btn.large{
    font-size: 18px;
    padding: 12px 20px;
}

.helper{
    text-align: center;
    color: var(--muted);
    margin: 4px 0 0;
}

/* Overlay result */
.overlay{
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(10,12,28,.6), rgba(10,12,28,.8));
    backdrop-filter: blur(2px);
}
.overlay-card{
    width: min(560px, 92%);
    text-align: center;
    background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 24px 18px 20px;
    box-shadow: var(--shadow);
    animation: popIn .2s ease-out;
}
@keyframes popIn{
    from{ transform: translateY(8px); opacity: 0; }
    to{ transform: translateY(0); opacity: 1; }
}
.result-icon{
    font-size: 52px;
    margin-bottom: 6px;
}
.result-title{
    margin: 0 0 6px;
    font-size: 28px;
}
.overlay-card.win .result-title{ color: var(--ok); }
.overlay-card.lose .result-title{ color: var(--bad); }
.reveal-title{
    color: var(--muted);
    margin: 4px 0 4px;
}
.reveal-answer{
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 4px;
    margin: 0 0 14px;
}

/* Reveal animation (kept from previous, slightly tuned) */
.reveal-char{
    display: inline-block;
    min-width: 20px;
    margin-right: 2px;
    text-align: center;
    opacity: 0;
    transform: translateY(-6px);
    animation: dropIn 320ms ease forwards;
}
.reveal-char:last-child{ margin-right: 0; }
.reveal-char:nth-child(1)  { animation-delay: 0ms; }
.reveal-char:nth-child(2)  { animation-delay: 40ms; }
.reveal-char:nth-child(3)  { animation-delay: 80ms; }
.reveal-char:nth-child(4)  { animation-delay: 120ms; }
.reveal-char:nth-child(5)  { animation-delay: 160ms; }
.reveal-char:nth-child(6)  { animation-delay: 200ms; }
.reveal-char:nth-child(7)  { animation-delay: 240ms; }
.reveal-char:nth-child(8)  { animation-delay: 280ms; }
.reveal-char:nth-child(9)  { animation-delay: 320ms; }
.reveal-char:nth-child(10) { animation-delay: 360ms; }
.reveal-char:nth-child(11) { animation-delay: 400ms; }
.reveal-char:nth-child(12) { animation-delay: 440ms; }
.reveal-char:nth-child(13) { animation-delay: 480ms; }
.reveal-char:nth-child(14) { animation-delay: 520ms; }
.reveal-char:nth-child(15) { animation-delay: 560ms; }

@keyframes dropIn{
    to{ opacity: 1; transform: translateY(0); }
}

/* Footer */
.app-footer{
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding-bottom: 20px;
}

/* Prevent Angular template flicker before compilation */
[ng-cloak] { display: none !important; }
