@font-face {
  font-family: 'Segoe UI';
  src: URL('../fonts/Segoe UI.ttf') format('truetype');
}

body {
    margin: 0;
    padding: 0;
    background-image: url('../images/wpback.png');
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    color: white;
    perspective: 2000px; 
}

.start-screen {
    padding: 60px 10%;
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
}

.start-title, .tile-wrapper {
    opacity: 0;
    animation: flyIn 1s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

.start-title {
    font-weight: 300;
    font-size: 56px;
    margin-bottom: 50px;
    margin-top: 0;
    animation-delay: 0.1s;
    user-select: none;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 160px);
    grid-auto-rows: 160px;
    gap: 12px;
}

@keyframes flyIn {
    0% {
        opacity: 0;
        transform: translateZ(-500px) translateX(200px) rotateY(-10deg);
    }
    100% {
        opacity: 1;
        transform: translateZ(0) translateX(0) rotateY(0);
    }
}

.tile-wrapper {
    perspective: 1000px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.tile-wrapper:active {
    transform: scale(0.97);
}

.tile-wrapper.wide {
    grid-column: span 2;
}

.tile-wrapper.large {
    grid-column: span 2;
    grid-row: span 2;
}

.tile {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 rgba(0,0,0,0);
    scale: 0.5;
    animation: slideTileIn 0.8s ease-out forwards;
}

@keyframes slideTileIn {
    to {
        scale: 1;
    }
}

.tile-front, .tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden; 
}

.tile-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: block; 
    padding: 0; 
    overflow: hidden;
}

.tile-front:not(:has(.live-tile-content)) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 15px;
}

.tile-front .icon {
    font-size: 48px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    user-select: none;
}

.tile-front .label {
    font-size: 16px;
    font-weight: 400;
    user-select: none;
}

.blue { background-color: #00a4ef; }
.green { background-color: #7fba00; }
.orange { background-color: #ffb900; }
.purple { background-color: #7e3878; }
.gray { background-color: gray; }

.tile-wrapper.fullscreen {
    position: fixed !important;
    z-index: 9999;
    margin: 0;
    transition: all 0.7s cubic-bezier(0.1, 0.9, 0.2, 1);
    border-radius: 0;
}

.tile-wrapper.fullscreen .tile {
    transform: rotateY(180deg);
}

.start-screen.searching {
    transition: opacity 0.5s ease;
    opacity: 0;
}

.tile-wrapper.expanding {
    position: fixed !important;
    margin: 0 !important;
    z-index: 10000;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.tile-wrapper.expanding .tile {
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-title {
    font-weight: 300;
    font-size: 56px;
    margin-bottom: 50px;
    margin-top: 0;
    flex-shrink: 0;
    user-select: none;
}

.app-content {
    width: 70vw;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    transition-delay: 0.3s;
}

.expanding .app-content {
    opacity: 1;
}

.tile-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    background-color: #1d1d1d;
    color: white;
    font-size: 24px;
    
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: flex-start; 
    padding: 60px 10%;
    box-sizing: border-box;
}

.start-screen.fade-out .tile-wrapper:not(.expanding),
.start-screen.fade-out .start-title {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s ease;
}

.live-tile-content {
    width: 100%;
    height: 200%;
    display: flex;
    flex-direction: column;
    animation: liveTileAnim 8s cubic-bezier(0.85, 0, 0.15, 1) infinite;
}

.slide {
    width: 100%;
    height: 50%;
    box-sizing: border-box;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}

.slide .icon {
    font-size: 48px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
}

.slide .icon { font-size: 40px; position: absolute; top: 30%; left: 50%; transform: translateX(-50%); }
.slide .temp { font-size: 32px; font-weight: 300; position: absolute; top: 30%; left: 15%; }

@keyframes liveTileAnim {
    0%, 45% { transform: translateY(0); }
    50%, 95% { transform: translateY(-50%); }
    100% { transform: translateY(0); }
}

@media (max-width: 600px) {
    body {
        overflow-y: auto;
        background-attachment: fixed;
    }

    .start-screen {
        padding: 40px 20px; 
        height: auto;
        min-height: 100vh;
        box-sizing: border-box;
    }

    .start-title {
        display: none;
    }

    .tiles-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: calc((100vw - 40px - 10px) / 2);
        gap: 10px;
        width: 100%;
        margin: 0 auto;
    }

    .tile-wrapper.wide, 
    .tile-wrapper.large {
        grid-column: span 2;
    }

    .tile-wrapper.expanding {
        width: 100vw !important;
        height: 100vh !important;
    }

    .tile-front .label {
        font-size: 14px;
    }

    .app-content {
        width: 85vw;
    }
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    pointer-events: auto;
}

.back-button span {
    color: white;
    font-size: 24px;
    font-weight: 300;
    transition: transform 0.2s ease;
    user-select: none;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

.back-button:active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

@media (max-width: 600px) {
    .back-button {
        top: 15px;
        left: 15px;
        width: 38px;
        height: 38px;
    }
    .back-button span {
        font-size: 20px;
    }
}
