:root {
    --inkColor: #000;
    --bgColor: #fff;
    --textColor: #000;
    --borderColor: #eee;
    --hoverBgColor: #f5f5f5;
}

[data-theme="dark"] {
    --inkColor: #fff;
    --bgColor: #1a1a1a;
    --textColor: #fff;
    --borderColor: #333;
    --hoverBgColor: #2a2a2a;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bgColor);
    color: var(--textColor);
}

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

select {
    width: 115px;
}

#shroud {
    display: none;
    position: fixed;
    top: 0;
    height: 200px;
    background: linear-gradient(180deg, var(--bgColor), transparent);
    width: 100%;
    z-index: 200;
    pointer-events: none;
}

#stampList {
    margin-left: 190px;
    margin-top: 0;
    padding: 16px;
    box-sizing: border-box;
    overflow: auto;
}

#stampList li {
    margin: 7px 0;
    padding: 0 15px;
}

@media (max-width: 768px) {
    #stampList {
        margin-left: 0;
        margin-top: 150px;
        padding: 12px;
    }
    #shroud {
        display: block;
    }
}

.search-container {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    padding: 7px 13px;
    width: 240px;
    outline: 1px solid currentColor;
    position: relative;
    color: var(--inkColor);
}

.search-input-wrapper {
    display: flex;
    column-gap: 5px;
}

.search-results {
    position: relative;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--inkColor);
}

.search-result-item {
    padding: 8px 0px;
    cursor: pointer;
    border-bottom: 1px solid var(--inkColor);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.focused {
    background: var(--hoverBgColor);
}

.search-result-item.focused {
    outline: 2px solid var(--inkColor);
    outline-offset: -2px;
}

.result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--inkColor);
}

.result-category {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.search-result-item.no-results {
    color: #666;
    font-style: italic;
    cursor: default;
}

.search-container:focus-within {
    outline: 2px solid currentColor;
}

.search-icon {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 16px;
    color: var(--inkColor);
}

.search-input::placeholder {
    color: var(--inkColor);
    opacity: 0.6;
}

.card-container {
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--inkColor) 88%, transparent);
    border-radius: 0 17px 17px 17px;
    padding: 8px 16px;
    width: 240px;
    border: 1px solid var(--inkColor);
    color: white;
}

.card-icon {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.card-content {
    flex: 1;
}

.card-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.card-message {
    font-size: 12px;
    opacity: 0.8;
    margin: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    background: transparent;
    justify-content: center;
    padding: 0px 16px;
    width: 240px;
    color: var(--inkColor);
}

.color-picker {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.color-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
}

.color-circle.selected {
    border-color: #666;
    transform: scale(1.1);
}

.hud {
    position: fixed;
    top: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.hud.right {
    right: 16px;
}

.hud.left {
    left: 16px;
    align-items: flex-start;
}

.theme-toggle {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--textColor);
    transition: background-color 0.2s;
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
}

.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px;
}

.button {
    padding: 8px 16px;
    border: 1px solid var(--inkColor);
    border-radius: 8px;
    background: var(--bgColor);
    color: var(--inkColor);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    transform: scale(1);
    user-select: none;
}

.button.danger {
    color: #dc2626;
    border-color: #dc2626;
}

/* hover styles for desktop browsers */

@media (hover: hover) {
    .theme-toggle:hover {
        background: var(--hoverBgColor);
    }
    .color-circle:hover {
        transform: scale(1.1);
    }
    button.icon.popup-close:hover {
        color: var(--textColor);
    }
    .search-result-item:hover {
        background: var(--hoverBgColor);
    }
    .button:hover {
        background: var(--inkColor);
        color: var(--bgColor);
    }
    .button.danger:hover {
        background: #dc2626;
        color: white;
    }
    .button.icon:hover {
        background: var(--hoverBgColor);
    }
    .popup-preview-close:hover {
        opacity: 1;
    }
}

/* tap styles for mobile browsers */

@media (hover: none) {
    .theme-toggle:active {
        background: var(--hoverBgColor);
    }
    .color-circle:active {
        transform: scale(1.1);
    }
    button.icon.popup-close:active {
        color: var(--textColor);
    }
    .search-result-item:active {
        background: var(--hoverBgColor);
    }
    .button:active {
        background: var(--inkColor);
        color: var(--bgColor);
    }
    .button.danger:active {
        background: #dc2626;
        color: white;
    }
    .button.icon:active {
        background: var(--hoverBgColor);
    }
    .popup-preview-close:active {
        opacity: 1;
    }
}

.button.icon {
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--textColor);
}

.stamp-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 7px 0;
    padding: 0 15px;
    position: relative;
}

.progress-bar.vertical {
    width: 24px;
    height: 80px;
}

.progress-bar.horizontal {
    width: 120px;
    height: 24px;
}

.progress-bar {
    background: color-mix(in srgb, var(--inkColor) 10%, transparent);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--inkColor);
    border-radius: 4px;
    transition: all 0.3s ease;
    height: 100%;
    width: 100%;
}

.saturation-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.popup-content {
    background: var(--bgColor);
    border: 1px solid var(--borderColor);
    border-radius: 12px;
    padding: 20px;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--borderColor);
}

.popup-header h3 {
    margin: 0;
    color: var(--textColor);
    font-size: 18px;
}

.popup-message {
    color: var(--textColor);
    font-size: 16px;
    line-height: 1.5;
}

button.icon.popup-close {
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.popup-preview {
    background: color-mix(in srgb, var(--inkColor) 88%, transparent);
    border: 1px solid var(--inkColor);
    border-radius: 12px;
    padding: 16px;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
}

.popup-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-preview-header h3 {
    margin: 0;
    color: white;
    font-size: 16px;
}

.popup-preview-close {
    padding: 4px;
    cursor: pointer;
    color: white;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.popup-preview-message {
    color: white;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.9;
}
