
* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    background-image: url("assets/images/background.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;

    color: #fff;
    font-family: Arial, sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.site-header {
    text-align: center;
    padding: 28px 16px 12px;
}

.logo {
    display: block;
    width: min(260px, 65vw);
    height: auto;
    margin: 0 auto;
}

.subtitle {
    margin: 12px 0;
    color: #fff;
    text-shadow: 0 2px 5px #51445b;
}

main {
    width: min(1050px, 92%);
    margin: 20px auto 50px;
}

.panel,
.pet-card {
    background: rgba(49, 43, 69, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(28, 18, 42, 0.12);
}

.creator {
    max-width: 520px;
    margin: 0 auto 42px;
    padding: 28px;
    text-align: center;
}

h1,
h2,
p {
    overflow-wrap: anywhere;
}

.creator h1 {
    font-size: clamp(23px, 4vw, 30px);
    margin: 0 0 10px;
}

.creator > p {
    color: #f5efff;
}

.character-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0 12px;
}

.preview {
    width: 256px;
    height: 256px;
    max-width: 55vw;
    max-height: 55vw;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
}

.pet-sprite {
    width: 256px;
    height: 256px;
    flex-shrink: 0;

    background-image: url("assets/images/pets.png");
    background-repeat: no-repeat;
    background-position: 0 0;
    background-size: 3072px 256px;

    image-rendering: pixelated;
}

.preview .pet-sprite {
    transform-origin: top left;
}

/* Die Vorschau wird bei kleinen Bildschirmen verkleinert. */
@media (max-width: 420px) {
    .preview {
        width: 192px;
        height: 192px;
    }

    .preview .pet-sprite {
        transform: scale(0.75);
    }
}

.arrow {
    width: 52px;
    height: 58px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;

    background: #ffffff;
    color: #493451;

    font-size: 32px;
    font-weight: bold;

    box-shadow: 0 4px 12px rgba(40, 25, 55, 0.22);

    transition:
        background 0.2s,
        transform 0.2s,
        box-shadow 0.2s;
}

.arrow:hover {
    background: #ffd0e9;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(40, 25, 55, 0.3);
}

.arrow:active {
    transform: scale(0.95);
}

.arrow:focus-visible {
    outline: 3px solid #493451;
    outline-offset: 4px;
}

#character-count {
    opacity: 0.8;
    font-size: 14px;
}

#adopt-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    text-align: left;
}

#adopt-form label {
    font-weight: bold;
    font-size: 14px;
}

#adopt-form input {
    width: 100%;
    min-width: 0;
    padding: 13px 15px;

    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    outline: none;

    background: rgba(255, 255, 255, 0.88);
    color: #382c4c;
}

#adopt-form input:focus {
    border-color: #f8bce3;
    box-shadow: 0 0 0 3px rgba(248, 188, 227, 0.25);
}

.primary-button {
    padding: 13px 18px;
    border: none;
    border-radius: 12px;

    background: #f5b9dc;
    color: #492d49;
    font-weight: bold;

    transition: transform 0.2s, background 0.2s;
}

.primary-button:hover {
    background: #ffd0e9;
    transform: translateY(-2px);
}

.message {
    min-height: 20px;
    margin-bottom: 0;
    font-size: 14px;
}

.collection-section {
    padding: 0 4px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    text-shadow: 0 2px 5px rgba(40, 25, 55, 0.4);
}

.section-heading h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.section-heading p {
    margin: 0;
}

.pet-total {
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.pet-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 18px;
}

.pet-card {
    padding: 20px;
    min-width: 0;
    transition: transform 0.2s;
}

.pet-card:hover {
    transform: translateY(-3px);
}

.pet-card.selected {
    border: 2px solid #ffd0e9;
    background: rgba(85, 66, 105, 0.4);
}

.pet-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.mini-preview {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
}

.mini-sprite {
    width: 64px;
    height: 64px;

    background-image: url("assets/images/pets.png");
    background-repeat: no-repeat;
    background-size: 768px 64px;
    background-position: 0 0;

    image-rendering: pixelated;
    transform: scale(1.25);
    transform-origin: top left;
}

.pet-info {
    min-width: 0;
}

.pet-info h3 {
    margin: 0 0 6px;
    font-size: 20px;
    overflow-wrap: anywhere;
}

.pet-info p {
    margin: 0;
    opacity: 0.8;
    font-size: 13px;
}

.stat {
    margin: 14px 0;
}

.stat-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.stat-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
}

.stat-fill {
    height: 100%;
    border-radius: inherit;
    transition: width 0.3s;
}

.hunger-fill {
    background: #ffcc80;
}

.happiness-fill {
    background: #f5b9dc;
}

.energy-fill {
    background: #a9e5cf;
}

.pet-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 18px;
}

.pet-actions button {
    min-width: 0;
    padding: 10px 4px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.17);
    color: white;
    font-size: 12px;
    transition: background 0.2s;
}

.pet-actions button:hover {
    background: rgba(255, 255, 255, 0.32);
}

.pet-actions .select-pet {
    grid-column: 1 / -1;
    background: #f5b9dc;
    color: #492d49;
    font-weight: bold;
}

.pet-actions .select-pet:hover {
    background: #ffd0e9;
}

.pet-status {
    margin-top: 14px;
    min-height: 18px;
    font-size: 13px;
    opacity: 0.9;
}

.empty-message {
    text-align: center;
    padding: 28px 16px;
    border: 1px dashed rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
}

footer {
    text-align: center;
    padding: 10px 16px 30px;
    opacity: 0.8;
    font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}

/* Bessere Lesbarkeit auf hellen Hintergründen */
body {
    color: #352743;
    text-shadow: none;
}

/* Überschriften und Beschreibungstexte */
h1,
h2,
h3,
p,
label {
    color: #352743;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.45);
}

/* Untertitel unter dem Logo */
.subtitle {
    color: #352743;
    font-weight: 600;
}

/* Zähler und Tierbeschreibung */
#character-count,
.section-heading p,
.pet-info p {
    color: #51415f;
}

/* Pflege-Status */
.pet-status,
.message {
    color: #352743;
    font-weight: 600;
}

/* Haustierkarten und Creator etwas heller hinterlegen */
.panel,
.pet-card {
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Zähler-Badge */
.pet-total {
    color: #352743;
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Aktionsbuttons */
.pet-actions button:not(.select-pet) {
    background: rgba(75, 57, 91, 0.12);
    color: #352743;
}

.pet-actions button:not(.select-pet):hover {
    background: rgba(75, 57, 91, 0.22);
}

/* Ausgewählte Karte */
.pet-card.selected {
    background: rgba(255, 255, 255, 0.78);
    border-color: #c77ab0;
}

/* Leerer Zustand */
.empty-message {
    color: #352743;
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Fußzeile */
footer {
    color: #352743;
}