* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #111;
    color: #eee;
    min-height: 100vh;
}

.app-shell {
    max-width: 680px;
    margin: 0 auto;
    padding: 18px 16px 24px;
}

.hero {
    text-align: center;
    margin-bottom: 20px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.hero p {
    margin: 10px auto 0;
    max-width: 680px;
    font-size: 0.95rem;
    color: #aaa;
}

.card {
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    margin-bottom: 18px;
}

.hidden {
    display: none;
}

label {
    font-weight: 700;
    color: #d7dadf;
}

input,
button {
    font-family: inherit;
}

input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: #1a1a1d;
    color: #f3f4f6;
    font-size: 1rem;
    padding: 14px 16px;
}

input[readonly] {
    cursor: text;
}

input:focus {
    outline: 2px solid rgba(255, 255, 255, 0.18);
}

button {
    border: none;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    background: #565758;
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease;
}

button:hover {
    transform: translateY(-1px);
    background: #6b6c70;
}

button:disabled {
    background: #2f3033;
    cursor: not-allowed;
}

.share-link {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.share-link input {
    background: #161618;
}

    .hint {
        margin: 0;
        color: #9ca3af;
        font-size: 0.95rem;
    }

    code {
        background: rgba(148, 163, 184, 0.15);
        padding: 2px 6px;
        border-radius: 6px;
        color: #f8fafc;
    }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.title-row {
    display: grid;
    gap: 8px;
}

.title-row h2 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#turn-banner {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f5;
    font-size: 0.95rem;
}

#game-status {
    margin: 0;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.game-board {
    margin-top: 12px;
}

.row {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.tile {
    aspect-ratio: 1;
    width: 100%;
    background: #111;
    border: 2px solid #333;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.5rem;
    text-transform: uppercase;
    border-radius: 6px;
    color: #fff;
}

.tile.correct {
    background: #538d4e;
    border-color: #538d4e;
}

.tile.present {
    background: #b59f3b;
    border-color: #b59f3b;
}

.tile.absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
}

.guess-preview {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 0;
}

.guess-preview .tile {
    background: #18181b;
    border-color: #333;
    opacity: 0.9;
}

.hidden-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.keyboard {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.key {
    min-width: 40px;
    padding: 16px 12px;
    border-radius: 8px;
    border: none;
    color: #fff;
    font-weight: 700;
    background: #3a3a3c;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease, transform 0.1s ease;
}

.key:hover {
    transform: translateY(-1px);
    background: #5c5d62;
}

.key.correct {
    background: #538d4e;
}

.key.present {
    background: #b59f3b;
}

.key.absent {
    background: #3a3a3c;
}

.status-footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.status-footer button {
    flex: 1;
}

.status-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.status-cards h3 {
    margin-bottom: 10px;
    color: #f5f5f5;
}

#players-list,
#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#players-list li,
#history-list li {
    padding: 10px 12px;
    border-radius: 10px;
    background: #18181b;
    margin-bottom: 10px;
    color: #e5e7eb;
}

#players-list li.active {
    background: #245524;
}

.room-info {
    text-align: right;
}

.room-info span {
    color: #9ca3af;
}

@media (max-width: 850px) {
    .status-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .app-shell {
        padding: 16px 12px 20px;
    }
    .row {
        gap: 6px;
    }
    .key {
        min-width: 34px;
        padding: 12px 10px;
    }
}

.game-board {
    margin-top: 24px;
}

.row {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.tile {
    aspect-ratio: 1;
    width: 100%;
    background: #121213;
    border: 2px solid #3a3a3c;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.3rem;
    text-transform: uppercase;
    border-radius: 6px;
    color: #ffffff;
}

.tile.correct {
    background: #538d4e;
    border-color: #538d4e;
    color: #ffffff;
}

.tile.present {
    background: #b59f3b;
    border-color: #b59f3b;
    color: #ffffff;
}

.tile.absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
    color: #ffffff;
}

.keyboard {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.key {
    min-width: 44px;
    padding: 14px 12px;
    border-radius: 8px;
    border: none;
    color: #fff;
    font-weight: 700;
    background: #3a3a3c;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease;
}

.key:hover {
    background: #5e5f63;
}

.key.correct {
    background: #538d4e;
}

.key.present {
    background: #b59f3b;
}

.key.absent {
    background: #3a3a3c;
}

.status-footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.status-footer button {
    flex: 1;
}

#game-status {
    font-size: 0.96rem;
    color: #cbd5e1;
}

.status-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.status-cards .card {
    padding: 18px;
}

#players-list,
#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#players-list li,
#history-list li {
    padding: 10px 12px;
    border-radius: 10px;
    background: #161618;
    margin-bottom: 10px;
    color: #e5e7eb;
}

#players-list li.active {
    background: #2f4f2d;
}

.room-info {
    text-align: right;
}

.room-info span {
    color: #9ca3af;
}

@media (max-width: 900px) {
    .status-cards {
        grid-template-columns: 1fr;
    }
    .row {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .app-shell {
        padding: 14px;
    }
    .row {
        gap: 6px;
    }
    .tile {
        font-size: 1rem;
    }
}
