/* styles.css */
:root {
    --bg-color: #f0ede4;
    --red: #d9432f;
    --green: #2a8370;
    --tile-size: 75px;
    --target-tile: 38px;
    --gap: 3px;
}

@media (max-width: 400px) {
    :root {
        --tile-size: 19vw;
        --target-tile: 11vw;
    }
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    overflow: hidden;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-family: 'Roboto Condensed', sans-serif;
}

#app-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding-top: 10px;
}

#game-status {
    height: 24px;
    min-height: 1.2em;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--green);
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, -2px); }
    50% { transform: translate(2px, 2px); }
    75% { transform: translate(-2px, 2px); }
}

.shaking {
    animation: shake 0.12s infinite;
}

@keyframes glimmer {
    0% { transform: translateX(-150%) skewX(-25deg); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateX(150%) skewX(-25deg); opacity: 0; }
}

.won-tile {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    filter: brightness(1.1);
    pointer-events: none;
    z-index: 10;
}

.animate-glimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: glimmer 0.8s ease-out 1 forwards;
}

#game-board {
    position: relative;
    width: calc((var(--tile-size) * 4) + (var(--gap) * 3));
    height: calc((var(--tile-size) * 4) + (var(--gap) * 3));
    margin-bottom: 70px;
    touch-action: manipulation;
}

.tile {
    position: absolute;
    width: var(--tile-size);
    height: var(--tile-size);
    overflow: hidden;
    border-radius: 4px;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), left 0.2s, top 0.2s;
}

.tile-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--tile-size) * 0.7);
    font-weight: 700;
    color: white;
    filter: url(#grainy);
    background-size: 400% 400%;
}

#controls-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    width: 100%;
}

.control-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
    color: var(--green);
    border: none;
    background: transparent;
}

.icon-button {
    border: 2.5px solid var(--green);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    overflow: hidden;
    padding: 2px;
    background: white;
}

.icon-button img {
    width: 100%;
    height: auto;
}

#target-board {
    display: grid;
    grid-template-columns: repeat(4, var(--target-tile));
    gap: 2px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.target-tile {
    width: var(--target-tile);
    height: var(--target-tile);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--target-tile) * 0.55);
    color: white;
    font-weight: 700;
    border-radius: 1px;
    background-size: 400% 400%;
}

.overlay {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 4000;
    background: var(--bg-color);
    padding: 0;
    overflow-y: auto;
    touch-action: manipulation;
}

.overlay-heading {
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    margin: 28px 0 0 0;
}

#gallery-header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 10px 0;
    margin-bottom: 15px;
}

#gallery-viewport {
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    touch-action: pan-x;
}

#gallery-container {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.gallery-page {
    min-width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 10px;
    padding: 0 15px;
}

.menu-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.menu-item.completed-item {
    opacity: 0.35;
    filter: grayscale(0.8);
}

.thumb-preview {
    display: grid;
    grid-template-columns: repeat(4, 28px);
    gap: 1.5px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    border: 2px solid transparent;
}

.menu-item.active .thumb-preview {
    border-color: var(--red);
    background: white;
}

.preview-dot {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    border-radius: 2px;
    background-size: 400% 400%;
}

#gallery-nav {
    margin-top: auto;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.dot-row {
    display: flex;
    gap: 12px;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
}

.nav-dot.active {
    background: var(--green);
    transform: scale(1.2);
}

.info-title {
    color: #8ab4f8;
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    font-weight: 500;
}

.version-badge {
    background: rgba(0, 0, 0, 0.06);
    color: #777;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 0.65rem;
    margin-top: 10px;
    margin-bottom: 25px;
    display: inline-block;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.info-text {
    max-width: 320px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.red-box,
.blue-box {
    width: 100%;
    max-width: 320px;
    margin: 20px 0;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.red-box {
    background: #fff5f5;
    border: 1.5px solid #ffeded;
}

.blue-box {
    background: #f0f7ff;
    border: 1.5px solid #e0eeff;
}

.box-title {
    margin: 0 0 10px 0;
}

.qr-placeholder {
    width: 130px;
    height: 130px;
    background: #fff;
    border: 1px solid #eee;
    margin: 15px auto;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-inner {
    width: 100%;
    height: 100%;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.6rem;
}

.coffee-btn,
.tipsa-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    color: white;
    border: none;
    cursor: pointer;
}

.coffee-btn {
    background: #ffb3ba;
    box-shadow: 0 3px 0 #ff8a95;
}

.tipsa-btn {
    background: #b3d1ff;
    box-shadow: 0 3px 0 #8ab4f8;
}

.coffee-btn:active,
.tipsa-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #ff8a95;
}

.info-footer {
    max-width: 320px;
    margin-top: 40px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #888;
    text-align: left;
}

.footer-heading {
    color: #555;
}

.nav-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 38px;
    height: 38px;
    border: 2.5px solid var(--green);
    border-radius: 50%;
    background: transparent;
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-family: serif;
    font-style: italic;
    font-weight: bold;
    font-size: 22px;
    line-height: 1;
}

.nav-top-right-image {
    background: white;
    overflow: hidden;
    padding: 2px;
}

.nav-top-right-image img {
    width: 85%;
    height: auto;
}

svg.defs-only {
    width: 0;
    height: 0;
    position: absolute;
}