:root {
    --primary-color: #1a73e8;
    --background-color: #f9f4e8;
    --border-color: #2d3436;
    --text-color: #2d3436;
    --error-color: #e74c3c;
    --success-color: #27ae60;
}

* {
    box-sizing: border-box;
    font-family: 'Architects Daughter', cursive;
}

body {
    margin: 0;
    padding: 20px;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.input-group, .formula-section, .result-box, .confidence-interval {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    position: relative;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="text"], #formula-input {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    padding: 12px;
    border: 2px solid #2d3436;
    border-radius: 4px;
    background-color: white;
    width: 100%;
    margin: 4px 0;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

button {
    background-color: white;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    margin: 5px;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

.title-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}

.title-container h1 {
    text-align: center;
    margin: 0;
    font-size: 2.5em;
}

.help-icon {
    position: absolute;
    right: 0;
    color: var(--text-color);
    font-size: 1.5em;
    text-decoration: none;
}

.variable-name, .variable-value {
    flex: 1;
    min-width: 0; /* Allows flex items to shrink below content size */
}

.remove-variable {
    width: 40px;
    padding: 5px;
    flex-shrink: 0; /* Prevents the button from shrinking */
}

#add-variable {
    width: 100%;
    margin: 10px 0;
    background-color: white;
}

.calculate-button {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    font-size: 1.2em;
    margin: 20px 0;
    padding: 15px;
}

.results-section {
    margin-top: 30px;
}

.confidence-selector {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.radio-label {
    cursor: pointer;
    padding: 5px 10px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.loading-spinner {
    text-align: center;
    margin: 20px 0;
    font-size: 1.2em;
}

.loading-spinner i {
    margin-right: 10px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.formula-section {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
}

.formula-container {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
}

#formula-input {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

#formula-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

/* Share section styling */
.share-section {
    margin-top: 20px;
    text-align: center;
}

.share-url-container {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.share-url {
    flex-grow: 1;
}

/* Share buttons container */
.share-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    min-width: 180px; /* Set minimum width for the buttons container */
}

/* Style for both share buttons */
.share-buttons button {
    flex: 1;
    min-width: 85px; /* Ensure minimum width for each button */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 8px 16px;
}

/* X-specific styling */
#share-x {
    background-color: #000000;
    color: white;
    border: 2px solid #000000;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#share-x:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

#share-x::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 2%, rgba(255,255,255,0.1) 3%, transparent 4%);
    background-size: 8px 8px;
    pointer-events: none;
}

/* Copy confirmation styling */
.copy-confirmation {
    color: var(--success-color);
    display: none;
    margin-left: 10px;
    font-family: 'Architects Daughter', cursive;
}

/* Error styling */
.error {
    color: var(--error-color);
    margin: 5px 0;
    font-size: 0.9em;
}

/* Canvas styling */
#histogram {
    padding: 20px;
    margin: 20px 0;
}

canvas {
    width: 100%;
    height: 400px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    padding: 20px 10px 40px 10px; /* Extra padding at bottom for labels */
    margin-bottom: 20px;
}

/* Distribution title styling */
#histogram h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--text-color);
    font-family: 'Architects Daughter', cursive;
}

/* Responsive design */
@media (max-width: 600px) {
    .share-url-container {
        flex-direction: column;
    }
    
    .share-buttons {
        width: 100%;
        min-width: unset;
    }
    
    .share-buttons button {
        min-width: unset;
    }
}

/* Random question button styling */
.random-question-button {
    background-color: white;
    padding: 8px 15px;
    font-size: 0.9em;
}

.title-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.guesstimation-title {
    flex-grow: 1;
}

/* Reveal answer section styling */
.reveal-answer-section {
    margin-top: 20px;
    text-align: center;
}

.reveal-answer-button {
    background-color: white;
}

.answer-display {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

#interval-value {
    text-align: center;
    font-size: 2em;
    font-weight: bold;
    margin: 20px 0;
    color: var(--text-color);
}

/* Title input - larger size */
#guesstimation-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 20px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Formula input - slightly larger for better visibility */
#formula-input {
    font-size: 18px;
    padding: 15px;
    margin: 10px 0;
}

/* Variable input group - maintain layout but update fonts */
.input-group {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    align-items: center;
}

.input-group input {
    flex: 1;
    min-width: 0;
}

/* Keep sketchy font for other elements */
h1, h2, h3, label, button, .confidence-interval, #percentile-table {
    font-family: 'Architects Daughter', cursive;
}

/* Make error messages clear and readable */
.error-message {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #e74c3c;
    margin-top: 4px;
}

/* Keep the sketchy style for results and labels */
#interval-value, .distribution-title {
    font-family: 'Architects Daughter', cursive;
}

.tagline {
    text-align: center;
    color: var(--text-color);
    font-size: 1.2em;
    margin-bottom: 30px;
    opacity: 0.8;
    font-style: italic;
}