:root {
    --bg: #1e1f22;
    --panel: #2b2d31;
    --panel-2: #313338;
    --border: #3f4147;
    --text: #f2f3f5;
    --muted: #b5bac1;
    --blurple: #5865f2;
    --blurple-hover: #4752c4;
    --danger: #f23f43;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.45 "gg sans", "Noto Sans", "Helvetica Neue", sans-serif;
}

button, input {
    font: inherit;
}

.hidden {
    display: none !important;
}

.gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: min(420px, 100%);
}

.gate-card h1,
.topbar h1 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    color: var(--text);
}

.app-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-icon {
    width: 32px;
    height: 33px;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.card p,
.topbar p {
    margin: 0 0 18px;
    color: var(--muted);
}

label, legend {
    display: block;
    margin: 14px 0 6px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

input:focus {
    outline: 2px solid var(--blurple);
    border-color: transparent;
}

button {
    background: var(--blurple);
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
}

.login-submit {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 12px 16px;
}

button:hover {
    background: var(--blurple-hover);
}

button.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

button.ghost:hover {
    background: var(--panel-2);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: white;
}

.error {
    color: var(--danger);
    margin: 12px 0 0;
}

.muted {
    color: var(--muted);
}

#upload-status,
#upload-error {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.layout {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 48px;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 8px;
    background: var(--panel);
    padding: 6px;
    border-radius: 10px;
}

.tab {
    background: transparent;
    color: var(--muted);
}

.tab.is-active {
    background: var(--blurple);
    color: white;
}

.upload-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}

.dropzone {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    width: 100%;
    min-height: 360px;
    height: 100%;
    margin: 0;
    padding: 48px 24px;
    border: 3px dashed var(--border);
    border-radius: 20px;
    background: var(--panel);
    color: var(--muted);
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: var(--blurple);
    background: #31344a;
    color: var(--text);
    transform: scale(1.01);
}

.dropzone.has-file {
    border-style: solid;
    border-color: var(--blurple);
}

.drop-files {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    width: min(520px, 100%);
    max-height: 160px;
    overflow: auto;
    text-align: left;
}

.drop-files li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
}

.drop-files li + li {
    margin-top: 6px;
}

.drop-files .meta {
    flex-shrink: 0;
    color: var(--muted);
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    color: var(--blurple);
}

.dropzone strong {
    font-size: 1.35rem;
    color: var(--text);
}

.dropzone input {
    display: none;
}

.content {
    display: block;
}

.list-panel,
.upload-panel {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.upload-panel {
    height: 100%;
}

.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.list-head h2,
.upload-panel h2 {
    margin: 0;
    font-size: 1.1rem;
}

.list-note {
    margin: 0 0 16px;
    font-size: 0.9rem;
}

.upload-panel h2 {
    margin-bottom: 16px;
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.file-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.file-icon {
    font-size: 1.35rem;
    line-height: 1;
    width: 1.6em;
    text-align: center;
    user-select: none;
}

.file-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    word-break: break-all;
}

.file-list a:hover {
    color: #c9cdfb;
}

.meta {
    color: var(--muted);
    font-size: 0.85rem;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.copy-link,
.rename-file,
.delete-file,
.preview-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 8px 10px;
    line-height: 1;
    color: var(--text);
}

.copy-link svg,
.rename-file svg,
.delete-file svg,
.preview-copy svg,
.icon-button svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 5;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 8px;
    border-radius: 6px;
    background: #111214;
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
}

button.ghost.delete-file {
    color: var(--danger);
    border-color: var(--danger);
}

button.ghost.delete-file:hover {
    background: #3a1f21;
    color: var(--danger);
    border-color: var(--danger);
}

button.danger {
    background: var(--danger);
    color: white;
}

button.danger:hover {
    background: #d32f32;
}

.preview {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.preview code {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    word-break: break-all;
    color: #c9cdfb;
}

.preview-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 44px;
    padding: 10px 12px;
    line-height: 1;
}

progress {
    width: 100%;
    margin: 12px 0;
    accent-color: var(--blurple);
}

#upload-button {
    width: 100%;
    margin-top: 16px;
}

dialog {
    border: 0;
    padding: 0;
    color: var(--text);
    background: transparent;
}

dialog h2 {
    margin: 0 0 8px;
    color: var(--text);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.warning {
    color: #f0b232;
    margin: 0 0 18px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

@media (max-width: 860px) {
    .upload-row {
        grid-template-columns: 1fr;
    }

    .dropzone {
        min-height: 240px;
        padding: 32px 16px;
        height: auto;
    }

    .upload-panel {
        height: auto;
    }
}
