:root {
    --bg-dark: #0f0f17;
    --card-bg: rgba(26, 26, 40, 0.4);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-primary: #8a6fff;
    --accent-hover: #9d85ff;
    --text-main: #f0f0f5;
    --text-muted: #9a9ab0;
    --tile-bg: #fdfbf7;
    --tile-text: #222230;
    --shadow-crisp: 0 12px 24px -6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    text-size-adjust: none;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/roboto-v30-latin-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/roboto-v30-latin-700.woff2') format('woff2');
}

body {
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.background-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    
    background: 
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
        url('background_1200.jpg') center center / cover no-repeat;
        
    background: 
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
        image-set(
            url('background_1200.avif') type('image/avif'),
            url('background_1200.webp') type('image/webp'),
            url('background_1200.jpg') type('image/jpeg')
        ) center center / cover no-repeat;

    filter: blur(8px);
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 10%, rgba(138, 111, 255, 0.15), transparent 60%);
    z-index: -2;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 800px;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    color: var(--accent-primary);
    font-size: 2.0rem;
}

.logo-text {
    font-size: 4.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, #b3a1ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.2rem;
}

.sub-tagline {
    font-size: 0.9rem;
    color: #ff80b3;
}

.card {
    background: rgba(26, 26, 40, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-crisp);
    margin-bottom: 2rem;
    transition: transform 0.2s ease;
}

.card-header {
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1.5rem;
}

.card-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.game-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.selector-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-btn {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-btn {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(138, 111, 255, 0.4);
}

.input-wrapper {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.letter-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.letter-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(138, 111, 255, 0.2);
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.hint-icon {
    color: var(--accent-primary);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(138, 111, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(138, 111, 255, 0.4);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.loader-drawer {
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    animation: slideDown 0.3s ease forwards;
}

.terminal-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dot {
    width: 10px; height: 10px; border-radius: 50%;
}
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.terminal-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-left: 0.5rem;
}

.loader-steps {
    list-style: none;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
}

.loader-steps li {
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    line-height: 1.2;
}

.loader-steps li:last-child {
    margin-bottom: 0rem;
}

.step-icon {
    font-size: 1rem;
    flex-shrink: 0;
/*    opacity: 0;
    transition: opacity 0.2s ease-in; */
}

.results-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: fadeIn 0.4s ease;
}

.results-header {
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.results-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.word-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    width: 100%;
}

.word-card:hover {
    transform: translateX(4px);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.tiles-wrapper {
    display: flex;
    gap: 0.16rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.2rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tiles-wrapper::-webkit-scrollbar {
    display: none;
}

.tile {
    background: var(--tile-bg);
    color: var(--tile-text);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 800;
    font-size: 1.2rem;
    width: 28px;
    height: 32px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 0 #ccc, 0 3px 6px rgba(0,0,0,0.4);
    text-transform: uppercase;
    flex-shrink: 0;
}

.tile sub {
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 0.55rem;
    font-weight: 700;
    color: #555;
    line-height: 1;
}

.word-score {
    background: rgba(138, 111, 255, 0.2);
    color: #dcd0ff;
    border: 1px solid rgba(138, 111, 255, 0.4);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 1rem;
}

.quick-tips {
    background: rgba(26, 26, 40, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.8rem 2.5rem;
    box-shadow: var(--shadow-crisp);
}

.tips-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #fff;
}

.tips-list {
    list-style: none;
    display: grid;
    gap: 0.8rem;
}

.tip-item {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tip-bullet {
    color: var(--accent-primary);
    font-size: 0.8rem;
}

.tip-code {
    background: rgba(138, 111, 255, 0.15);
    color: #dcd0ff;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

.footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer-subtext {
    margin-top: 0.3rem;
    color: #666680;
}

.hidden { display: none !important; }

.error-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 80, 80, 0.15);
    border: 1px solid rgba(255, 80, 80, 0.3);
    border-radius: 10px;
    color: #ff9999;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 400px; }
}

.lang-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.lang-btn.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(138, 111, 255, 0.4);
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }

    .loader-steps {
        padding: 0.5rem;
    }

    .quick-tips {
        padding: 1rem;
    }

    .tip-item {
        display: block;
        margin-bottom: 0.5rem;
    }

    .tip-bullet {
        display: inline-block;
        margin-right: 0.4rem;
    }

    .word-card {
        padding: 0.6rem 0.8rem; 
    }

    .tiles-wrapper {
        gap: 0.08rem;
    }

    .tile {
        width: 22px;
        height: 26px;
        font-size: 1rem; 
        box-shadow: 0 1px 0 #ccc, 0 2px 4px rgba(0,0,0,0.4);
    }

    .tile sub {
        font-size: 0.45rem;
        bottom: 0.5px;
        right: 1.5px;
    }

    .word-score {
        margin-left: 0.5rem;
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
}
