:root {
    --bg: #0f1320;
    --bg-soft: rgba(18, 23, 35, 0.9);
    --card: rgba(255, 255, 255, 0.08);
    --card-strong: rgba(255, 255, 255, 0.12);
    --accent: #f1c761;
    --accent-strong: #f7d98b;
    --danger: #e05858;
    --text: #f6f6f6;
    --muted: rgba(255, 255, 255, 0.7);
    --outline: rgba(255, 255, 255, 0.18);
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    overscroll-behavior-y: auto;
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    max-width: 100%;
    font-family: 'Montserrat', sans-serif;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

body::before {
    content: "";
    position: fixed;
    inset: -20px;
    background-image: url('media/bg_tracht-2048x1366.jpg');
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.6);
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255, 215, 140, 0.15), transparent 55%),
                linear-gradient(160deg, rgba(15, 19, 32, 0.9), rgba(10, 14, 22, 0.95));
    z-index: -1;
}

.app {
    padding: 0.8rem 0.5rem 8rem;
    max-width: 1100px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));
}

.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--muted);
}

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

.status-pill {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    border: 1px solid var(--outline);
    background: rgba(0, 0, 0, 0.25);
}

.status-pill.online {
    background: rgba(76, 193, 140, 0.2);
    border-color: rgba(76, 193, 140, 0.5);
    color: #9af5c6;
}

.status-pill.offline {
    background: rgba(224, 88, 88, 0.18);
    border-color: rgba(224, 88, 88, 0.5);
    color: #ffb3b3;
}

.queue-pill {
    background: var(--danger);
    color: white;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.tab-bar {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
    padding: 0.2rem 0; /* padding damit buttons beim hover/active nicht abschneiden */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.tab-bar::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.tab-bar button {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--outline);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    touch-action: manipulation;
}

.tab-bar button.active {
    background: linear-gradient(120deg, rgba(241, 199, 97, 0.35), rgba(241, 199, 97, 0.15));
    border-color: rgba(241, 199, 97, 0.6);
    transform: translateY(-2px);
}

.content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    animation: riseIn 0.4s ease both;
}

.tile {
    position: relative;
    padding: 0.6rem;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--outline);
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.4rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    touch-action: pan-y;
}

.tile:hover {
    transform: translateY(-3px);
    background: var(--card-strong);
}

.tile-sprite {
    height: 48px;
    object-fit: contain;
    margin-bottom: 0.2rem;
    align-self: center;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.tile-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.tile-name {
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1.25;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    word-break: break-word;
    hyphens: auto;
}

.tile-price {
    color: var(--accent-strong);
    font-size: 1rem;
    font-weight: 800;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.tile-price {
    align-self: center;
}

.badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #4cc18c;
    color: #0f1320;
    border-radius: 999px;
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-minus {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--danger);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.15s ease;
    z-index: 2;
}

.badge-minus:active {
    transform: scale(0.9);
}

.summary {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--outline);
    padding: 0.75rem;
    max-height: none;
    overflow: visible;
}

.summary-header {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.summary-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.9rem;
}

.summary-name {
    font-weight: 600;
}

.summary-qty {
    color: var(--accent-strong);
    font-weight: 700;
}

.summary-actions button {
    background: var(--danger);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

.summary-actions button:active {
    transform: scale(0.9);
}

.bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    background: rgba(12, 16, 24, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 10;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
}

.total-value {
    font-size: 1.4rem;
    color: var(--accent-strong);
}

.actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    touch-action: pan-y;
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    background: linear-gradient(120deg, #f1c761, #f7d98b);
    color: #131313;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btn.ghost {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--outline);
}

.btn.chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--outline);
    color: var(--text);
    padding: 0.8rem 0.4rem;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.note-0-5 { background: #b08d57 !important; color: white !important; border: none; }
.note-1 { background: #ffd700 !important; color: #333 !important; border: none; }
.note-2 { background: #ffd700 !important; color: #333 !important; border: none; border: 2px solid silver; }
.note-5 { background: #667571 !important; color: white !important; border: none; }
.note-10 { background: #d33c44 !important; color: white !important; border: none; }
.note-20 { background: #3d80b8 !important; color: white !important; border: none; }
.note-50 { background: #d6872d !important; color: white !important; border: none; }
.note-100 { background: #4ba652 !important; color: white !important; border: none; }

.pay-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #4cc18c;
    color: #0f1320;
    border-radius: 999px;
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 800;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.pay-badge[hidden] {
    display: none !important;
}

.pay-minus {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--danger);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.pay-minus:active {
    transform: scale(0.9);
}

.pay-minus[hidden] {
    display: none !important;
}

.change-panel {
    display: grid;
    gap: 0.6rem;
}

.change-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.pay-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.optimal-change-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.optimal-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--outline);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.change-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.change-value.negative {
    color: var(--danger);
}

.announcement {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 15, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.announcement[hidden] {
    display: none !important;
}

.announcement-card {
    background: rgba(20, 26, 38, 0.95);
    border: 1px solid var(--outline);
    border-radius: 18px;
    padding: 1.4rem 1.35rem 1.2rem;
    width: min(92vw, 520px);
    max-height: min(78vh, 620px);
    overflow: auto;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal[hidden] {
    display: none !important;
}

.modal-card {
    background: var(--bg);
    border: 1px solid var(--outline);
    border-radius: 20px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}

.change-result {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--outline);
}

.change-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #4cc18c;
    letter-spacing: -0.02em;
}

.change-value.negative {
    color: var(--danger);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.announcement-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    align-self: flex-start;
    text-align: center;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    color: var(--muted);
}

.announcement-text {
    color: #ffffff;
    line-height: 1.75;
    font-size: 1.5rem;
    font-weight: 600;
    white-space: pre-wrap;
    text-align: center;
    margin: 0;
}

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

@media (min-width: 520px) {
    .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .content {
        grid-template-columns: 1.2fr 0.8fr;
        align-items: start;
    }

    .summary {
        max-height: none;
    }
}

@media (max-width: 519px) {
    .summary {
        overflow: visible;
    }
}

@media (min-width: 900px) {
    .app {
        padding: 2rem 2rem 11rem;
    }

    .logo {
        height: 70px;
    }
}
