body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-user-select: none;
    user-select: none;
    scrollbar-width: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    width: 100%;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.share-grid:empty::before {
    content: "No files yet";
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.95rem;
    font-weight: 300;
    pointer-events: none;
}

.share-card {
    background: transparent;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 1.5rem;
    transition: border-color 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.share-card.adding,
.archived-card.adding {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.share-card.removing {
    animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.share-card:hover {
    border-color: #333;
}

.share-info {
    flex: 1;
    min-width: 0;
}

.share-name {
    font-size: 0.95rem;
    font-weight: 400;
    color: #e0e0e0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-mask-image: linear-gradient(
        to right,
        black 0%,
        black 90%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        black 0%,
        black 90%,
        transparent 100%
    );
    padding-bottom: 1px;
    cursor: default;
    user-select: text;
    -webkit-user-select: text;
}

.share-name span {
    cursor: text;
}

.share-name-input {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    color: #fff;
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    outline: none;
    line-height: 1.4;
    width: 100%;
    padding: 0 0 1px 0;
    caret-color: #fff;
}

.share-name-input::selection {
    background: #555;
    color: #fff;
}

.share-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.share-size {
    font-size: 0.8rem;
    color: #666;
}

.share-expiry {
    font-size: 0.65rem;
    color: #888;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-weight: 400;
}

.share-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.share-download {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 0.35rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.share-download:hover {
    background: #252525;
    border-color: #555;
}

.share-download svg {
    width: 18px;
    height: 18px;
}

.share-archive,
.share-copy,
.share-cancel {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.35rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-archive:hover,
.share-copy:hover,
.share-cancel:hover {
    color: #e0e0e0;
}

.share-archive svg,
.share-copy svg,
.share-cancel svg {
    width: 20px;
    height: 20px;
}

.share-card.dragging {
    opacity: 0.4;
}

.share-card.uploading {
    border-color: #333;
    border-style: dashed;
}

.share-card.uploading .share-upload-bar {
    height: 3px;
    background: #1a1a1a;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.share-card.uploading .share-upload-bar-fill {
    height: 100%;
    background: #555;
    transition: width 0.2s ease;
    width: 0%;
}

.upload-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #666;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.add-button {
    z-index: 10;
}

.settings-icon {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top, 0px));
    right: 1rem;
    z-index: 1;
}

.archived-section {
    width: 25%;
    padding-left: 0.5rem;
    height: 0;
    transition: height 0.3s ease;
    position: fixed;
    bottom: 2.5rem;
    left: 0;
    z-index: 11;
    display: none;
}

.archived-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem 0;
    color: #666;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    background: transparent;
    border: none;
    user-select: none;
    position: relative;
    z-index: 2;
    width: 50%;
    transition: color 0.2s ease;
}

.archived-header span {
    transform: translateY(-3px);
}

.archived-header:hover {
    color: #999;
}

.archived-list {
    flex: 1;
    overflow-y: auto;
    transition: opacity 0.45s ease;
    opacity: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #333 #1a1a1a;
}

.archived-list:empty {
    display: none;
}

.archived-list.collapsed {
    opacity: 0;
    pointer-events: none;
}

.archived-list::-webkit-scrollbar {
    width: 8px;
}

.archived-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.archived-list::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 4px;
}

.archived-card {
    background: transparent;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
    position: relative;
}

.archived-card-row {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.archived-card-name {
    flex: 1;
    font-size: 0.85rem;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-mask-image: linear-gradient(
        to right,
        black 0%,
        black 85%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        black 0%,
        black 85%,
        transparent 100%
    );
    min-width: 0;
    user-select: text;
    -webkit-user-select: text;
}

.archived-card-action {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.2rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.archived-card-action:hover {
    color: #e0e0e0;
}

.archived-card-action svg {
    width: 18px;
    height: 18px;
}

.archived-card-restore {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.archived-card-restore:hover {
    color: #e0e0e0;
}

.archived-card-restore svg {
    width: 20px;
    height: 20px;
}

.warning-modal,
.expiry-modal,
.rename-modal {
    position: fixed;
    inset: 0;
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    background: rgba(0, 0, 0, 0.4);
    align-items: flex-end;
    justify-content: center;
}

.warning-modal.visible,
.expiry-modal.visible,
.rename-modal.visible {
    opacity: 1;
    pointer-events: all;
}

.warning-modal {
    z-index: 1003;
}
.expiry-modal {
    z-index: 1004;
}
.rename-modal {
    z-index: 1005;
}

.warning-modal-content,
.expiry-modal-content,
.rename-modal-content {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 16px;
    padding: 1.75rem;
    padding-bottom: calc(1.75rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)))
        scale(0.92);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    width: calc(100% - 2rem);
    max-width: 400px;
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.warning-modal.visible .warning-modal-content,
.expiry-modal.visible .expiry-modal-content,
.rename-modal.visible .rename-modal-content {
    transform: translateY(0) scale(1);
}

.expiry-modal-content {
    gap: 0.75rem;
}

.warning-modal-content,
.rename-modal-content {
    gap: 1rem;
}

.expiry-modal-content {
    max-width: 420px;
}

.warning-modal-title {
    font-size: 1rem;
    font-weight: 500;
    color: #e0e0e0;
}

.warning-modal-text {
    font-size: 0.9rem;
    color: #999;
    line-height: 1.5;
}

.warning-modal-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
    align-self: flex-end;
    min-width: 80px;
}

.warning-modal-btn:hover {
    background: #252525;
    border-color: #555;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        backdrop-filter 0.3s ease,
        background 0.3s ease;
    backdrop-filter: blur(0);
    background: rgba(0, 0, 0, 0);
    max-height: 100%;
    overflow-y: auto;
}

.settings-overlay.visible {
    opacity: 1;
    pointer-events: all;
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.2);
}

.settings-box {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.settings-content {
    color: #999;
    font-size: 0.9rem;
    max-height: 100%;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 1.25rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

.settings-section-title.plain {
    text-transform: none;
    letter-spacing: normal;
}

.userhash-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.userhash-input-row input {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.userhash-input-row input:focus {
    border-color: #555;
}

.userhash-input-row input::placeholder {
    color: #555;
}

.userhash-tooltip {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.5;
    display: none;
}

.userhash-tooltip.visible {
    display: block;
}

.userhash-tooltip a {
    color: #888;
    text-decoration: underline;
    text-decoration-color: #444;
    transition: color 0.2s ease;
}

.userhash-tooltip a:hover {
    color: #bbb;
    text-decoration-color: #777;
}

.default-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.default-option-btn {
    background: #111;
    border: 1px solid #333;
    color: #999;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.default-option-btn:hover {
    background: #1a1a1a;
    border-color: #555;
    color: #ccc;
}

.default-option-btn.selected {
    background: #1a1a1a;
    border-color: #666;
    color: #e0e0e0;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #e0e0e0;
    padding: 0.25rem 0;
}

.toggle-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
    flex-shrink: 0;
}

.toggle-row input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #666;
    border-radius: 50%;
    transition:
        left 0.2s ease,
        background 0.2s ease;
}

.toggle-row input[type="checkbox"]:checked {
    background: #2a2a2a;
    border-color: #555;
}

.toggle-row input[type="checkbox"]:checked::before {
    left: 18px;
    background: #e0e0e0;
}

.drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-overlay.visible {
    opacity: 1;
}

.drag-overlay-text {
    font-size: 1.5rem;
    font-weight: 300;
    color: #e0e0e0;
    border: 2px dashed #333;
    border-radius: 16px;
    padding: 2rem 3rem;
}

.drag-overlay.visible .drag-overlay-text {
    animation: dragPulse 1.5s ease-in-out infinite;
}

@keyframes dragPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 2rem 1rem 6rem;
    }

    .share-grid {
        grid-template-columns: 1fr;
    }

    .share-name {
        font-size: 1.05rem;
    }

    .share-archive,
    .share-copy {
        opacity: 1;
        pointer-events: all;
    }

    .archived-section {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 11;
        padding: 0 0 env(safe-area-inset-bottom, 0);
        height: 48px;
        overflow: hidden;
        transition: height 0.3s ease;
        display: flex;
        flex-direction: column-reverse;
    }

    .archived-section.expanded {
        height: 85vh;
        background: #0a0a0a;
        border-top-left-radius: 36px;
        border-top-right-radius: 36px;
        border-top: 1px solid #444;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    }

    .archived-header {
        width: 100%;
        justify-content: center;
        flex-shrink: 0;
        margin-top: -0.75rem;
    }

    .archived-section.expanded .archived-header {
        border-top: 1px solid transparent;
    }

    .archived-section.expanded .archived-header .arrow-icon {
        transform: rotate(-180deg);
    }

    .archived-list {
        overflow: hidden;
        max-height: none;
    }
}

@media (hover: none) and (pointer: coarse) {
    .add-button:hover {
        background: #1a1a1a;
        transform: none;
    }

    .settings-icon:hover {
        color: #e0e0e0;
        background: #000;
        transform: none;
    }

    .share-card:hover {
        border-color: #333;
    }

    .share-download {
        opacity: 1;
    }

    .share-download:hover {
        background: #1a1a1a;
        border-color: #333;
    }

    .archived-header:hover {
        color: #666;
    }

    .archived-card-restore:hover {
        color: #666;
    }

    .archived-card-action:hover {
        color: #666;
    }

    .warning-modal-btn:hover {
        background: #1a1a1a;
        border-color: #333;
    }

    .expiry-modal-option:hover {
        background: #1a1a1a;
        border-color: #333;
    }
}

.expiry-modal-title {
    font-size: 1rem;
    font-weight: 500;
    color: #e0e0e0;
}

.expiry-modal-subtitle {
    font-size: 0.8rem;
    color: #999;
    font-weight: 300;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-mask-image: linear-gradient(
        to right,
        black 0%,
        black 90%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        black 0%,
        black 90%,
        transparent 100%
    );
}

.expiry-modal-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.expiry-modal-option {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 0.7rem 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
    text-align: center;
}

.expiry-modal-option:hover {
    background: #252525;
    border-color: #555;
}

.expiry-modal-option:active {
    transform: scale(0.97);
}

.expiry-modal-option.full {
    grid-column: 1 / -1;
}

.rename-modal-title {
    font-size: 1rem;
    font-weight: 500;
    color: #e0e0e0;
}

.rename-modal-input {
    font-family: inherit;
    font-size: 1rem;
    color: #fff;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.65rem 0.75rem;
    outline: none;
    transition: border-color 0.2s ease;
    caret-color: #fff;
}

.rename-modal-input:focus {
    border-color: #555;
}

.rename-modal-input::placeholder {
    color: #555;
}

.rename-modal-buttons {
    display: flex;
    gap: 0.75rem;
}

.rename-btn {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.rename-btn:hover {
    background: #252525;
    border-color: #555;
}

.rename-btn.cancel {
    background: transparent;
    color: #999;
}

@media (max-width: 768px) {
    .rename-modal-input {
        font-size: 1.15rem;
        padding: 0.75rem;
    }
}

button:active {
    transform: scale(0.97);
}
