/* Inheriting previous variables */
:root {
    --bg-gradient: linear-gradient(135deg, #1c1c3c 0%, #2f2f5f 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --accent-color: #6c5ce7;
    --accent-hover: #5649c0;
    --danger-color: #ff7675;
    --success-color: #55efc4;
    --warning-color: #ffeaa7;
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Prevent body scroll, use container scroll */
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(108, 92, 231, 0.15) 0%, transparent 50%);
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.app-container {
    width: 100%;
    max-width: 900px;
    height: 95vh;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    position: relative;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Header */
#global-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
}

/* Dashboard Grid */
.main-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.5rem;
    padding-bottom: 2rem;
}

.app-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.app-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.option-icon {
    font-size: 2rem;
    color: var(--accent-color);
    transition: color 0.3s;
}

.app-card:hover .option-icon {
    color: #fff;
}

.app-card h3 {
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

/* Utility & Inputs */
.hidden {
    display: none !important;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    color: white;
}

.btn.primary {
    background: var(--accent-color);
}

.btn.primary:hover {
    background: var(--accent-hover);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
}

.btn.text-danger {
    background: transparent;
    color: var(--danger-color);
    padding: 5px;
}

input,
select,
textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-family: inherit;
    width: 100%;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 10px;
}

/* APP SPECIFIC STYLES */

/* Budget */
.budget-input {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.budget-input select {
    flex: 1;
}

.budget-input input {
    flex: 2;
}

.item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.amount.income {
    color: var(--success-color);
}

.amount.expense {
    color: var(--danger-color);
}

/* Text Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 1rem;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

/* Converter */
.converter-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.result-text {
    font-size: 1.5rem;
    text-align: center;
    margin-top: 1rem;
    color: var(--accent-color);
    font-weight: bold;
}

/* Password Gen */
.checkbox-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.result-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    word-break: break-all;
    text-align: center;
    font-family: monospace;
    margin-top: 1rem;
    cursor: pointer;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-box:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Dice */
.dice-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.die {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 10px;
    color: #333;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: roll 0.5s ease-out;
}

@keyframes roll {
    0% {
        transform: rotate(0deg) scale(0.5);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Clock */
.clock-display {
    text-align: center;
    margin: 2rem 0;
}

#clk-time {
    font-size: 4rem;
    font-weight: 800;
}

#clk-date {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* RPS */
.rps-scores {
    display: flex;
    justify-content: space-around;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.rps-arena {
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 4rem;
    margin-bottom: 2rem;
    height: 100px;
}

.rps-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.rps-btn {
    font-size: 2rem;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: 0.2s;
}

.rps-btn:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

/* Hangman Partial */
.draw-base {
    stroke: var(--text-secondary);
    stroke-width: 4;
    stroke-linecap: round;
}

.draw-part {
    stroke: var(--text-primary);
    stroke-width: 4;
    fill: none;
    stroke-linecap: round;
    opacity: 0;
    transition: opacity 0.3s;
}

.draw-part.visible {
    opacity: 1;
}

.word-display {
    font-size: 2rem;
    display: flex;
    gap: 5px;
    justify-content: center;
    min-height: 50px;
    margin: 20px 0;
}

@media (max-width: 600px) {
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .budget-input {
        flex-direction: column;
    }

    #clk-time {
        font-size: 3rem;
    }
}