/* Базові налаштування */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: #fdfbf7; color: #3e2723; }

/* Управління екранами */
.screen { display: none; }
.screen.active { display: block; }

/* Управління розділами (вкладками) в додатку */
.app-section { display: none; animation: fadeIn 0.3s ease; }
.app-section.active { display: block; }

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

/* --- Екран Авторизації --- */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}
.auth-container h1 { color: #2e4a2b; margin-bottom: 5px; font-size: 24px; }
.auth-container p { color: #7f8c8d; margin-bottom: 20px; font-size: 14px; }

.input-group { text-align: left; margin-bottom: 15px; }
.input-group label { display: block; font-size: 13px; margin-bottom: 5px; font-weight: bold; }
.input-group select, .input-group input {
    width: 100%; padding: 12px;
    border: 1px solid #ccc; border-radius: 6px;
    font-size: 16px; /* Важливо для мобільних, щоб не було зуму */
}

.btn-primary {
    width: 100%; padding: 14px;
    background-color: #d35400; color: white;
    border: none; border-radius: 6px;
    font-size: 16px; font-weight: bold; cursor: pointer;
}
.switch-auth { margin-top: 15px; font-size: 13px; }
.switch-auth a { color: #d35400; text-decoration: none; font-weight: bold; }

/* --- Головний застосунок (Адаптація під мобільні) --- */
.app-header {
    background-color: #2e4a2b; color: white;
    padding: 15px 20px; display: flex;
    justify-content: space-between; align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 10;
}
.header-title { font-size: 20px; margin: 0; }

.hamburger {
    background: none; border: none; color: white;
    font-size: 28px; cursor: pointer; padding: 0;
}

.content { padding: 20px; max-width: 800px; margin: 0 auto; transition: transform 0.2s ease-out; }

/* --- Pull-to-refresh (Свайп для оновлення) --- */
.ptr-indicator {
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    height: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: height 0.2s ease;
}
.ptr-icon {
    font-size: 18px;
    transition: transform 0.2s ease;
}
.ptr-icon.rotate {
    transform: rotate(180deg);
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.profile-header h2 {
    margin: 0;
    font-size: 24px;
    color: #2e4a2b;
}
.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #d35400;
    background-color: #eee;
}

.card { background: white; padding: 20px; border-radius: 12px; margin-top: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* --- Бокове Садвіч-меню --- */
.side-menu {
    position: fixed; top: 0; right: -250px;
    width: 250px; height: 100%;
    background-color: white; box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease; z-index: 100;
    display: flex; flex-direction: column;
}
.side-menu.open { right: 0; }

.menu-header {
    background-color: #f4f1ea; padding: 20px;
    font-size: 18px; font-weight: bold; border-bottom: 1px solid #eee;
}

.side-menu .nav-item {
    padding: 15px 20px; text-decoration: none; color: #3e2723;
    font-size: 16px; border-bottom: 1px solid #eee;
}
.side-menu .nav-item.active { font-weight: bold; color: #d35400; border-left: 4px solid #d35400; }
.side-menu .nav-item.logout { margin-top: auto; color: #c0392b; font-weight: bold; }

/* Затінення фону */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 50;
    display: none; opacity: 0; transition: opacity 0.3s ease;
}
.overlay.active { display: block; opacity: 1; }

/* Поле введення ключа у профілі */
.key-input-container {
    display: flex;
    margin-top: 10px;
    gap: 10px;
    align-items: center;
}

.key-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0dcd3;
    border-radius: 8px;
    font-size: 15px;
    background-color: #faf9f6;
    color: #3e2723;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.key-input-container input:focus {
    border-color: #d35400;
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.15);
}

.btn-submit-key {
    width: 48px;
    height: 48px;
    background-color: #2e4a2b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.btn-submit-key:hover {
    background-color: #1e331c;
}

.btn-submit-key:active {
    transform: scale(0.95);
}

#section-poneglyph {
    perspective: 1000px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#section-poneglyph.active {
    display: flex;
}

#section-poneglyph h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: #ff3b3b;
    text-shadow: 0 0 10px rgba(255, 59, 59, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

#section-poneglyph p.subtitle {
    font-size: 0.95rem;
    color: #8a7a7a;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.4;
}

#section-poneglyph .scene {
    width: 200px;
    height: 200px;
    margin: 70px auto;
    cursor: grab;
}

#section-poneglyph .scene:active {
    cursor: grabbing;
}

#section-poneglyph .cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: spin 15s infinite linear;
    transition: transform 0.1s ease-out;
}

/* Анімація автоматичного крутіння */
@keyframes spin {
    from { transform: rotateX(-20deg) rotateY(0deg); }
    to { transform: rotateX(-20deg) rotateY(360deg); }
}

/* Спільний стиль для всіх 6 граней */
#section-poneglyph .cube__face {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px solid #4a0000;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: radial-gradient(circle, #800c0c 0%, #400404 100%);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><text x='10' y='30' fill='rgba(0,0,0,0.6)' font-family='monospace' font-size='16' font-weight='bold'>▰▱▩</text><text x='50' y='30' fill='rgba(0,0,0,0.6)' font-family='monospace' font-size='14'>▞▚</text><text x='15' y='60' fill='rgba(0,0,0,0.6)' font-family='monospace' font-size='15'>▘▝▞</text><text x='55' y='60' fill='rgba(0,0,0,0.6)' font-family='monospace' font-size='17'>▩▰</text><text x='20' y='90' fill='rgba(0,0,0,0.6)' font-family='monospace' font-size='13'>▚▞▱</text></svg>");
    background-size: 70px 70px;
}

#section-poneglyph .cube__face--front  { transform: rotateY(  0deg) translateZ(100px); }
#section-poneglyph .cube__face--right  { transform: rotateY( 90deg) translateZ(100px); }
#section-poneglyph .cube__face--back   { transform: rotateY(180deg) translateZ(100px); }
#section-poneglyph .cube__face--left   { transform: rotateY(-90deg) translateZ(100px); }
#section-poneglyph .cube__face--top    { transform: rotateX( 90deg) translateZ(100px); }
#section-poneglyph .cube__face--bottom { transform: rotateX(-90deg) translateZ(100px); }

#section-poneglyph .inner-border {
    width: 100%;
    height: 100%;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

#section-poneglyph .ui-panel {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

#section-poneglyph .btn-decode {
    background: linear-gradient(135deg, #a81313 0%, #610505 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(168, 19, 19, 0.4);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s, box-shadow 0.3s ease;
}

#section-poneglyph .btn-decode:hover {
    box-shadow: 0 6px 20px rgba(168, 19, 19, 0.6);
}

#section-poneglyph .btn-decode:active {
    transform: scale(0.95);
}


