/* CSS Variables for Theming */
/*
 * Design tokens. Every value below is checked against WCAG AA on the
 * surfaces it is used on (text ≥4.5:1, borders/focus ≥3:1), in both themes.
 * Use the -text tokens for colored text, the solid tokens (--primary-color,
 * --success-color, --danger-color, --warning-color) for fills behind white
 * text, and the -tint tokens for pale status backgrounds.
 */
:root {
    color-scheme: light;
    --primary-color: #2563eb;      /* fill behind white text: 5.17:1 */
    --primary-hover: #1d4ed8;
    --primary-text: #1d4ed8;       /* links, active tabs */
    --primary-tint: #eff6ff;
    --on-accent: #ffffff;
    --success-color: #047857;
    --success-hover: #065f46;
    --success-text: #047857;
    --success-tint: #ecfdf5;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --danger-text: #b91c1c;
    --danger-tint: #fef2f2;
    --warning-color: #b45309;
    --warning-text: #92400e;
    --warning-tint: #fffbeb;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #4b5563;
    --text-color: #111827;
    --border-color: #e5e7eb;       /* decorative dividers only */
    --border-strong: #6b7280;      /* form controls: ≥4.39:1 */
    --focus-ring: #2563eb;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
    /* Stacking order: raised < sticky < banner < dropdown < modal < toast < tooltip */
    --z-raised: 10;
    --z-sticky: 100;
    --z-banner: 200;
    --z-dropdown: 300;
    --z-modal: 1000;
    --z-toast: 1100;
    --z-tooltip: 1200;
}

[data-theme="dark"] {
    color-scheme: dark;
    --primary-text: #93c5fd;
    --primary-tint: #1e3a5f;
    --success-text: #6ee7b7;
    --success-tint: #064e3b;
    --danger-text: #fca5a5;
    --danger-tint: #7f1d1d;
    --warning-text: #fde68a;
    --warning-tint: #78350f;
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #b0b7c3;
    --text-muted: #b0b7c3;
    --text-color: #f9fafb;
    --border-color: #4b5563;
    --border-strong: #8b93a1;
    --focus-ring: #93c5fd;
    --card-bg: #1f2937;
    --input-bg: #111827;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* One visible focus indicator for every keyboard-focusable control */
:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.logo {
    width: 80px;
    height: 80px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* PWA install affordances (toggled by pwa.js) */
.install-app-btn[hidden],
.ios-install-hint[hidden] {
    display: none;
}

.ios-install-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.ios-install-hint-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.ios-install-hint-dismiss:hover {
    color: var(--text-primary);
}

.theme-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    width: 2.75rem;
    height: 2.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.theme-toggle:hover {
    border-color: var(--primary-color);
}

.theme-toggle-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-sticky);
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.theme-toggle-fixed:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

/* Upload Warning Banner */
.upload-warning-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-banner);
    background: var(--warning-tint);
    color: var(--warning-text);
    border-top: 2px solid var(--warning-color);
    padding: 0.625rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.875rem;
    animation: slideUp 0.2s var(--ease-out);
}

.upload-warning-banner.hidden {
    display: none;
}

.upload-warning-icon {
    display: inline-flex;
    flex-shrink: 0;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* User Menu */
.user-menu {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: var(--z-sticky);
}

.user-menu-trigger {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    color: var(--on-accent);
}

.user-menu-trigger:hover {
    background: var(--primary-hover);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.15s var(--ease-out), visibility 0.15s, transform 0.15s var(--ease-out);
    overflow: hidden;
    z-index: var(--z-dropdown);
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.user-menu-name {
    font-weight: 600;
    color: var(--primary-text);
    font-size: 0.875rem;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.75rem 1rem;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: left;
}

.user-menu-item:hover {
    background: var(--bg-tertiary);
}

.user-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.user-menu-logout:hover {
    background: var(--danger-tint);
    color: var(--danger-text);
}

.user-menu-logout:hover svg {
    color: var(--danger-text);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-list {
    display: flex;
    flex: 1;
    gap: 0.5rem;
}

.tab-button {
    flex: 1;
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--primary-text);
    background: var(--bg-tertiary);
}

.tab-button.active {
    color: var(--primary-text);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.drop-zone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.drop-zone-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary-text);
}

.drop-zone-icon svg {
    width: 56px;
    height: 56px;
}

/* Keyboard- and screen-reader-reachable alternative to clicking the zone */
.btn-browse {
    margin-top: 1.25rem;
    min-height: 44px;
    padding: 0.625rem 1.5rem;
    background: var(--primary-color);
    color: var(--on-accent);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-browse:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-browse:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.drop-zone h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.drop-zone p {
    color: var(--text-secondary);
}

/* File Preparation Spinner */
.file-preparation-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.file-preparation-spinner.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.preparing-text {
    color: var(--primary-text);
    font-weight: 600;
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Settings: a plain section inside the card, not a second card */
.settings {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.settings h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Collapsible Upload Settings */
.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: calc(100% + 1rem);
    min-height: 44px;
    margin: 0 -0.5rem;
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.settings-toggle:hover {
    background: var(--bg-tertiary);
}

.settings-toggle.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-toggle .chevron-icon {
    transition: transform 0.2s var(--ease-out);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.settings.collapsed h3 {
    margin-bottom: 0;
}

.settings.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

/* Collapsed content is removed (not just clipped) so its fields leave the tab order */
.settings.collapsed .settings-content {
    display: none;
}

.form-group {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

/* Inside a card a field group is a plain group with a divider, not another card */
.card .form-group {
    margin-bottom: 0;
    padding: 0.75rem 0;
    background: none;
    border: none;
    border-radius: 0;
}

.settings .form-group {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
}

.settings .form-group:last-child {
    border-bottom: none;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

/* Label with an inline help badge next to it */
.label-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.label-row label {
    margin-bottom: 0;
}

.label-row .tooltip {
    margin-left: 0.25rem;
}

.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 600;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: var(--transition);
}

/* Password wrapper for eye toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.password-toggle:hover {
    color: var(--primary-text);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.eye-icon,
.eye-off-icon {
    transition: var(--transition);
}

/* Hide number input spinners */
.form-group input[type="number"]::-webkit-inner-spin-button,
.form-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.form-group input:focus {
    border-color: var(--focus-ring);
}

.quick-select {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-strong);
    border-radius: calc(var(--radius) * 0.6);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: var(--transition);
    color: var(--text-primary);
}

.btn-small.active {
    border-color: var(--primary-color);
    background: var(--primary-tint);
    color: var(--primary-text);
}

.btn-small:hover {
    background: var(--primary-color);
    color: var(--on-accent);
    border-color: var(--primary-color);
}

.btn-small:active {
    opacity: 0.9;
}

.btn-small.btn-success {
    background: var(--success-color);
    color: var(--on-accent);
    border-color: var(--success-color);
}

.btn-small.btn-success:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
}

.btn-small.btn-danger {
    background: var(--danger-color);
    color: var(--on-accent);
    border-color: var(--danger-color);
}

.btn-small.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}

.btn-small.btn-danger-outline {
    background: transparent;
    color: var(--danger-text);
    border-color: var(--danger-color);
}

.btn-small.btn-danger-outline:hover {
    background: var(--danger-color);
    color: var(--on-accent);
    border-color: var(--danger-color);
}

.btn-small.btn-neutral {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-small.btn-neutral:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

/* Tooltip: a small "i" button; a transparent ::before extends its hit area to 44px */
.tooltip {
    cursor: help;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: none;
    background: var(--primary-color);
    color: var(--on-accent);
    border-radius: 50%;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
    transition: var(--transition);
    text-transform: none;
    font-style: italic;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

.tooltip:hover,
.tooltip:focus-visible {
    background: var(--primary-hover);
}

.tooltip:hover::after,
.tooltip:focus-visible::after,
.tooltip.is-open::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-style: normal;
    font-weight: normal;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}

/* Escape dismisses the popup (WCAG 1.4.13) until the pointer or focus leaves */
.tooltip.is-dismissed::after {
    display: none;
}

/* Progress */
.progress-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-header span {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

/* Full-width fill scaled from the left: animates on the compositor, not layout */
.progress-fill {
    height: 100%;
    width: 100%;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--ease-out);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--on-accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.btn-remove-file {
    width: 100%;
    min-height: 44px;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    margin-top: 1rem;
}

.btn-remove-file:hover {
    background: var(--bg-secondary);
    border-color: var(--danger-color);
}

.btn-cancel {
    width: 100%;
    min-height: 44px;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--danger-color);
    color: var(--on-accent);
    margin-top: 1rem;
}

.btn-cancel:hover {
    background: var(--danger-hover);
}

/* Results Section */
.results-section {
    animation: slideIn 0.2s var(--ease-out);
}

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

.success-header {
    text-align: center;
    margin-bottom: 2rem;
}

.success-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background: var(--success-color);
    color: var(--on-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

.result-item {
    margin-bottom: 1.5rem;
}

.result-item label,
.result-item .result-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.code-display,
.url-display {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.claim-code {
    flex: 1;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: bold;
    text-align: center;
    color: var(--primary-text);
    letter-spacing: 0.1em;
}

.url-input {
    flex: 1;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.btn-copy {
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
    position: relative;
}

.btn-copy:hover {
    background: var(--primary-tint);
    border-color: var(--primary-color);
}

.btn-copy.copied {
    background: var(--success-tint);
    border-color: var(--success-color);
}

/* Result Details */
.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.detail {
    text-align: center;
    min-width: 0; /* Allow flex items to shrink below content size */
}

.detail-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail span:last-child {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* QR Code */
.qr-section {
    text-align: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

.qr-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.qr-code {
    display: inline-block;
    padding: 1.5rem;
    background: white; /* QR codes need a white quiet zone in both themes */
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.qr-code .qr-unavailable {
    padding: 2rem;
    color: #4b5563; /* fixed: the QR surface is white in both themes */
}

.qr-hint {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Share Button Styles */
.btn-link-small {
    background: none;
    border: none;
    color: var(--primary-text);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.5rem;
    min-height: 44px;
    margin-top: 0.75rem;
    text-decoration: underline;
    transition: var(--transition);
}

.btn-link-small:hover {
    color: var(--text-primary);
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    margin-top: 1.5rem;
    min-height: 44px;
    background: transparent;
    color: var(--primary-text);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    max-width: 200px;
}

.btn-share:hover {
    background: var(--primary-color);
    color: var(--on-accent);
}

.btn-share svg {
    flex-shrink: 0;
}

/* Share Modal */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 1rem;
    animation: fadeIn 0.2s var(--ease-out);
}

.share-modal.hidden {
    display: none;
}

.share-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.2s var(--ease-out);
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.share-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.share-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.share-modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.share-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.share-option svg {
    flex-shrink: 0;
    color: var(--primary-text);
}

.share-option-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.share-option-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.share-option-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

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

/* Mobile responsiveness for share modal */
@media (max-width: 768px) {
    .btn-share {
        width: 100%;
        max-width: 200px;
    }

    .share-modal-content {
        max-width: 100%;
    }

    .share-option {
        padding: 0.875rem;
    }
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

footer a {
    color: var(--primary-text);
    text-decoration: underline;
}

footer a:hover {
    text-decoration-thickness: 2px;
}

footer .version-info {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Pickup Section */
.claim-code-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    font-family: 'Courier New', monospace;
    text-align: center;
    letter-spacing: 0.1em;
    font-weight: 600;
    background: var(--input-bg);
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: var(--transition);
}

.claim-code-input::placeholder {
    text-transform: none;
    font-weight: normal;
    color: var(--text-secondary);
}

.claim-code-input:focus {
    border-color: var(--focus-ring);
}

.file-info-section {
    margin-top: 2rem;
    animation: slideIn 0.2s var(--ease-out);
}

.info-header {
    text-align: center;
    margin-bottom: 2rem;
}

.info-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background: var(--primary-color);
    color: var(--on-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.file-details {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.file-details .detail {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.file-details .detail:last-child {
    border-bottom: none;
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

/* SHA256 Hash Display */
.sha256-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 70%;
}

.sha256-hash {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    background: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) * 0.75);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.sha256-hash:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

.btn-copy-sha256 {
    flex-shrink: 0;
    padding: 0.625rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-strong);
    border-radius: calc(var(--radius) * 0.75);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
}

.btn-copy-sha256:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-accent);
}

.btn-copy-sha256.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--on-accent);
}

.btn-copy-sha256 svg {
    width: 16px;
    height: 16px;
}

.sha256-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0.375rem 0 0;
}

.warning-box {
    padding: 1rem 1.5rem;
    background: var(--danger-tint);
    border: 2px solid var(--danger-color);
    border-radius: var(--radius);
    color: var(--danger-text);
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Informational callout (e.g. resume-download prompt) */
.info-box {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    margin: 1rem 0;
}

.info-box.warning {
    background: var(--warning-tint);
    border-color: var(--warning-color);
    color: var(--warning-text);
}

.info-box .button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.info-box .button-group .btn-primary,
.info-box .button-group .btn-secondary {
    width: auto;
    flex: 1;
}

.btn-large {
    font-size: 1.25rem;
    padding: 1.25rem;
    font-weight: 600;
}

/* User Status Bar */
/* Old user status bar styles removed - replaced with user menu */

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    min-width: 300px;
    max-width: 400px;
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--on-accent);
    cursor: pointer;
    animation: toastSlideIn 0.25s var(--ease-out);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Toast Types: solid fills from the shared tokens (white text >= 4.5:1) */
.toast-info {
    background: var(--primary-color);
}

.toast-success {
    background: var(--success-color);
}

.toast-error {
    background: var(--danger-color);
}

.toast-warning {
    background: var(--warning-color);
}

/* Toast Animations */
@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-exit {
    animation: toastFadeOut 0.25s var(--ease-out) forwards;
}

@keyframes toastFadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.inline-icon {
    vertical-align: -3px;
    margin-right: 0.375rem;
}

/* Responsive */
@media (max-width: 640px) {
    header h1 {
        font-size: 2rem;
    }

    .container {
        padding: 1rem 0.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .drop-zone h2 {
        font-size: 1.25rem;
    }

    .result-details {
        grid-template-columns: 1fr;
    }

    .user-menu {
        top: 1rem;
        left: 1rem;
    }

    .user-menu-trigger {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
    }

    .theme-toggle-fixed {
        top: 10px;
        right: 10px;
    }

    .user-menu-dropdown {
        min-width: 180px;
        left: 0;
    }

    /* Toast mobile styles */
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }

    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .theme-toggle-fixed {
        top: 8px;
        right: 8px;
    }

    .user-menu {
        top: 8px;
        left: 8px;
    }

    .user-menu-trigger {
        width: 2rem;
        height: 2rem;
    }

    .user-menu-trigger svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================
   Upload result notes and recent uploads list
   ============================================ */

.result-note {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--warning-tint);
    color: var(--warning-text);
    font-size: 0.9rem;
    line-height: 1.5;
}

.result-dashboard-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 0.5rem;
    color: var(--primary-text);
    font-weight: 500;
    text-decoration: underline;
}

.recent-uploads {
    margin-top: 1.5rem;
}

.recent-uploads-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.recent-uploads-header h2 {
    font-size: 1.125rem;
    margin: 0;
}

.recent-uploads-header .btn-link-small {
    margin-top: 0;
}

.recent-uploads-header h2:focus {
    outline: none;
}

.recent-uploads-header h2:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.recent-uploads-hint {
    margin: 0.25rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

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

.recent-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "info code"
        "actions actions";
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 0.875rem 0;
    border-top: 1px solid var(--border-color);
}

.recent-upload-info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.recent-upload-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-upload-meta {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.recent-upload-code {
    grid-area: code;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.recent-upload-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recent-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 44px;
    padding: 0 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.recent-upload-btn:hover {
    background: var(--bg-tertiary);
}

.recent-upload-remove {
    margin-left: auto;
    color: var(--danger-text);
}

@media (max-width: 480px) {
    .recent-uploads-header {
        flex-wrap: wrap;
    }

    .recent-upload {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "info"
            "code"
            "actions";
    }

    .recent-upload-code {
        justify-self: start;
    }
}

/* ===== E2E Encryption Toggle ===== */

.e2e-encryption-group .e2e-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.e2e-toggle-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--success-color);
    cursor: pointer;
}

.e2e-toggle-text {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.e2e-lock-icon {
    color: var(--success-text);
}

.e2e-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 1.6rem;
}

.e2e-size-warning {
    font-size: 0.8125rem;
    color: var(--warning-text);
    margin: 0.5rem 0 0 1.6rem;
    padding: 0.4rem 0.6rem;
    background: var(--warning-tint);
    border-radius: 4px;
}

.e2e-suboption {
    margin: 0.6rem 0 0 1.6rem;
    padding-left: 0.6rem;
    border-left: 2px solid var(--border-color);
}

.e2e-suboption .e2e-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
}

.e2e-suboption .e2e-description {
    margin: 0.25rem 0 0 1.6rem;
}

/* ===== E2E Key Prompt (Pickup Tab) ===== */

.e2e-key-section {
    background: var(--success-tint);
    border: 1px solid var(--success-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.e2e-key-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--success-text);
    margin-bottom: 0.5rem;
}

.e2e-key-icon {
    font-size: 1.1rem;
}

.e2e-key-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

.e2e-key-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: monospace;
    background: var(--input-bg);
    color: var(--text-primary);
    box-sizing: border-box;
}

.e2e-key-input:focus {
    border-color: var(--focus-ring);
}

.e2e-key-input::placeholder {
    color: var(--text-secondary);
    font-family: inherit;
}

/* ===== E2E Badge (Upload Success) ===== */

.e2e-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: var(--success-color);
    color: var(--on-accent);
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.5rem auto;
}

.e2e-warning {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--warning-text);
    text-align: center;
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--warning-tint);
    border: 2px solid var(--warning-color);
    border-radius: var(--radius);
}

/* ===== E2E Decryption Overlay ===== */

.e2e-decrypt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.e2e-decrypt-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.e2e-decrypt-icon {
    color: var(--success-text);
    margin-bottom: 1rem;
}

.e2e-decrypt-icon.error {
    color: var(--danger-text);
}

.e2e-decrypt-icon.success {
    color: var(--success-text);
}

.e2e-decrypt-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.e2e-decrypt-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.e2e-decrypt-progress {
    margin: 1rem 0;
}

.e2e-decrypt-error {
    color: var(--danger-text);
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.e2e-decrypt-password {
    margin: 1rem 0;
    text-align: left;
}

.e2e-decrypt-password label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.e2e-decrypt-password .password-wrapper {
    margin-bottom: 0.75rem;
}

.e2e-decrypt-card .btn-primary,
.e2e-decrypt-card .btn-secondary {
    margin-top: 1rem;
}

/* Respect reduced-motion preference (WCAG 2.3) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   Mobile / touch refinements
   ============================================ */

/* Invisible 44px hit area (WCAG 2.5.5) without enlarging the visual circle */
.user-menu-trigger {
    position: relative;
}

.user-menu-trigger::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
}

@media (max-width: 768px), (pointer: coarse) {
    .btn-small {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 0.875rem;
    }
}

@media (max-width: 480px) {
    .tab-button {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    .progress-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Keep tooltip popups inside the viewport on narrow screens */
    .tooltip:hover::after,
    .tooltip:focus-visible::after {
        left: 0;
        transform: none;
        max-width: min(260px, calc(100vw - 24px));
        white-space: normal;
    }
}

/* ============================================
   Small-viewport adaptations (public pages)
   ============================================ */

/* Icons that replace emoji inside buttons */
.btn-icon {
    flex-shrink: 0;
    vertical-align: -4px;
    margin-right: 0.5rem;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-primary);
}

.btn-copy svg {
    display: block;
}

.btn-copy.copied {
    color: var(--success-text);
}

.info-icon svg {
    display: block;
}

/* Rows: keep label and value apart; SHA-256 row wraps its hint to its own line */
.file-details .detail {
    gap: 1rem;
}

.file-details .detail span.detail-value {
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

.file-details .detail-label {
    flex-shrink: 0;
    margin-bottom: 0;
}

.file-details .detail-sha256 {
    flex-wrap: wrap;
    align-items: center;
}

.file-details .detail-sha256 .sha256-hint {
    flex: 1 1 100%;
    margin-top: 0.25rem;
}

/* Tap-friendly rows for plain checkboxes */
.checkbox-group {
    margin-top: 0.5rem;
}

.checkbox-row,
.e2e-toggle-label {
    min-height: 44px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    margin: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.tab-button {
    min-height: 44px;
}

footer a {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
}

/* Password fields: placeholder must not run under the eye button */
.password-wrapper input {
    padding-right: 3.25rem;
    text-overflow: ellipsis;
}

.password-wrapper input::placeholder {
    font-size: 0.9375rem;
    font-weight: 400;
}

.qr-code {
    max-width: 100%;
}

.qr-code canvas,
.qr-code img {
    max-width: 100%;
    height: auto !important;
}

@media (max-width: 768px) {
    .file-details {
        padding: 1rem;
    }

    .file-details .detail {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .file-details .detail-sha256 {
        flex-direction: column;
    }

    .sha256-container {
        max-width: 100%;
        width: 100%;
        align-items: flex-start;
    }

    .sha256-hash {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    /* Floating toggle scrolls with the page so it never covers content */
    .theme-toggle-fixed {
        position: absolute;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1.25rem;
    }

    .code-display,
    .url-display {
        gap: 0.375rem;
    }

    .claim-code {
        min-width: 0;
        padding: 0.75rem 0.5rem;
        font-size: 1rem;
        letter-spacing: 0.02em;
        overflow-wrap: anywhere;
    }

    .qr-section {
        padding: 1.25rem 0.75rem;
    }

    .qr-code {
        padding: 0.75rem;
    }

    .claim-code-input {
        padding: 1rem 0.75rem;
        letter-spacing: 0.05em;
    }

    .result-details {
        padding: 1rem;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    header {
        margin-bottom: 1.5rem;
    }
}

.url-input,
.claim-code {
    min-width: 0;
}
