body {
    background-color: #008080;
    margin: 0;
    padding: 20px 0;
    box-sizing: border-box;
}

.window {
    width: 50%;
    margin: 0 auto;
    position: relative;
}

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    body {
        padding: 10px 8px;
    }
    .window {
        width: 100%;
        margin: 0;
    }
    .tabs menu[role="tablist"] {
        overflow-x: auto;
        white-space: nowrap;
        display: flex;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px; /* Avoid clipping focus ring */
    }
    .tabs menu[role="tablist"] button {
        flex: 0 0 auto;
    }
}

.title-bar-text a {
    color: white;
    text-decoration: none;
}

.title-bar-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.title-bar-text a:hover {
    text-decoration: underline;
}

.title-bar-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

.blur-image {
    filter: blur(20px);
    transition: filter 0.3s;
}

.blur-image:hover {
    filter: blur(0);
}

button {
    color: blue;
}

button:disabled {
    color: #808080;
    text-shadow: 1px 1px #fff;
}

.window-body a,
.window-body .tree-view a {
    color: #0000ff;
    text-decoration: underline;
}

.window-body a:hover,
.window-body .tree-view a:hover {
    text-decoration: none;
}

.window-body a:has(button),
.window-body a:has(img),
.art-thumb a,
.window-body .tree-view a:has(button),
.window-body .tree-view a:has(img) {
    text-decoration: none;
}

.art-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 1rem;
}

.art-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4px;
    border: 1px solid transparent;
    transition: background 0.2s;
}

.art-thumb:hover {
    background: #ececec;
    border: 1px solid #ccc;
}

.art-thumb img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    aspect-ratio: 1 / 1;
}

.thumb-info {
    font-size: 0.75em;
    margin-top: 4px;
    width: 100%;
}

.thumb-actions {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.thumb-actions button {
    padding: 2px 5px;
    font-size: 10px;
    margin: 0;
}

.htmx-indicator {
    display: none;
    margin: 1rem 0;
    width: 100%;
}

.htmx-request .htmx-indicator {
    display: block !important;
}

.htmx-request.htmx-indicator {
    display: block !important;
}

.inline-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.inline-buttons p {
    margin: 0;
}

.inline-buttons button {
    margin: 0;
}

/* HTMX Indicator styles */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: block;
}

input[type="text"], input[type="email"], input[type="password"], textarea {
  border: 1px solid #7f9db9;
  max-width: 100%;
  box-sizing: border-box;
}

textarea {
    resize: vertical;
}

select[multiple] {
    height: auto;
    background-image: none;
}

.search-help span[style*="cursor: help"] {
    cursor: help !important;
}

.booru-form-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.booru-search-input {
    flex-grow: 1;
    order: 1;
    margin-bottom: 0 !important;
    padding: 3px 10px !important;
    height: 23px !important;
    min-width: 0;
}

.booru-search-submit {
    order: 2;
    margin-bottom: 0 !important;
    padding: 0 10px !important;
    height: 23px !important;
    white-space: nowrap;
}

.booru-mobile-break {
    width: 100%;
    height: 0;
    order: 3;
}

.booru-btn-add { order: 4; }
.booru-btn-archive { order: 5; }
.booru-btn-lucky { order: 6; }

.booru-btn-add, .booru-btn-archive, .booru-btn-lucky {
    display: flex;
    text-decoration: none !important;
    flex-grow: 1;
}

.booru-btn-add button, .booru-btn-archive button, .booru-btn-lucky button {
    margin-bottom: 0 !important;
    padding: 0 10px !important;
    height: 23px !important;
    white-space: nowrap;
    width: 100%;
}

@media (min-width: 769px) {
    .booru-mobile-break {
        display: none;
    }

    .booru-btn-add { order: 1; }
    .booru-btn-archive { order: 2; }
    .booru-search-input {
        order: 3;
        min-width: 300px;
    }
    .booru-btn-lucky { order: 4; }
    .booru-search-submit { order: 5; }

    .booru-btn-add, .booru-btn-archive, .booru-btn-lucky {
        flex-grow: 0;
    }

    .booru-btn-add button, .booru-btn-archive button, .booru-btn-lucky button {
        width: auto;
    }
}