:root[data-theme=light] {
    --bg-color: #ffffff;
    --surface-color: #f0f2f5;
    --tab-active-bg: #e3e5e8;
    --text-color: #17191c;
    --text-secondary: #737d8c;
    --input-border: #e3e8f0;
    --input-bg: #f4f6fa;
    --border-color: #e3e8f0;
    --menu-active-bg: #0dbd8b;
    --menu-active-fg: #ffffff;
    --accent-color: #0dbd8b;
    --accent-ring: rgba(13, 189, 139, .25);
    --hover-bg: rgba(0, 0, 0, .05);
    --shadow-color: rgba(20, 24, 33, .08);
    --search-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737d8c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
    --giphy-logo: "https://upload.wikimedia.org/wikipedia/commons/5/57/Poweredby_100px-Black_VertLogo.png"
}

:root[data-theme=dark] {
    --bg-color: #17191c;
    --surface-color: #20232a;
    --tab-active-bg: #2b2e34;
    --text-color: #ffffff;
    --text-secondary: #8e99a4;
    --input-border: #2e3238;
    --input-bg: #20232a;
    --border-color: #2e3238;
    --menu-active-bg: #0dbd8b;
    --menu-active-fg: #ffffff;
    --accent-color: #0dbd8b;
    --accent-ring: rgba(13, 189, 139, .3);
    --hover-bg: rgba(255, 255, 255, .06);
    --shadow-color: rgba(0, 0, 0, .35);
    --search-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e99a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
    --giphy-logo: "https://upload.wikimedia.org/wikipedia/commons/5/57/Poweredby_100px-White_VertLogo.png"
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg-color);
    color: var(--text-color);
    position: relative;
}

.bottom-hover-area {
    pointer-events: none
}

.bottom-bar .settings-container,
.bottom-bar button {
    pointer-events: auto
}

.settings-menu label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-color);
    font-size: 13px;
    cursor: pointer;
}

.settings-menu label+label {
    margin-top: 6px;
}

.tab-container {
    margin: 0;
    padding: 10px 12px 6px;
    border-bottom: none;
    display: flex;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    background-color: transparent;
    box-sizing: border-box;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-container::-webkit-scrollbar {
    display: none;
}

.search-container {
    padding: 4px 12px 4px;
    box-sizing: border-box;
    width: 100%;
}

.tab {
    padding: 6px 12px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    margin: 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    transition: color .15s ease, background-color .15s ease;
    user-select: none;
}

.tab:hover {
    color: var(--text-color);
    background-color: var(--hover-bg);
}

.tab.active {
    color: var(--text-color);
    background-color: var(--tab-active-bg);
}

.pack-list {
    margin-top: 6px
}

.sticker-list {
    column-count: var(--grid-columns, 2);
    column-gap: 8px;
    margin-top: 8px;
    width: 100%;
    padding: 0 12px 16px;
    box-sizing: border-box;
}

.history-container .sticker-list,
.local-container .sticker-list {
    padding-top: 12px;
}

.sticker {
    break-inside: avoid;
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    display: inline-block;
    width: 100%;
    background-color: var(--surface-color);
    transition: transform .15s ease, box-shadow .15s ease;
}

.sticker img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px
}

.sticker:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px var(--accent-color), 0 4px 12px var(--shadow-color);
}

.sticker img:hover {
    transform: none;
    box-shadow: none;
}

.use-count {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.error {
    color: #e75252;
    font-size: 13px;
    padding: 8px 12px;
}

input[type=text] {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 14px 9px 38px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    background-image: var(--search-icon);
    background-repeat: no-repeat;
    background-position: 13px center;
    color: var(--text-color);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    font-family: inherit;
}

input[type=text]::placeholder {
    color: var(--text-secondary);
}

input[type=text]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.sticker-text-fallback {
    padding: 14px 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    word-break: break-word;
}

.klipy-attribution {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 4px 0;
    text-decoration: none;
    opacity: .85;
    transition: opacity .15s ease;
}

.klipy-attribution:hover {
    opacity: 1;
}

.klipy-attribution-img {
    height: 16px;
    width: auto;
    display: block;
}

:root[data-theme=light] .klipy-attribution-img.dark {
    display: none;
}

:root[data-theme=dark] .klipy-attribution-img.light {
    display: none;
}

#app {
    width: 100%
}

.bottom-bar {
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
    box-sizing: border-box;
    z-index: 50;
}

.bottom-bar>* {
    pointer-events: auto;
}

.bottom-hover-area {
    display: none;
}

.bottom-bar button {
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 7px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, opacity .2s ease, transform .2s ease;
    box-shadow: 0 2px 8px var(--shadow-color);
    font-family: inherit;
}

.bottom-bar button:hover {
    background-color: var(--tab-active-bg);
    border-color: var(--accent-color);
}

.icon-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px !important;
    color: var(--text-color);
}

.icon-btn svg {
    display: block;
}

#scrollToTopBtn {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

#scrollToTopBtn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.context-menu {
    display: none;
    position: fixed;
    z-index: 1000;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px var(--shadow-color);
    pointer-events: auto;
    padding: 4px;
    min-width: 180px;
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color .12s ease;
    color: var(--text-color);
    border-radius: 6px;
    font-size: 13px;
}

.context-menu-item:hover {
    background-color: var(--accent-color);
    color: var(--menu-active-fg);
}

.has-submenu {
    position: relative;
}

.submenu {
    display: none;
    position: absolute;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 4px;
}

.has-submenu:hover .submenu {
    display: block;
}

.submenu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.submenu-grid .context-menu-item {
    padding: 6px 10px;
    text-align: center;
    min-width: 40px;
    font-size: 12px;
}

.submenu-top {
    bottom: 100%;
    left: 0;
}

.submenu-left {
    right: 100%;
    left: auto;
}

.settings-container {
    position: relative
}

.settings-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    display: none;
    box-shadow: 0 8px 24px var(--shadow-color);
    white-space: nowrap;
}

.settings-container::after,
.settings-menu::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 20px
}

.settings-menu::after {
    bottom: -20px
}

.settings-container:hover .settings-menu {
    display: block
}

