:root {
    --bg: #0f0f0f;
    --text: #e0e0e0;
    --text-bright: #ffffff;
    --text-dim: #a0a0a0;
    --link-bg: #1a1a1a;
    --link-bg-hover: #252525;
    --link-border: #2a2a2a;
    --accent: #f6c324;
}

[data-theme="light"] {
    --bg: #f0f0f0;
    --text: #1f1f1f;
    --text-bright: #000000;
    --text-dim: #5f5f5f;
    --link-bg: #e5e5e5;
    --link-bg-hover: #dadada;
    --link-border: #d5d5d5;
    --accent: #f6c324;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--link-bg);
    border: 0.0625rem solid var(--link-border);
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.01875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text);
    z-index: 10;
}

.theme-toggle:hover {
    background: var(--link-bg-hover);
    border-color: var(--accent);
    color: var(--text-bright);
}

input[type=number]::-webkit-inner-spin-button {
    cursor: pointer;
}

.container {
    width: 100%;
    max-width: 31.25rem;
    text-align: center;
}

.caesar-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.25rem;
    background: var(--bg);
    border-bottom: 0.0625rem solid var(--link-border);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo {
    color: var(--text);
    text-decoration: none;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -0.05em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.header-logo:hover {
    color: var(--accent);
}

.controls-section {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    
}

.control-group label {
    font-size: 0.875rem;
    color: var(--text-dim);
    text-align: left;
    font-weight: 500;
}

#shift-amount::-webkit-inner-spin-button,
#shift-amount::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#shift-amount {
    padding: 0.625rem;
    background: var(--link-bg);
    color: var(--text);
    border: 0.0625rem solid var(--link-border);
    border-radius: 0.375rem 0 0 0.375rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 6rem;
}

.number-control {
    display: flex;
    align-items: stretch;
}

.number-buttons {
    display: flex;
    flex-direction: column;
}

.number-buttons button {
    width: 1.75rem;
    flex: 1;
    border: 0.0625rem solid var(--link-border);
    background: var(--link-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    transition: background 0.2s;
}

.number-buttons button:first-child {
    border-radius: 0 0.375rem 0 0;
    border-bottom: none;
}

.number-buttons button:last-child {
    border-radius: 0 0 0.375rem 0;
}

.number-buttons button:hover {
    background: var(--link-bg-hover);
    border-color: var(--accent);
    color: var(--text-bright);
    box-shadow: 0 0 0.625rem rgba(246, 195, 36, 0.2);
}

.number-buttons button:active {
    background: var(--link-bg-hover);
}

#shift-amount:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0.5rem rgba(246, 195, 36, 0.2);
}

.direction-options {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border: 0.0625rem solid var(--link-border);
    background: var(--link-bg);
    color: var(--text);
    border-radius: 0.375rem;
}

.radio-label input[type="radio"] {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    pointer-events: none;
}

.radio-label:has(input[type="radio"]:checked) {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0.5rem rgba(246, 195, 36, 0.2);
    color: var(--accent);
}

.radio-label:hover {
    color: var(--accent);
}

.text-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.field-wrapper label {
    font-size: 0.875rem;
    color: var(--text-dim);
    font-weight: 500;
}

textarea {
    padding: 0.75rem;
    background: var(--bg);
    color: var(--text);
    border: 0.0625rem solid var(--link-border);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    resize: none;
    min-height: 8rem;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0.5rem rgba(246, 195, 36, 0.2);
}

#input-wrapper:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0.5rem rgba(246, 195, 36, 0.2);
    
}

textarea:read-only {
    background: var(--bg);
    cursor: not-allowed;
}

.execute-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--link-bg);
    color: var(--text);
    border: 0.0625rem solid var(--link-border);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.01875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.execute-btn:hover {
    background: var(--link-bg-hover);
    border-color: var(--accent);
    color: var(--text-bright);
    box-shadow: 0 0 0.625rem rgba(246, 195, 36, 0.2);
}

.execute-btn:active {
    transform: scale(0.98);
}

@media (max-width: 37.5rem) {
    body {
        padding: 1rem;
    }

    .container {
        max-width: 100%;
    }

    .description {
        margin-top: 5rem;
    }

    .controls-section {
        flex-direction: column;
        gap: 1rem;
    }

    .text-fields {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .control-group {
        width: 100%;
    }

    #shift-amount {
        width: 100%;
    }

    .direction-options {
        justify-content: center;
    }
}
