.th-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    width: 100%;
}

/* ── Screen switching ────────────────────────────────────────────────────── */
.th-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.4rem;
    width: 100%;
    max-width: 680px;
    text-align: center;
}

.th-screen--active {
    display: flex;
}

/* ── Start screen ────────────────────────────────────────────────────────── */
.th-screen-title {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 2.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--game-accent);
}

.th-screen-sub {
    color: var(--game-muted);
    margin: 0;
}

.th-config {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    border: 1px solid var(--game-border);
    padding: 1.2rem 1.6rem;
    background: rgba(0, 255, 255, 0.03);
    width: min(360px, 90vw);
}

.th-config-section-label {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    color: var(--game-accent);
    opacity: 0.55;
    text-transform: uppercase;
    margin-top: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--game-border);
}

.th-config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: var(--game-muted);
    font-size: 0.88rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.th-config-row input[type="number"],
.th-config-row select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--game-border-strong);
    color: var(--game-accent);
    font: inherit;
    font-size: 1.1rem;
    text-align: center;
    width: 70px;
    padding: 0.3rem 0.5rem;
    outline: none;
}

.th-config-row select option {
    background: #0d1117;
}

.th-config-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--game-accent);
    cursor: pointer;
    flex-shrink: 0;
}

.th-start-btn {
    min-width: 160px;
}

/* ── Loading screen ──────────────────────────────────────────────────────── */
.th-hack-icon {
    width: 64px;
    height: 64px;
    color: var(--game-accent);
    opacity: 0.75;
    animation: th-pulse 1.1s ease-in-out infinite;
}

@keyframes th-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.08); }
}

.th-loading-text {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0.14em;
    color: var(--game-muted);
    animation: th-blink 0.9s step-start infinite;
}

@keyframes th-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Game screen ─────────────────────────────────────────────────────────── */
.th-game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--game-muted);
}

.th-game-header strong {
    color: var(--game-accent);
}

.th-timer-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 255, 255, 0.1);
    overflow: hidden;
}

.th-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--game-success), var(--game-warning), var(--game-danger));
    transition: width linear;
}

/* ── Grid of squares ─────────────────────────────────────────────────────── */
.th-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.th-square {
    width: 120px;
    height: 120px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
    transition: all 0.35s ease;
}

.th-square svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Number-phase styling */
.th-square.num-phase {
    background: rgba(0, 255, 255, 0.07);
    border: 1px solid var(--game-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 3.4rem;
    color: var(--game-accent);
}

.th-square.shrinking {
    transform: scale(0.5);
    opacity: 0;
}

/* ── Answer area ─────────────────────────────────────────────────────────── */
.th-answer-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
}

.th-question {
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--game-text);
    min-height: 1.4em;
}

.th-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--game-border-strong);
    color: var(--game-accent);
    font: inherit;
    font-size: 1.3rem;
    text-align: center;
    width: min(360px, 90%);
    padding: 0.4rem;
    outline: none;
    transition: 160ms ease;
    text-transform: uppercase;
}

.th-input:focus {
    border-color: var(--game-accent);
    box-shadow: 0 4px 18px rgba(0, 255, 255, 0.12);
}

.th-input:disabled {
    opacity: 0.35;
}

/* ── End screen ──────────────────────────────────────────────────────────── */
.th-end-icon svg {
    width: 72px;
    height: 72px;
}

.th-end-title {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 2rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.th-end-title.success { color: var(--game-success); }
.th-end-title.fail    { color: var(--game-danger);  }

.th-end-sub {
    color: var(--game-muted);
    line-height: 1.7;
    max-width: 400px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .th-square {
        width: 90px;
        height: 90px;
    }

    .th-square.num-phase {
        font-size: 2.6rem;
    }
}
