@import url('https://fonts.googleapis.com/css2?family=Zalando+Sans+Expanded&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
    --bg-color: #050505;
    --border-color: #F2C94C; /* Yellow */
    --accent-color: #F2C94C;
    --text-color: #E0E0E0;
    --dim-text: #666;
    --alert-color: #FF003C;
    --mint-color: #96F2D7;
    --grid-bg: rgba(242, 201, 76, 0.05);
    --match-bg: rgba(72, 199, 142, 0.15);
    --match-border: #48c78e;
    --mismatch-bg: rgba(255, 0, 60, 0.08);
    --mismatch-border: #FF003C;
    --direction-bg: rgba(242, 201, 76, 0.08);
    --direction-border: #F2C94C;
    --table-header-bg: rgba(255, 255, 255, 0.04);
    --row-bg: rgba(255, 255, 255, 0.02);
    --row-hover-bg: rgba(255, 255, 255, 0.06);
    --correct-glow: rgba(72, 199, 142, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Zalando Sans Expanded', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 30px;
    padding-bottom: 60px;
}

.container {
    width: 100%;
    max-width: 1300px;
    padding: 20px;
}

/* Main Interface Frame */
.interface-frame {
    border: 1px solid #333;
    padding: 2px;
    position: relative;
    background: rgba(10, 10, 10, 0.8);
}

.inner-frame {
    border: 1px solid var(--border-color);
    padding: 2rem;
    position: relative;
}

/* Decorative Corners */
.corner-tl, .corner-tr, .corner-bl, .corner-br {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--border-color);
    z-index: 2;
}
.corner-tl { top: -1px; left: -1px; }
.corner-tr { top: -1px; right: -1px; }
.corner-bl { bottom: -1px; left: -1px; }
.corner-br { bottom: -1px; right: -1px; }

/* Header Section */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.header-left h1 {
    font-size: 3rem;
    margin: 0;
    color: var(--text-color);
    font-weight: 400;
    letter-spacing: 2px;
}

.header-left .subtitle {
    font-size: 1rem;
    color: var(--mint-color);
    letter-spacing: 4px;
}

.header-right {
    text-align: right;
    font-size: 0.9rem;
    color: var(--dim-text);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* Mode Selector */


/* ─── Hint Box ─────────────────────────────────────────────────────────── */

.hint-box {
    border: 1px solid #333;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    position: relative;
}

.hint-title {
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.hint-box p {
    color: var(--dim-text);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.hint-box p strong {
    color: var(--text-color);
}

.hint-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--dim-text);
}

.legend-emoji {
    font-size: 1rem;
}


/* Input Area */
.input-section {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border: 1px solid #444;
    height: 60px;
    position: relative;
}

.input-label-attempts {
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--bg-color);
    padding: 0 10px;
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
}

input {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-family: 'Zalando Sans Expanded', sans-serif;
    font-size: 1.5rem;
    padding: 0 20px;
    width: 100%;
    outline: none;
    text-align: left;
}

input::placeholder {
    color: rgba(242, 201, 76, 0.3);
}

button {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0 40px;
    font-family: 'Zalando Sans Expanded', sans-serif;
    font-weight: 900;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

button:hover {
    background: #fff;
}


/* ─── Guesses Table ───────────────────────────────────────────────────── */

.guesses-wrapper {
    margin-top: 1rem;
}

.guesses-label {
    font-size: 0.9rem;
    color: var(--dim-text);
    margin-bottom: 12px;
    border-bottom: 1px solid #333;
    display: inline-block;
    padding-bottom: 5px;
    letter-spacing: 1px;
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid #222;
}

.guesses-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 900px;
}

.guesses-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.guesses-table th {
    background: var(--table-header-bg);
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--accent-color);
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.guesses-table th.col-name {
    text-align: left;
    min-width: 200px;
}

.guesses-table th.col-num {
    width: 45px;
}

.guesses-table th.col-proximity {
    width: 80px;
}

/* ─── Table Rows ─────────────────────────────────────────────────────── */

.guess-row {
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background-color 0.2s;
}

.guess-row:hover {
    background: var(--row-hover-bg);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.guess-row td {
    padding: 10px;
    text-align: center;
    vertical-align: middle;
}

/* Correct row glow */
.row-correct {
    background: var(--correct-glow) !important;
    border: 1px solid var(--match-border) !important;
}

.row-correct td {
    color: #fff;
}

/* Cell: Number */
.cell-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--dim-text);
    font-size: 0.8rem;
}

.guess-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #333;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
}

/* Cell: Name */
.cell-name {
    text-align: left !important;
    max-width: 280px;
}

.name-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hash-mode-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(242, 201, 76, 0.1);
    border: 1px solid rgba(242, 201, 76, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.hash-name-text {
    font-size: 0.82rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cell: Proximity */
.cell-proximity {
    font-size: 1.1rem;
    padding: 8px 4px !important;
}

.proximity-emoji {
    display: inline-block;
    transition: transform 0.2s;
    cursor: default;
}

.proximity-emoji:hover {
    transform: scale(1.3);
}

/* ─── Characteristic Cells ───────────────────────────────────────────── */

.cell-char {
    position: relative;
    transition: all 0.25s ease;
}

.char-value {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Match cell */
.cell-match {
    background: var(--match-bg);
}

.cell-match .char-value {
    color: var(--match-border);
}

/* Mismatch cell */
.cell-mismatch {
    background: var(--mismatch-bg);
}

.cell-mismatch .char-value {
    color: rgba(255, 0, 60, 0.7);
}

/* Direction cell - target is higher */
.cell-direction-up {
    background: var(--direction-bg);
}

.cell-direction-up .char-value {
    color: var(--accent-color);
}

/* Direction cell - target is lower */
.cell-direction-down {
    background: var(--direction-bg);
}

.cell-direction-down .char-value {
    color: var(--accent-color);
}


/* ─── Victory Banner ─────────────────────────────────────────────────── */

.victory-box {
    border: 1px solid var(--match-border);
    background: var(--match-bg);
    color: var(--match-border);
    padding: 20px;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.3rem;
    position: relative;
}


/* ─── Flash Messages ─────────────────────────────────────────────────── */

.alert-box {
    border: 1px solid var(--alert-color);
    color: var(--alert-color);
    padding: 10px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    background: rgba(255, 0, 60, 0.05);
    font-family: 'JetBrains Mono', monospace;
}


/* ─── Scrollbar ──────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #111;
}
::-webkit-scrollbar-thumb {
    background: var(--dim-text);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ─── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    body {
        padding-top: 10px;
        padding-bottom: 30px;
    }

    .container {
        padding: 10px;
    }

    .inner-frame {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-left h1 {
        font-size: 2rem;
    }

    .header-right {
        align-items: flex-start;
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
    }

    .input-section {
        height: 50px;
    }

    input {
        font-size: 1.2rem;
        padding: 0 12px;
    }

    button {
        padding: 0 20px;
    }

    .guesses-table {
        font-size: 0.75rem;
    }

    .guesses-table th {
        font-size: 0.65rem;
        padding: 8px 6px;
        letter-spacing: 0.5px;
    }

    .guess-row td {
        padding: 8px 5px;
    }

    .cell-proximity {
        font-size: 1.2rem;
    }

    .char-value {
        font-size: 0.68rem;
    }

    .hash-name-text {
        font-size: 0.72rem;
        max-width: 120px;
    }

    .hash-mode-badge {
        font-size: 0.6rem;
    }

    .hint-legend {
        gap: 8px 14px;
    }

    .legend-item {
        font-size: 0.72rem;
    }

    .victory-box {
        font-size: 1rem;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .header-left h1 {
        font-size: 1.6rem;
    }


    .hint-box {
        padding: 1rem;
    }

    .hint-title {
        font-size: 0.95rem;
    }

    .hint-box p {
        font-size: 0.8rem;
    }
}
