:root {
    --bg-color: #000000;
    --tile-bg: #1c1c1e;
    --tile-active: #6e44ff; /* Purple accent from screenshot */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent: #6e44ff;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent body scroll, grid will scroll */
}

/* Simulated Status Bar */
header {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 800;
    color: var(--text-secondary);
    z-index: 10;
}

/* Grid Layout */
#grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 110px; /* Approximately square-ish on mobile */
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
    padding-bottom: 100px; /* Space for control bar */
}

.tile {
    background-color: var(--tile-bg);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.tile:active {
    transform: scale(0.95);
    background-color: #2c2c2e;
}

.tile.playing {
    background-color: var(--tile-active);
    box-shadow: 0 0 15px rgba(110, 68, 255, 0.4);
}

.tile-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tile.add-tile {
    border: 2px dashed #333;
    background: transparent;
    color: #555;
}

.tile.dragging {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.9;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(1.05);
    background-color: var(--tile-active);
}

.tile.placeholder {
    background-color: rgba(255,255,255,0.05);
    border: 1px dashed #444;
}

/* Reorder Mode */
.reorder-mode .tile {
    animation: wiggle 0.3s infinite alternate;
}

.reorder-mode .tile.add-tile {
    display: none; /* Hide add button during reorder */
}

@keyframes wiggle {
    0% { transform: rotate(-1deg); }
    100% { transform: rotate(1deg); }
}

/* Controls */
.controls-container {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none; /* Let clicks pass through around the bar */
}

.control-bar {
    pointer-events: auto;
    background-color: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:active {
    background-color: rgba(255,255,255,0.1);
}

#btn-add-global {
    background-color: #333;
}

.pagination-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #555;
    border-radius: 50%;
}

.dot.active {
    background-color: #fff;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Bottom sheet style */
    padding-bottom: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #1c1c1e;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 20px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.menu-item {
    width: 100%;
    background: #333;
    border: none;
    color: white;
    padding: 15px;
    font-size: 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
}

.menu-item.secondary {
    background: transparent;
    color: #aaa;
    margin-bottom: 0;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #000;
    color: white;
}

.icon-options {
    display: flex;
    gap: 10px;
}

.icon-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

.icon-option.selected {
    background: var(--accent);
    color: white;
}

.primary-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 10px;
    cursor: pointer;
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #aaa;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
}
