@import url('https://fonts.googleapis.com/css2?family=Special+Elite&display=swap');

:root {
    --simple-shadow: 0 2px 2px rgba(0, 0, 0, 0.05)
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

body {
    font-family: "Segoe UI", sans-serif;
    background: Gainsboro;
    color: #1A2332;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-font-smoothing: antialiased
}

.hidden {
    display: none !important
}

.panel {
    background: rgba(255, 255, 255, 0.5);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--simple-shadow)
}

.screen {
    width: 100%;
    max-width: 1040px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 72px)
}

.top-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: var(--simple-shadow)
}

.top-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px
}

.header-logo {
    width: 28px;
    height: 28px;
    color: #5C6BC0
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px
}

.header-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #5F6B7A;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s
}

.header-btn:hover {
    background: rgba(92, 107, 192, 0.08);
    color: #5C6BC0
}

.header-btn svg {
    width: 20px;
    height: 20px
}

.connection-badge {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #5F6B7A;
    padding: 6px 14px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.1)
}

.connection-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor
}

.connection-badge.connected {
    color: #66BB6A
}

.connection-badge.disconnected {
    color: #EF5350
}

.login-panel {
    text-align: center;
    max-width: 420px;
    width: 100%;
    padding: 44px;
    border-radius: 20px
}

#login-screen h1 {
    font-size: 2.4rem;
    font-weight: 600;
    letter-spacing: -0.8px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #5C6BC0, #7986CB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

#login-screen h2 {
    font-size: 1rem;
    font-weight: 400;
    color: #5F6B7A;
    margin-bottom: 36px
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    color: #1A2332;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 24px
}

input[type="text"]:focus {
    border-color: #5C6BC0;
    box-shadow: 0 0 0 4px rgba(92, 107, 192, 0.12)
}

input[type="text"]::placeholder {
    color: #8896A6
}

.shake-input {
    animation: shakeInput .4s;
    border-color: #EF5350
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.7);
    color: #323130;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    font-family: 'Segoe UI', system-ui, sans-serif;
    cursor: pointer;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: background 0.1s ease, box-shadow 0.1s ease
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04)
}

.btn:active:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none
}

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

.btn.primary {
    background: #5C6BC0;
    color: #fff;
    border-color: #2E3663;
    box-shadow: 0 3px 6px rgba(92, 107, 192, 0.6)
}

.btn.primary:hover:not(:disabled) {
    background: #2E3663
}

.btn.success {
    background: #107C10;
    color: #fff;
    border-color: #0B6A0B;
    box-shadow: 0 1px 4px rgba(16, 124, 16, 0.4);
    backdrop-filter: none;
    -webkit-backdrop-filter: none
}

.btn.success:hover:not(:disabled) {
    background: #0B6A0B;
    box-shadow: 0 2px 8px rgba(16, 124, 16, 0.5)
}

.btn.success:active:not(:disabled) {
    background: #085108;
    box-shadow: none
}

.layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%
}

#game-screen {
    max-width: none;
    width: 100%;
    position: relative;
    padding-right: 284px
}

#game-screen .layout {
    max-width: 700px;
    width: 100%;
    margin: 0 auto
}

.right-sidebar {
    position: fixed;
    top: 82px;
    right: 24px;
    width: 260px;
    bottom: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: var(--simple-shadow)
}

.right-sidebar h3 {
    font-size: 0.75rem;
    color: #5C6BC0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1.5px
}

.right-sidebar h3 svg {
    width: 16px;
    height: 16px
}

.right-sidebar section {
    margin-bottom: 20px
}

#players-list,
#ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px
}

#players-list li,
#ranking-list li {
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent
}

#players-list li:hover {
    background: rgba(92, 107, 192, 0.08);
    border-color: rgba(0, 0, 0, 0.1)
}

#players-list li.current-player {
    font-weight: 700;
    background: rgba(92, 107, 192, 0.12);
    color: #5C6BC0;
    border-color: rgba(92, 107, 192, 0.35)
}

.player-status,
.medal {
    width: 18px;
    height: 18px;
    flex-shrink: 0
}

.empty-state {
    color: #8896A6;
    font-style: italic;
    font-size: 0.85rem
}

.label-target,
.label-timer {
    font-size: 0.75rem;
    color: #5C6BC0;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px
}

.value-target,
.value-timer {
    font-size: 4rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -1px
}

.value-timer.urgent {
    color: #EF5350;
    font-weight: 600
}

.value-timer.warning {
    color: #FFA726
}

.value-timer.safe {
    color: #66BB6A
}

#controls-panel {
    position: relative
}

.controls {
    text-align: center
}

.welcome-panel {
    margin-bottom: 36px
}

.welcome-title {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 28px;
    letter-spacing: -0.6px
}

.welcome-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.welcome-mode {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    text-align: left;
    backdrop-filter: blur(20px);
    overflow: hidden
}

.welcome-mode h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #5C6BC0;
    letter-spacing: -0.3px
}

.welcome-mode p {
    font-size: 0.9rem;
    color: #5F6B7A;
    line-height: 1.7
}

#choosing-subtitle {
    font-size: 0.95rem;
    color: #5F6B7A
}

.vowel-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px
}

.vowel-buttons .btn {
    width: auto;
    padding: 12px 20px
}

.cifras-layout {
    display: flex;
    flex-direction: column;
    gap: 20px
}

.cifras-top-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 24px;
    align-items: center
}

.cifras-target,
.cifras-timer {
    height: 160px
}

.letras-layout {
    display: flex;
    flex-direction: column;
    gap: 20px
}

.letras-top-row {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 16px;
    align-items: stretch
}

#word-display {
    height: 100px;
    padding: 12px
}

.letras-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap
}

.letras-actions .action-btn {
    min-width: 120px
}

.cifras-originals {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 14px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1)
}

.cifras-originals span {
    color: #5F6B7A;
    font-size: 0.85rem;
    font-weight: 500
}

.original-numbers {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.orig-num {
    color: #5C6BC0;
    font-weight: 600;
    font-size: 1rem;
    background: rgba(92, 107, 192, 0.12);
    padding: 4px 14px;
    border-radius: 6px;
    border: 1px solid rgba(92, 107, 192, 0.35)
}

.numbers-keypad {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap
}

.cifras-ops-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap
}

.expression-display {
    font-family: 'Special Elite', cursive;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 24px 20px;
    border-radius: 2px;
    background: #FFEBA1;
    border: 1px solid #E6D08A;
    box-shadow: 1px 3px 6px rgba(0, 0, 0, 0.1);
    height: calc(7.8rem + 98px);
    position: relative
}

.expression-display::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%) rotate(3deg);
    width: 46px;
    height: 20px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 1px
}

#expression-display {
    transform: rotate(-0.5deg)
}

.btn-clear-postit {
    position: absolute;
    top: 0px;
    right: 0px;
    padding: 5px 8px;
    background-color: transparent;
    color: #AD8363;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: wavy underline #8D8363;
    text-underline-offset: 6px;
    cursor: pointer;
    transition: all .3s;
    letter-spacing: 0.1em
}

.btn-clear-postit:hover {
    color: rgba(150, 0, 0, 1);
    text-decoration-color: rgba(150, 0, 0, 1)
}

.expression-display .placeholder {
    color: #8D8363;
    text-align: center;
    text-wrap: balance
}

.step-row {
    font-size: 1.2rem;
    font-weight: 500;
    color: #3E2723;
    padding: 3px 0;
    font-family: 'Special Elite', cursive;
    line-height: 1.3;
}

.letters-keypad {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap
}

.keypad-btn {
    background: rgba(255, 255, 255, 0.75);
    border: 2px solid rgba(0, 0, 0, 0.1);
    color: #1A2332;
    font-family: inherit;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all .3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center
}

.keypad-btn:hover {
    background: rgba(92, 107, 192, 0.08);
    border-color: #5C6BC0;
    transform: translateY(-2px)
}

.keypad-btn.selected {
    background: #5C6BC0;
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 20px rgba(92, 107, 192, 0.15)
}

.num-btn {
    font-size: 1.6rem;
    min-width: 76px;
    min-height: 56px;
    font-weight: 700
}

.op-btn {
    font-size: 1.3rem;
    min-width: 60px;
    min-height: 48px
}

.action-btn {
    font-size: 0.85rem;
    padding: 0 24px;
    min-height: 48px
}

.action-btn.success {
    color: #fff;
    background: #66BB6A;
    border-color: transparent
}

.keypad-btn.used {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: transparent
}

.letters-keypad .keypad-btn {
    flex: 1;
    min-width: 52px;
    min-height: 60px;
    font-size: 1.35rem;
    font-weight: 700
}

.toast {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: -10;
    pointer-events: none;
    width: 370px;
    height: 40px;
}

.toast.toast-error,
.toast.toast-info {
    opacity: 1;
    pointer-events: auto
}

.toast svg {
    width: 20px;
    height: 20px
}

.winner-banner {
    text-align: center;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
    width: 100%;
    align-items: center
}

#winner-text {
    padding-bottom: 16px;
    text-wrap: balance;
    text-align: center;
    font-size: 1rem;
    color: #5F6B7A
}

.winner-main-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: rotate(-1.5deg)
}

.winner-steps .expression-display {
    aspect-ratio: 1;
}

.winner-side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-score-gif {
    width: 100%;
    border-radius: 12px
}

#next-round-btn {
    grid-column: 1 / -1
}

.panel-title {
    color: #5C6BC0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px
}

.winner-side-panel ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.winner-side-panel li {
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.1)
}

.winner-side-panel li .player-name {
    font-weight: 600
}

.winner-side-panel li .player-result {
    font-weight: 700;
    color: #5C6BC0
}

.winner-side-panel li .player-distance {
    font-size: 0.8rem;
    color: #8896A6;
    margin-left: 4px
}

@keyframes shakeInput {

    0%,
    100% {
        transform: translateX(0)
    }

    25% {
        transform: translateX(-5px)
    }

    75% {
        transform: translateX(5px)
    }
}

.expression-display.shake {
    animation: shakeInput .4s;
    border-color: #EF5350
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    text-align: center;
    font-size: 0.8rem;
    color: #8896A6
}
