:root {
    --primary-color: #312e81;
    /* Darkened from #4f46e5 for 7.1+ contrast */
    --primary-hover: #1e1b4b;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-muted: #374151;
    /* Darkened from #575e6a for 7:1 contrast */
    /* Improved contrast from #677180 to meet WCAG AA (4.5:1) */
    --border-color: #e5e7eb;
    --error-bg: #fff1f2;
    --error-border: #fecaca;
    --error-color: #A01818;
    /* Darkened from #dc2626 for 7:1 contrast */
    /* Improved contrast from #ef4444 */
    --error-color-dark: #7f1d1d;
    --success-color: #076445;
    /* Darkened from #059669 for 7:1 contrast */
    /* Improved contrast from #10b981 */
    --success-color-hover: #065138;
    --content-width: 600px;
}

* {
    line-height: 1.5;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    padding: 0 16px;
    margin: 0;
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Enhanced Focus Visibility */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

input:focus-visible {
    outline-offset: 0;
}

/* Utility class to hide elements on mobile */
.hidden--mobile {
    display: none;
}

@media screen and (min-width: 600px) {
    .hidden--mobile {
        display: block;
    }
}

/* Logo */
.logo {
    margin-block: 1rem;
}

/* Container */
.container {
    background-color: var(--card-bg);
    padding: clamp(3vw, 2.5rem, 16px);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: var(--content-width);
    text-align: center;
    transition: transform 0.2s;
    box-sizing: border-box;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #4f46e5, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    -o-hyphens: auto;
}

.header__text {
    color: var(--text-muted);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

@media screen and (min-width: 600px) {
    .header__text {
        flex-direction: row;
    }
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    justify-content: center;
    flex-direction: column;
}

@media screen and (min-width: 600px) {
    .input-group {
        flex-direction: row;
    }
}

input[type="url"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    min-height: 44px;
    box-sizing: border-box;
}

input[type="url"]:focus {
    border-color: var(--primary-color);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    min-height: 44px;
}

button:hover {
    background-color: var(--primary-hover);
}

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

.result-container {
    margin-top: 1.5rem;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.result-container p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    margin-top: 0;
    text-align: left;
}

.short-url-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.short-url-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.short-url-box a:hover {
    text-decoration: underline;
}

.copy-btn {
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: 4px;
}

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

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

.success a {
    color: var(--success-color);
}

.hidden {
    display: none;
}

.error-message {
    color: var(--error-color);
    margin-top: 1rem;
    font-size: 0.9rem;
}

footer {
    font-size: 0.8rem;
    color: var(--text-color);
}

.skip-link,
.policies {
    text-align: center;
    font-size: 12px;
    color: var(--text-color);
    margin-top: 56px;
    width: var(--content-width);
    max-width: 100%;
}

.skip-link {
    position: absolute;
    top: 0;
    margin: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
}

details {
    font-size: 12px;
    padding-block: 8px;
}

a {
    color: inherit;
}

.report-container {
    margin-top: 1.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--error-bg);
    border-radius: 8px;
    border: 1px solid var(--error-border);
    text-align: left;
}

.report-box:not(.hidden) {
    display: flex;
    gap: 10px;
    flex-direction: column;
    margin-top: 16px;
    align-items: center;
}

@media screen and (min-width: 600px) {
    .report-box:not(.hidden) {
        flex-direction: row;
    }
}

.report-box:not(.hidden) label {
    font-size: 0.875rem;
    color: var(--error-color);
    margin-block: 0;
    font-weight: 600;
}

.report-box:not(.hidden) input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--error-border);
    border-radius: 6px;
    font-size: 0.875rem;
    min-height: 44px;
    box-sizing: border-box;
}

.report-box:not(.hidden) button {
    padding: 8px 16px;
    font-size: 0.875rem;
    background-color: var(--error-color);
}

.report-box:not(.hidden) button:hover {
    background-color: var(--error-color-dark);
}

.report-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--error-color);
    margin-block: 0;
}

.report-text button {
    padding: 0;
    color: inherit;
    background-color: transparent;
    text-decoration: underline;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-weight: 600;
    font-size: inherit;
}

.report-text button:hover {
    background-color: transparent;
    text-decoration: underline;
    color: var(--error-color-dark);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(100px);
    opacity: 0;
}

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

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

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