body {
    font-family: 'Arial', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    background-color: #1a1a1a;
    min-height: 100vh; /* Ensure the body can grow with content */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    color: #ffffff;
}

.header {
    text-align: center;
    margin-bottom: 20px; /* Add space below the header */
    padding: 20px; /* Add padding for the header */
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 100%;
    max-width: 600px; /* Fixed maximum width for better desktop appearance */
}

.container {
    text-align: center;
    max-width: 90%;
    width: 100%;
    padding: 16px 20px;
    background: #2d2d2d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #404040;
}

.main-title {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: #ffffff; /* White text for dark mode */
}

.tagline {
    font-size: 0.9em; /* Slightly smaller tagline */
    color: #00ff00; /* Bright green color for excellent visibility on black background */
    margin-bottom: 10px; /* Reduced margin */
    display: block; /* Ensure it's displayed */
    visibility: visible; /* Ensure it's visible */
}

.section {
    margin-bottom: 20px;
    padding: 24px 20px 20px;
}

.section p {
    word-wrap: break-word; /* Ensures long words break and wrap to the next line */
    overflow-wrap: break-word; /* Provides better support for modern browsers */
    white-space: pre-wrap; /* Preserves whitespace and wraps text */
}

textarea {
    width: 100%;
    height: 120px; /* Reduced height */
    margin-bottom: 10px; /* Reduced margin */
    padding: 8px; /* Reduced padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none; /* Disable resizing */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

/* Default button style (for index page) */
button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 5px;
}

button:hover {
    background-color: #0056b3;
}

/* 16px+ on inputs avoids iOS Safari zoom-on-focus while keeping pinch-zoom enabled */
.single-line-input,
textarea,
.single-line-textarea {
    font-size: 16px;
}

/* Specific style for redirect page buttons */
.redirect-button {
    background-color: #007bff;
    color: black;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 5px;
    font-weight: bold;
}

.redirect-button:hover {
    background-color: #0056b3;
}

.staircase {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the entire stack */
}

.staircase-item {
    margin-bottom: 5px; /* Reduced margin */
    width: 100%; /* Ensure inputs are responsive */
    max-width: 90%; /* Limit the width of inputs for better mobile appearance */
    box-sizing: border-box; /* Include padding and border in the element's total width */
}

.staircase-item:nth-child(1) {
    margin-left: 0;
}

.staircase-item:nth-child(2) {
    margin-left: 10px; /* Reduced indent */
}

.staircase-item:nth-child(3) {
    margin-left: 20px; /* Reduced indent */
}

.word-display {
    font-size: 0.8em; /* Smaller font size */
    color: #b0b0b0; /* Light grey for dark mode */
}

.word-item-0 {
    margin-left: 0;
}

.word-item-1 {
    margin-left: 20px; /* Indent second word */
}

.word-item-2 {
    margin-left: 40px; /* Indent third word */
}

/* Media query for larger screens */
@media (min-width: 768px) {
    .container {
        max-width: 600px; /* Fixed maximum width for better desktop appearance */
    }

    .staircase-item {
        max-width: 250px; /* Narrower inputs for desktop */
    }
}

.text-label {
    font-size: 1.2em; /* Slightly smaller than the main text */
    color: #b0b0b0; /* Light grey for dark mode */
    margin-bottom: 10px; /* Space between the label and the text */
}

.single-line-input {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #404040;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #3a3a3a;
    color: #ffffff;
}

.single-line-textarea {
    width: 100%;
    height: 60px; /* Tall enough to show a few lines of wrapped text */
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #404040;
    border-radius: 4px;
    box-sizing: border-box;
    resize: none; /* Disable resizing */
    overflow-y: hidden; /* Hide vertical scrollbar */
    background-color: #3a3a3a;
    color: #ffffff;
}

.logo-link {
    text-decoration: none; /* Remove underline */
    color: inherit; /* Inherit the color from the parent element */
}

.censored {
    background-color: black;
    color: black;
    padding: 0 5px;
    border-radius: 3px;
    cursor: pointer;
}

/* New interface styles */
.main-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 5px; /* Even smaller margin when no form is shown */
}

.action-button {
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 500;
    min-width: 140px;
}

.send-button {
    background-color: #007bff;
    color: white;
}

.send-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.send-button.active {
    background-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.retrieve-button {
    background-color: #007bff;
    color: white;
}

.retrieve-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.retrieve-button.active {
    background-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.form-container {
    margin-top: 10px; /* Reduced gap between buttons and form */
    padding: 20px;
    background-color: transparent;
    border-radius: 8px;
    border: none;
}

.form-instructions {
    font-size: 14px;
    color: #b0b0b0;
    margin-bottom: 15px;
    text-align: center;
    font-style: italic;
}

.submit-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.submit-button:hover {
    background-color: #0056b3;
}

/* Responsive design for buttons */
@media (max-width: 480px) {
    .main-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-button {
        min-width: auto;
        width: 100%;
    }

    body.redirect-page .redirect-actions .action-button {
        width: auto;
        min-width: 0;
        flex: 1 1 calc(50% - 8px);
    }
}

.error-page {
    justify-content: center;
    padding: clamp(16px, 4vw, 32px) 16px;
    box-sizing: border-box;
}

.error-page .container {
    padding: 20px 24px;
}

/* Result page: logo stack matches index (no extra top inset); copy blocks centered */
body.redirect-page {
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body.redirect-page .container {
    max-width: min(600px, 92vw);
    margin-top: 0;
}

body.redirect-page .container:first-of-type {
    margin-top: 0;
}

body.redirect-page .section:not(.redirect-actions) {
    text-align: center;
}

body.redirect-page .text-label {
    margin-bottom: 8px;
    text-align: center;
}

.redirect-body {
    text-align: center;
}

.redirect-section:not(.redirect-actions) {
    text-align: center;
}

.redirect-text-strong {
    color: #000000;
    font-weight: 600;
}

.redirect-text {
    color: #000000;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    margin: 0;
    text-align: center;
}

body.redirect-page .word-display {
    font-size: 0.8em;
    line-height: 1.45;
    color: #000000;
    margin-bottom: 8px;
    text-align: center;
}

.redirect-countdown {
    color: #000000;
    font-weight: 500;
    text-align: center;
    margin: 0;
}

.redirect-muted {
    color: #b0b0b0;
    margin-bottom: 1rem;
}

.redirect-actions {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.redirect-link {
    color: inherit;
    text-decoration: underline;
}
