@font-face {
    font-family: 'Orbitron';
    /* Keep in sync with `get_fingerprinted_url("static/Orbitron/Orbitron-VariableFont_wght.ttf")` */
    src: url('/static/Orbitron/Orbitron-VariableFont_wght.46eefc70.ttf') format('truetype');
    font-display: swap;
    font-weight: 100 900;
    font-style: normal;
}

:root {
    --neon: #00c0ff;
    --neon-glow: 0 0 6px rgba(0, 192, 255, 0.35), 0 0 12px rgba(0, 192, 255, 0.18);
    --panel: #2a2a2a;
    --panel-2: #333;
    --stroke: #0b0b0b;
    --danger: #ff3b6a;
    --danger-glow: 0 0 8px rgba(255, 59, 106, 0.45), 0 0 16px rgba(255, 59, 106, 0.2);
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-size: 16px;
}

#header {
    display: flex;
    flex-wrap: wrap;
    gap: 0px 12px;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #333;
    background-color: var(--panel);
    box-sizing: border-box;
}

#search-form {
    display: flex;
    flex: 1;
    box-sizing: border-box;
    gap: 8px;
}

#search-form input {
    flex: 1;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: var(--panel-2);
    color: #e0e0e0;
    box-sizing: border-box;
    min-width: 0;
    height: 44px;
}

#search-form button {
    height: 44px;
    box-sizing: border-box;
}

.header-icon-btn {
    border: 1px solid rgba(0, 192, 255, 0.35);
    padding: 8px;
    font-size: 20px;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    color: var(--neon);
    box-shadow: inset 0 0 0 1px rgba(0, 192, 255, 0.08);
}

.header-icon-btn:hover {
    border-color: rgba(0, 192, 255, 0.65);
    text-decoration: none;
    box-shadow: var(--neon-glow);
}

#user-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

#login-form {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0px;
}

a {
    color: var(--neon);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: var(--neon);
    text-shadow: var(--neon-glow);
}

/* Opt-in “site navigation / UI” link styling */
a.nav-link,
.nav-link a {
    font-family: 'Orbitron', system-ui, sans-serif;
    letter-spacing: 0.02em;
}

button {
    cursor: pointer;
    font-family: inherit;
}

button.btn-primary {
    padding: 8px 16px;
    background-color: var(--neon);
    color: #000;
    border: 1px solid rgba(0, 192, 255, 0.85);
    border-radius: 4px;
    font-size: 16px;
    min-height: 44px;
    font-family: 'Orbitron', system-ui, sans-serif;
    letter-spacing: 0.02em;
}

button.btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: var(--neon-glow);
}

button.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid rgba(255, 59, 106, 0.7);
}

button.btn-danger:hover {
    box-shadow: var(--danger-glow);
}

button.btn-secondary,
button.btn-tertiary {
    background-color: transparent;
    color: var(--neon);
    border: 1px solid rgba(0, 192, 255, 0.55);
    border-radius: 4px;
    min-height: 44px;
    box-shadow: inset 0 0 0 1px rgba(0, 192, 255, 0.08);
    font-family: 'Orbitron', system-ui, sans-serif;
    letter-spacing: 0.02em;
}

button.btn-secondary:disabled,
button.btn-tertiary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: rgba(160, 160, 160, 0.55);
    color: rgba(200, 200, 200, 0.8);
    box-shadow: none;
}

button.btn-secondary:hover,
button.btn-tertiary:hover {
    background-color: rgba(0, 192, 255, 0.06);
    box-shadow: var(--neon-glow);
}

.search-results {
    display: flex;
    flex-wrap: wrap;
    padding: 20px;
    gap: 20px;
}

.search-results>div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-results img {
    max-width: 45vw;
    max-height: 45vh;
    margin: 0;
    object-fit: contain;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #2a2a2a;
}

.main-image {
    max-width: 60vw;
    max-height: 60vh;
    object-fit: contain;
    border: 1px solid #444;
    border-radius: 4px;
    margin: 10px 0;
    background-color: #2a2a2a;
}

.similar-image {
    max-width: 30vw;
    max-height: 30vh;
    object-fit: contain;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #2a2a2a;
}

.similar-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
}

.similar-container>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.image-metadata {
    text-align: center;
    font-size: 0.9em;
    color: #999;
    margin: 0;
}

.image-controls {
    display: flex;
    flex-direction: row;
    gap: 5px;
    margin-top: 5px;
    align-items: center;
    position: relative;
}

.image-detail-admin {
    margin: 15px 0;
    padding: 15px;
    background-color: #2a2a2a;
    border-radius: 4px;
    display: inline-block;
}

.content-wrapper {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.upload-filename {
    word-break: break-all;
    overflow-wrap: break-word;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #333;
}

th {
    background-color: #2a2a2a;
    font-weight: 600;
}

form {
    margin: 10px 0;
}

h1,
h2 {
    margin: 20px 0 10px 0;
    color: #f0f0f0;
}

textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    font-family: inherit;
    margin: 10px 0;
    background-color: #333;
    color: #e0e0e0;
}

input[type="text"],
input[type="password"],
input[type="file"],
input[type="search"] {
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: #e0e0e0;
    font-size: 16px;
}

input[type="file"] {
    margin-right: 10px;
}

/* Style the search input clear button for dark theme */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23e0e0e0"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>');
    background-size: 16px 16px;
    cursor: pointer;
}

input[type="search"]::-webkit-search-cancel-button:hover {
    opacity: 0.7;
}

input[type="file"]::file-selector-button {
    background-color: rgba(0, 0, 0, 0.25);
    color: var(--neon);
    border: 1px solid rgba(0, 192, 255, 0.55);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-family: 'Orbitron', system-ui, sans-serif;
}

input[type="file"]::file-selector-button:hover {
    background-color: rgba(0, 192, 255, 0.06);
    box-shadow: var(--neon-glow);
}

.icon {
    width: 25px;
    height: 25px;
    display: inline-block;
    background-color: currentColor;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}

/* Default (wide): show text label, hide icon */
.search-btn-icon {
    display: none;
}

.icon-home {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" fill-rule="evenodd" d="M4 22V12H1L12 3L23 12H20V22H4ZM17 4H20V8H17V4ZM7 22V14H10V22H7ZM14 14H18V18H14V14Z"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" fill-rule="evenodd" d="M4 22V12H1L12 3L23 12H20V22H4ZM17 4H20V8H17V4ZM7 22V14H10V22H7ZM14 14H18V18H14V14Z"/></svg>');
}

.icon-search {
    /* Slightly longer handle for better legibility at 20px */
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M10 2a8 8 0 105.3 14l5.2 5.2 1.4-1.4-5.2-5.2A8 8 0 0010 2zm0 2a6 6 0 110 12 6 6 0 010-12z"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M10 2a8 8 0 105.3 14l5.2 5.2 1.4-1.4-5.2-5.2A8 8 0 0010 2zm0 2a6 6 0 110 12 6 6 0 010-12z"/></svg>');
}

.icon-dice {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l9 4.5-9 4.5-9-4.5L12 2zM12 5a1.2 1.2 0 100 2.4 1.2 1.2 0 000-2.4z" fill-rule="evenodd"/><path d="M3 8.5l8 4v9.5l-8-4V8.5zM6 12a1 1 0 100 2 1 1 0 000-2zM9 16a1 1 0 100 2 1 1 0 000-2z" fill-rule="evenodd"/><path d="M13 12.5l8-4v9.5l-8 4v-9.5zM15.5 12a1 1 0 100 2 1 1 0 000-2zM17 14.5a1 1 0 100 2 1 1 0 000-2zM18.5 17a1 1 0 100 2 1 1 0 000-2z" fill-rule="evenodd"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l9 4.5-9 4.5-9-4.5L12 2zM12 5a1.2 1.2 0 100 2.4 1.2 1.2 0 000-2.4z" fill-rule="evenodd"/><path d="M3 8.5l8 4v9.5l-8-4V8.5zM6 12a1 1 0 100 2 1 1 0 000-2zM9 16a1 1 0 100 2 1 1 0 000-2z" fill-rule="evenodd"/><path d="M13 12.5l8-4v9.5l-8 4v-9.5zM15.5 12a1 1 0 100 2 1 1 0 000-2zM17 14.5a1 1 0 100 2 1 1 0 000-2zM18.5 17a1 1 0 100 2 1 1 0 000-2z" fill-rule="evenodd"/></svg>');
}

pre {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

.mod-description-input {
    width: 300px;
    margin-right: 10px;
}

.welcome-image {
    max-width: 400px;
    width: 100%;
    height: auto;
    object-fit: contain;
    border: 1px solid #444;
    border-radius: 4px;
    margin: 20px 0 10px 0;
    background-color: #2a2a2a;
}

.welcome-quote {
    font-style: italic;
    text-align: center;
    margin: 10px 0;
    color: #e0e0e0;
}

/* Mobile / narrow responsive styles */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }

    body {
        font-size: 18px;
        overflow-x: hidden;
    }

    #header {
        flex-direction: column;
        padding: 15px;
        gap: 0px;
        align-items: stretch;
        width: 100%;
        max-width: 100vw;
    }

    #header>a {
        text-align: center;
        padding: 8px;
    }

    #search-form {
        display: flex;
        width: 100%;
        flex-direction: row;
        margin: 5px 0px;
        gap: 8px;
    }

    #search-form input {
        flex: 1;
        min-width: 0;
        padding: 12px;
        font-size: 16px;
        height: 50px;
    }

    #search-form button {
        flex-shrink: 0;
        width: auto;
        padding: 12px 20px;
        height: 50px;
    }

    .header-icon-btn {
        padding: 10px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .search-btn-text {
        display: none;
    }

    .search-btn-icon {
        display: inline-block;
    }

    #search-form button {
        width: 50px;
        height: 50px;
        padding: 12px;
        flex-shrink: 0;
        font-size: 22px;
    }

    #user-controls {
        flex-direction: column;
        width: 100%;
        gap: 8px;
        align-items: stretch;
        margin-left: 0px;
    }

    #user-controls>a,
    #user-controls>form {
        width: 100%;
    }

    #login-form {
        flex-direction: column;
        width: 100%;
        gap: 0;
        align-items: stretch;
        transition: gap 0.3s ease;
    }

    /* Add gap when form has focus or username has content */
    #login-form:focus-within,
    #login-form:has(input[type="text"]:not(:placeholder-shown)) {
        gap: 8px;
    }

    #login-form input[type="text"],
    #login-form input[type="password"] {
        width: 100%;
        margin-bottom: 0;
    }

    #login-form label {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: auto;
        flex-shrink: 0;
        white-space: nowrap;
        margin-bottom: 0;
        margin-top: 8px;
        transition: margin-top 0.3s ease;
    }

    /* Remove label top margin when password/button are shown */
    #login-form:focus-within label,
    #login-form:has(input[type="text"]:not(:placeholder-shown)) label {
        margin-top: 0;
    }

    #login-form label input[type="checkbox"] {
        width: auto;
        min-height: auto;
        margin: 0;
    }

    /* Hide password field and button when username is empty and unfocused */
    #login-form input[type="password"],
    #login-form button {
        max-height: 0;
        min-height: 0;
        opacity: 0;
        overflow: hidden;
        margin: 0 !important;
        padding: 0 !important;
        border: 0;
        transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease, border 0.3s ease, min-height 0.3s ease;
    }

    /* Show password and button when username has content OR when form has focus */
    #login-form:focus-within input[type="password"],
    #login-form:focus-within button,
    #login-form input[type="text"]:not(:placeholder-shown)~input[type="password"],
    #login-form input[type="text"]:not(:placeholder-shown)~button {
        max-height: 200px;
        min-height: 44px;
        opacity: 1;
        margin-bottom: 0 !important;
        padding: 12px !important;
        border: 1px solid #444;
        transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease, border 0.3s ease, min-height 0.3s ease;
    }

    /* Button needs no border */
    #login-form:focus-within button,
    #login-form input[type="text"]:not(:placeholder-shown)~button {
        border: none;
    }

    button.btn-primary,
    button.btn-secondary,
    button.btn-tertiary {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px;
    }

    .search-results {
        flex-direction: column;
        align-items: center;
        padding: 15px;
        gap: 20px;
    }

    .search-results>div {
        width: 100%;
    }

    .search-results img {
        max-width: 90vw;
        max-height: 60vh;
    }

    .main-image {
        max-width: 95vw;
        max-height: 70vh;
    }

    .similar-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .similar-container>div {
        width: 100%;
    }

    .similar-image {
        max-width: 90vw;
        max-height: 50vh;
    }

    .image-metadata {
        font-size: 1em;
    }

    .details-content {
        position: static;
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }

    .content-wrapper {
        padding: 15px;
    }

    h1 {
        font-size: 1.75em;
    }

    h2 {
        font-size: 1.5em;
    }

    table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    th,
    td {
        padding: 8px 6px;
    }

    textarea {
        font-size: 16px;
        padding: 12px;
    }

    input[type="text"],
    input[type="password"],
    input[type="file"],
    input[type="search"] {
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
        margin-bottom: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .mod-description-input {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    form {
        width: 100%;
    }

    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .welcome-image {
        max-width: 90vw;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    #header {
        padding: 12px;
    }

    .content-wrapper {
        padding: 12px;
    }

    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.3em;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 6px 4px;
    }
}

/* Image action buttons (copy, download) */
.image-action-btn {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 32px;
    transition: background-color 0.2s, border-color 0.2s;
}

.image-action-btn:hover {
    background-color: #3a3a3a;
    border-color: #555;
}

.image-action-btn.copied {
    color: #28a745;
    border-color: #28a745;
}

/* Toast notification */
.image-action-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #e0e0e0;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.image-action-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Linked image preview in comments */
.linked-image-preview-container {
    float: right;
    width: 15vw;
    height: 15vh;
    overflow: hidden;
    margin: 0 0 8px 12px;
    border-radius: 4px;
    border: 1px solid #444;
}

/* /chat */
.chat-container {
  margin-top: 16px;
}

.chat-username-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.chat-username-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-warning {
  opacity: 0.8;
  margin-top: 12px;
}

.chat-status-row {
  margin-top: 8px;
}

.chat-log {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px;
  height: 320px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.35;
}

.chat-cid {
  color: #9aa0a6;
}

.chat-send-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-send-row input {
  flex: 1;
}

@media (max-width: 768px) {
  .chat-send-row {
    flex-direction: column;
  }

  .chat-send-row button {
    width: 100%;
  }
}

.linked-image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Comment with preview - for image detail page */
.comment-with-preview {
    padding: 8px 0;
    border-bottom: 1px solid #333;
    overflow: hidden;
}

/* Comment content with preview wrapper - for front page */
.comment-content-with-preview {
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
}

/* Responsive styles for linked image preview */
@media (max-width: 768px) {
    .linked-image-preview-container {
        width: 25vw;
        height: 12vh;
    }
}
