/* ---- Tokens ---- */
:root {
    --bg: #0b0b0d;
    --panel: #17181b;
    --panel-border: #2a2b2f;
    --accent: #ff8c1a;
    --accent-dim: #7a4712;
    --text: #f2f2f0;
    --text-muted: #8d8d93;
    --error: #ff5c5c;

    --font-display: "Silkscreen", monospace;
    --font-body: "Inter", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Dezentes Karo-Muster im Hintergrund, Anspielung auf das Crafting-Grid -
   bewusst subtil, damit es nicht vom Inhalt ablenkt. */
.grid-backdrop {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
    pointer-events: none;
}

.page {
    position: relative;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: page-in 0.5s ease-out;
}

@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Wordmark ---- */
.wordmark {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.wordmark-block {
    width: 22px;
    height: 22px;
    background: var(--accent);
    box-shadow:
        inset -4px -4px 0 rgba(0, 0, 0, 0.25),
        inset 4px 4px 0 rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.wordmark h1 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    margin: 0;
    line-height: 1.4;
}

.tagline {
    color: var(--text-muted);
    margin: 0 0 2rem;
    font-size: 0.95rem;
}

/* ---- Suchformular ---- */
.search-form {
    display: flex;
    gap: 0.6rem;
    width: 100%;
}

#username {
    flex: 1;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease;
}

#username:focus-visible {
    border-color: var(--accent);
}

#username::placeholder {
    color: var(--text-muted);
}

.search-form button {
    padding: 0.85rem 1.4rem;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #16110a;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease;
}

.search-form button:hover {
    background: #ffa233;
}

.search-form button:active {
    transform: scale(0.96);
}

.search-form button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Ergebnis-Karte ---- */
.result-card {
    margin-top: 1.75rem;
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-card[hidden] {
    display: none;
}

.result-card.is-loading .player-block,
.result-card.is-error .player-block {
    display: none;
}

/* Der eine bewusste Bewegungs-Moment: Kopf poppt mit leichtem Überschwung rein */
.player-avatar {
    width: 72px;
    height: 72px;
    image-rendering: pixelated;
    border-radius: 6px;
    border: 2px solid var(--panel-border);
    animation: avatar-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes avatar-in {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.player-name {
    margin: 0.9rem 0 1.1rem;
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.balance-list {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.balance-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.8rem 1.1rem;
    min-width: 88px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.balance-amount {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.balance-currency {
    color: var(--text-muted);
    text-transform: capitalize;
    font-size: 0.8rem;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ---- Loading-Zustand: kleine pulsierende Blöcke statt generischem Spinner ---- */
.loading-blocks {
    display: flex;
    gap: 6px;
}

.loading-blocks span {
    width: 10px;
    height: 10px;
    background: var(--accent);
    animation: block-pulse 0.9s ease-in-out infinite;
}

.loading-blocks span:nth-child(2) {
    animation-delay: 0.15s;
}

.loading-blocks span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes block-pulse {
    0%, 100% {
        opacity: 0.25;
        transform: scale(0.85);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Fehler-Zustand ---- */
.error-state {
    color: var(--error);
    margin: 0;
    font-size: 0.95rem;
}

.result-card.is-error {
    animation: shake 0.4s ease;
    border-color: rgba(255, 92, 92, 0.4);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

/* ---- Reduced motion respektieren ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

@media (max-width: 480px) {
    .search-form {
        flex-direction: column;
    }
}
