/* ===== Shared ===== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0d1117;
    color: #e6edf3;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 0 0.5rem 0.5rem;
    user-select: none;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem;
}

.circular-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #161b22;
    border: 3px solid var(--btn-color, #21262d);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    color: #8b949e;
    transition: box-shadow 0.2s ease, transform 0.1s ease, background 0.2s ease;
    box-shadow:
        0 6px 0 var(--btn-depth, #0d1117),
        0 8px 16px rgba(0,0,0,0.4),
        inset 0 -4px 8px rgba(0,0,0,0.3),
        inset 0 4px 8px rgba(255,255,255,0.05);
    transform: translateY(-2px);
    position: relative;
}
.circular-btn::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.35) 80%);
    pointer-events: none;
    z-index: 0;
}
.circular-btn svg {
    width: 42px;
    height: 42px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
    position: relative;
    z-index: 1;
}
.circular-btn:active {
    transform: translateY(4px) scale(0.96);
    box-shadow:
        0 2px 0 var(--btn-depth, #0d1117),
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 -2px 4px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.03);
}
.circular-btn:hover {
    background: rgba(255,255,255,0.04);
    box-shadow:
        0 6px 0 var(--btn-depth, #0d1117),
        0 10px 24px rgba(0,0,0,0.5),
        inset 0 -4px 8px rgba(0,0,0,0.3),
        inset 0 4px 8px rgba(255,255,255,0.08);
    transform: translateY(-3px);
}

.sound-icon {
    transition: transform 0.15s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    max-width: 150px;
    margin: 0 auto;
}
.sound-icon .label {
    font-size: 18px;
    color: #8b949e;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    width: 100%;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
    text-decoration-color: #30363d;
    padding: 0 2px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.sound-icon .label:visited {
    color: #8b949e;
    text-decoration-color: #30363d;
}
.sound-icon .label:hover,
.sound-icon .label:visited:hover {
    color: #e6edf3;
    text-decoration-color: #e6edf3;
}

.sound-icon .icon-circle:active {
    transform: translateY(4px) scale(0.96) !important;
    box-shadow:
        0 2px 0 #0d1117,
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 -2px 4px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.03) !important;
}

.sound-grid-icons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
    padding: 0.15rem 0;
    margin-top: 1.5rem; /* Added spacing above sound grid */
}

::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: #0d1117;
}
::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

header {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
    align-items: center;
    column-gap: 0.5rem;
    height: 4rem;
    min-height: 4rem;
    padding: 0.65rem 1rem;
    margin: 0 -0.5rem 0.5rem;
    border-bottom: 1px solid #21262d;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 50;
    background: #0d1117;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}
header.scrolled {
    border-bottom-color: transparent;
}
.header-back {
    color: #58a6ff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    justify-self: start;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}
.header-back svg {
    width: 22px;
    height: 22px;
}
.header-back:hover {
    opacity: 0.8;
}
.header-menu {
    color: #8b949e;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
    -webkit-tap-highlight-color: transparent;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    line-height: 1;
}
.header-menu:hover {
    opacity: 1;
}

.sound-icon .label::selection,
.sound-icon .icon-circle::selection,
.main-icon .icon-bg::selection,
h1::selection,
.stars::selection,
#mainInfo::selection,
.download-btn::selection {
    background: transparent;
}

/* ===== Index page ===== */
body.page-index .sound-grid-icons {
    gap: 1.4rem 0.3rem;
    margin-top: 1.5rem; /* Added spacing above sound grid on index page */
}

.search-container {
    justify-self: center;
    width: 100%;
    max-width: 10.5rem;
    min-width: 0;
}
.search-container input {
    width: 100%;
    display: block;
    margin: 0;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 30px;
    color: #e6edf3;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
    box-shadow:
        0 4px 0 #0d1117,
        0 6px 16px rgba(0,0,0,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}
.search-container input:focus {
    border-color: #58a6ff;
    box-shadow:
        0 4px 0 #0d1117,
        0 6px 20px rgba(88, 166, 255, 0.08),
        inset 0 -2px 4px rgba(0,0,0,0.2);
}
.search-container input::placeholder {
    color: #8b949e;
    opacity: 0.7;
}
.search-container .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #8b949e;
    opacity: 0.5;
    pointer-events: none;
}
.search-container .search-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.search-wrapper {
    position: relative;
    width: 100%;
}

/* ===== Download page ===== */
body.page-download .circular-btn svg {
    width: 40px;
    height: 40px;
}
body.page-download .sound-icon {
    max-width: 140px;
}
body.page-download .sound-icon .label {
    font-size: 20px;
}
body.page-download .sound-icon.active .label {
    color: #e6edf3 !important;
    text-decoration-color: #e6edf3 !important;
}
body.page-download .sound-grid-icons {
    gap: 0.8rem 0.3rem;
    margin-top: 1.5rem; /* Added spacing above sound grid on download page */
}

.main-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}
.main-icon:hover {
    transform: scale(1.04);
}
.main-icon:active {
    transform: scale(0.94);
}
.main-icon .icon-bg {
    width: 140px;
    height: 140px;
}
.main-icon .icon-bg svg {
    width: 64px;
    height: 64px;
}
.main-icon .icon-bg::before {
    inset: 8px;
}

.stars {
    color: #f4b400;
    font-size: 1.4rem;
    letter-spacing: 3px;
    line-height: 1;
    user-select: none;
}
.stars .empty {
    color: #30363d;
}

.download-btn {
    box-shadow:
        0 6px 0 #0f5a1f,
        0 8px 24px rgba(35, 134, 54, 0.3),
        inset 0 -4px 8px rgba(0,0,0,0.2),
        inset 0 4px 8px rgba(255,255,255,0.08) !important;
    transform: translateY(-2px);
    transition: all 0.15s ease !important;
    font-size: 1rem !important;
    padding: 0.7rem 2rem !important;
    user-select: none;
}
.download-btn:hover {
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow:
        0 8px 0 #0f5a1f,
        0 12px 32px rgba(35, 134, 54, 0.4),
        inset 0 -4px 8px rgba(0,0,0,0.2),
        inset 0 4px 8px rgba(255,255,255,0.1) !important;
}
.download-btn:active {
    transform: translateY(4px) scale(0.97) !important;
    box-shadow:
        0 2px 0 #0f5a1f,
        0 4px 12px rgba(35, 134, 54, 0.2),
        inset 0 -2px 4px rgba(0,0,0,0.2),
        inset 0 2px 4px rgba(255,255,255,0.04) !important;
}

.more-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #8b949e;
    font-size: 1rem;
    font-weight: 450;
    text-decoration: none;
    transition: color 0.2s ease, gap 0.2s ease;
    cursor: pointer;
    padding: 0.5rem 0;
}
.more-link:hover {
    color: #e6edf3;
    gap: 0.7rem;
}
.more-link svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
}
.more-link:hover svg {
    transform: translateX(3px);
}

h1 {
    font-size: 2.4rem !important;
    margin: 0 !important;
    user-select: none;
}
#mainInfo {
    font-size: 1rem !important;
    user-select: none;
}
#mainInfo .size-badge {
    font-size: 0.8rem !important;
}

.main-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 0.5rem;
    gap: 0.5rem;
    width: 100%;
}

.sound-list {
    padding: 0.5rem 0.3rem 0.6rem;
    border-top: 1px solid #21262d;
    margin-top: 0.5rem;
}

.sound-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0 0.2rem;
}
.sound-list-header h2 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #8b949e;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.7;
}

.sound-list-footer {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 0.25rem;
}

/* ===== Responsive: index ===== */
@media (max-width: 480px) {
    body.page-index .sound-grid-icons {
        gap: 1.8rem 0.2rem;
        margin-top: 1.2rem;
    }
    body.page-index .circular-btn {
        width: 100px;
        height: 100px;
    }
    body.page-index .circular-btn svg {
        width: 42px;
        height: 42px;
    }
    body.page-index .sound-icon .label {
        font-size: 18px;
    }
    body.page-index .sound-icon {
        max-width: 150px;
    }
    .search-container {
        max-width: 9.75rem;
    }
}

@media (min-width: 481px) and (max-width: 639px) {
    body.page-index .sound-grid-icons {
        gap: 1.6rem 0.3rem;
        margin-top: 1.3rem;
    }
    body.page-index .circular-btn {
        width: 108px;
        height: 108px;
    }
    body.page-index .circular-btn svg {
        width: 44px;
        height: 44px;
    }
    body.page-index .sound-icon .label {
        font-size: 19px;
    }
    body.page-index .sound-icon {
        max-width: 155px;
    }
    .search-container {
        max-width: 13.5rem;
    }
}

@media (min-width: 480px) {
    body.page-download .sound-grid-icons {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.9rem 0.3rem;
        margin-top: 1.2rem;
    }
    body.page-download .sound-icon .icon-circle {
        width: 92px;
        height: 92px;
    }
    body.page-download .sound-icon .icon-circle::before {
        inset: 5px;
    }
    body.page-download .sound-icon .icon-circle svg {
        width: 36px;
        height: 36px;
    }
    body.page-download .sound-icon .label {
        font-size: 18px;
    }
    body.page-download .stars {
        font-size: 1.6rem;
    }
    body.page-download .main-icon .icon-bg {
        width: 120px;
        height: 120px;
    }
    body.page-download .main-icon .icon-bg::before {
        inset: 6px;
    }
    body.page-download .main-icon .icon-bg svg {
        width: 56px;
        height: 56px;
    }
}

@media (min-width: 640px) {
    .header-back svg {
        width: 24px;
        height: 24px;
    }
    .header-menu {
        font-size: 1.4rem;
    }
    .search-container {
        max-width: 18rem;
    }
    .sound-list-header h2 {
        font-size: 1rem;
    }

    body.page-index .sound-grid-icons {
        gap: 1.6rem 0.4rem;
        margin-top: 1.5rem;
    }
    body.page-index .circular-btn {
        width: 116px;
        height: 116px;
    }
    body.page-index .circular-btn svg {
        width: 48px;
        height: 48px;
    }
    body.page-index .sound-icon {
        max-width: 165px;
    }
    body.page-index .sound-icon .label {
        font-size: 20px;
    }

    body.page-download .sound-grid-icons {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem 0.35rem;
        margin-top: 1.5rem;
    }
    body.page-download .sound-icon .icon-circle {
        width: 104px;
        height: 104px;
    }
    body.page-download .sound-icon .icon-circle::before {
        inset: 6px;
    }
    body.page-download .sound-icon .icon-circle svg {
        width: 42px;
        height: 42px;
    }
    body.page-download .sound-icon .label {
        font-size: 20px;
    }
    body.page-download .main-icon .icon-bg {
        width: 140px;
        height: 140px;
    }
    body.page-download .main-icon .icon-bg::before {
        inset: 8px;
    }
    body.page-download .main-icon .icon-bg svg {
        width: 64px;
        height: 64px;
    }
    body.page-download .stars {
        font-size: 1.8rem;
    }
}

@media (min-width: 768px) {
    body.page-index .sound-grid-icons {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.8rem 0.5rem;
        margin-top: 1.8rem;
    }
    body.page-index .circular-btn {
        width: 124px;
        height: 124px;
    }
    body.page-index .circular-btn svg {
        width: 52px;
        height: 52px;
    }
    body.page-index .sound-icon {
        max-width: 175px;
    }
    body.page-index .sound-icon .label {
        font-size: 22px;
    }
}

@media (min-width: 1024px) {
    body.page-index .sound-grid-icons {
        grid-template-columns: repeat(6, 1fr);
        gap: 2rem 0.6rem;
        margin-top: 2rem;
    }
    body.page-index .circular-btn {
        width: 132px;
        height: 132px;
    }
    body.page-index .circular-btn svg {
        width: 56px;
        height: 56px;
    }
    body.page-index .sound-icon {
        max-width: 185px;
    }
    body.page-index .sound-icon .label {
        font-size: 24px;
    }
    .search-container {
        max-width: 22rem;
    }

    body.page-download .sound-grid-icons {
        grid-template-columns: repeat(6, 1fr);
        gap: 1.2rem 0.4rem;
        margin-top: 2rem;
    }
    body.page-download .sound-icon .icon-circle {
        width: 116px;
        height: 116px;
    }
    body.page-download .sound-icon .icon-circle svg {
        width: 48px;
        height: 48px;
    }
    body.page-download .sound-icon .label {
        font-size: 22px;
    }
    body.page-download .main-icon .icon-bg {
        width: 160px;
        height: 160px;
    }
    body.page-download .main-icon .icon-bg svg {
        width: 72px;
        height: 72px;
    }
    body.page-download h1 {
        font-size: 2.8rem !important;
    }
    body.page-download #mainInfo {
        font-size: 1.1rem !important;
        gap: 0.75rem !important;
    }
    body.page-download #mainInfo .size-badge {
        font-size: 0.9rem !important;
        padding: 0.3rem 0.8rem !important;
    }
    body.page-download .download-btn {
        font-size: 1.05rem !important;
        padding: 0.8rem 2.5rem !important;
        gap: 0.75rem !important;
    }
    body.page-download .download-btn svg {
        width: 22px !important;
        height: 22px !important;
    }
    body.page-download .stars {
        font-size: 2rem;
    }
    body.page-download .main-display {
        gap: 0.8rem !important;
        padding: 1rem 1.5rem !important;
    }
    body.page-download .more-link {
        font-size: 1.05rem;
    }
}

@media (min-width: 1280px) {
    body.page-index .sound-grid-icons {
        gap: 2.2rem 0.7rem;
        margin-top: 2.2rem;
    }
    body.page-index .circular-btn {
        width: 140px;
        height: 140px;
    }
    body.page-index .circular-btn svg {
        width: 60px;
        height: 60px;
    }
    body.page-index .sound-icon {
        max-width: 195px;
    }
    body.page-index .sound-icon .label {
        font-size: 26px;
    }

    body.page-download .sound-grid-icons {
        gap: 1.4rem 0.5rem;
        margin-top: 2.2rem;
    }
    body.page-download .sound-icon .icon-circle {
        width: 128px;
        height: 128px;
    }
    body.page-download .sound-icon .icon-circle svg {
        width: 54px;
        height: 54px;
    }
    body.page-download .sound-icon .label {
        font-size: 24px;
    }
    body.page-download .main-icon .icon-bg {
        width: 180px;
        height: 180px;
    }
    body.page-download .main-icon .icon-bg svg {
        width: 80px;
        height: 80px;
    }
    body.page-download h1 {
        font-size: 3.2rem !important;
    }
    body.page-download .stars {
        font-size: 2.2rem;
    }
}

@media (max-width: 380px) {
    body.page-index .sound-grid-icons {
        gap: 1.6rem 0.15rem;
        margin-top: 1rem;
    }
    body.page-index .circular-btn {
        width: 85px;
        height: 85px;
    }
    body.page-index .circular-btn svg {
        width: 36px;
        height: 36px;
    }
    body.page-index .sound-icon {
        max-width: 120px;
    }
    body.page-index .sound-icon .label {
        font-size: 16px;
    }
    body.page-index .search-container input {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem 0.5rem 2.2rem;
    }
    body.page-index .search-container .search-icon {
        left: 0.8rem;
        width: 15px;
        height: 15px;
    }

    body.page-download .sound-icon .icon-circle {
        width: 76px;
        height: 76px;
    }
    body.page-download .sound-icon .icon-circle::before {
        inset: 4px;
    }
    body.page-download .sound-icon .icon-circle svg {
        width: 30px;
        height: 30px;
    }
    body.page-download .sound-icon .label {
        font-size: 16px;
    }
    body.page-download .sound-grid-icons {
        gap: 0.5rem 0.15rem;
        margin-top: 1rem;
    }
    body.page-download .main-icon .icon-bg {
        width: 110px;
        height: 110px;
    }
    body.page-download .main-icon .icon-bg::before {
        inset: 6px;
    }
    body.page-download .main-icon .icon-bg svg {
        width: 50px;
        height: 50px;
    }
    body.page-download h1 {
        font-size: 1.6rem !important;
    }
    body.page-download .stars {
        font-size: 1.2rem;
    }
}