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

ol, ul {
    margin-left: 1.5em;
    list-style-position: outside;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.25em;
    padding-top: 2.5em;
}

.container {
    background: white;
    border-radius: 0.75em;
    box-shadow: 0 1.25em 3.75em rgba(0, 0, 0, 0.3);
    max-width: 37.5em;
    width: 100%;
    padding: 1.875em;
    display: flex;
    flex-direction: column;
}

h1 {
    color: #333;
    margin-bottom: 0.625em;
    text-align: center;
}

.landing-subtitle {
    text-align: center;
    color: #999;
    font-size: 0.875em;
    margin-bottom: 1.875em;
}

.landing-buttons {
    display: flex;
    gap: 0.9375em;
    margin-bottom: 1.5625em;
}

/* Reusable button classes */
.btn {
    border: none;
    border-radius: 0.375em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, outline 0.2s;
    padding: 0.75em 1em;
    font-size: 0.875em;
}

.btn:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-primary:focus-visible {
    outline: 0.25em solid #333;
    outline-offset: 0.125em;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 0.0625em solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-secondary:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-danger:focus-visible {
    outline: 0.25em solid #fff;
    outline-offset: 0.125em;
}

.btn-lg {
    padding: 0.9375em;
    font-size: 1em;
}

.btn-block {
    width: 100%;
    display: block;
}

.landing-btn {
    flex: 1;
}

.recent-rooms {
    margin-bottom: 1.5625em;
    padding: 1.25em;
    background-color: #f9f9f9;
    border-radius: 0.375em;
}

.recent-rooms h2 {
    font-size: 1em;
    margin-bottom: 0.75em;
    color: #333;
}

#recentRoomsList {
    list-style: disc;
    margin-top: 0.75em;
    margin-bottom: 0.75em;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

#recentRoomsList li {
    color: #666;
}

.recent-room-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.875em;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recent-room-link:hover {
    text-decoration: underline;
}

.recent-room-link .room-name {
    flex: 1;
}

.recent-room-link .room-date {
    color: #999;
    font-size: 0.8125em;
    margin-left: 0.75em;
}

.join-form-hidden {
    display: none;
}

.join-form-visible {
    display: block;
    margin-bottom: 1.25em;
    padding: 1.25em;
    background-color: #f9f9f9;
    border-radius: 0.375em;
}

.join-form-visible input {
    width: 100%;
    padding: 0.75em;
    border: 0.125em solid #e5e7eb;
    border-radius: 0.375em;
    font-size: 0.875em;
    margin-bottom: 0.9375em;
    font-family: monospace;
    text-transform: uppercase;
    transition: border-color 0.2s, outline 0.2s;
}

.join-form-visible input:focus {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
    border-color: #667eea;
}

.join-form-visible input:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

.form-buttons {
    display: flex;
    gap: 0.625em;
}

.generated-id-hidden {
    display: none;
}

.generated-id-visible {
    display: block;
    padding: 1.25em;
    background-color: #f0f7ff;
    border-radius: 0.375em;
    text-align: center;
}

.id-display {
    background-color: white;
    border: 0.125em dashed #667eea;
    padding: 0.9375em;
    border-radius: 0.375em;
    margin: 0.9375em 0;
    font-size: 1.25em;
    font-weight: bold;
    font-family: monospace;
    word-break: break-all;
    user-select: all;
}

.generated-id-visible button {
    margin: 0.3125em;
    padding: 0.625em 1.25em;
}

.landing-visible {
    display: block;
}

.landing-hidden {
    display: none;
}

.doc-page-hidden {
    display: none;
}

.doc-page-visible {
    display: block;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5625em;
    padding-bottom: 0.9375em;
    border-bottom: 0.125em solid #e5e7eb;
}

.doc-header h1 {
    margin: 0;
    cursor: pointer;
    padding: 0.25em 0.5em;
    border-radius: 0.1875em;
    transition: background-color 0.2s;
}

.doc-header h1:hover {
    background-color: #f0f0f0;
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.doc-id-display {
    font-size: 0.75em;
    color: #999;
    font-family: monospace;
}

.doc-id-display code {
    background-color: #f0f0f0;
    padding: 0.1875em 0.5em;
    border-radius: 0.1875em;
}

.user-name-display {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.75em;
    color: #666;
}

.user-name-display span {
    font-weight: 600;
    cursor: pointer;
    padding: 0.25em 0.375em;
    border-radius: 0.1875em;
    transition: background-color 0.2s;
}

.user-name-display span:hover {
    background-color: #f0f0f0;
}

.change-name-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 0.875em;
    padding: 0.125em 0.375em;
    border-radius: 0.1875em;
    transition: background-color 0.2s, outline 0.2s;
}

.change-name-btn:hover {
    background-color: #f0f0f0;
}

.change-name-btn:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

.exit-btn {
    background-color: #f0f0f0;
    color: #333;
    border: none;
    padding: 0.5em 1em;
    border-radius: 0.375em;
    font-size: 0.75em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.exit-btn:hover {
    background-color: #e0e0e0;
}

.input-group {
    display: flex;
    gap: 0.625em;
    margin-bottom: 1.5625em;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: 0.625em 0.9375em;
    border: 0.125em solid #e5e7eb;
    border-radius: 0.375em;
    font-size: 0.875em;
    transition: border-color 0.2s, outline 0.2s;
}

.input-group input:focus {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
    border-color: #667eea;
}

.input-group input:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

.message {
    position: fixed;
    top: 1.25em;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    max-width: 25em;
    padding: 0.75em 1.25em;
    border-radius: 0.375em;
    text-align: center;
    font-weight: 500;
    display: none;
    box-shadow: 0 0.25em 0.75em rgba(0, 0, 0, 0.15);
}

.message.success {
    display: block;
    background-color: #d1fae5;
    color: #065f46;
    border: 0.0625em solid #a7f3d0;
}

.message.error {
    display: block;
    background-color: #fee2e2;
    color: #991b1b;
    border: 0.0625em solid #fecaca;
}

.final-story-points-container {
    margin-bottom: 1.5625em;
}

.bar-chart-container {
    margin-bottom: 1.5625em;
}

.vote-list-container {
    margin-bottom: 0.9375em;
}

.vote-list-container h3 {
    color: #333;
    font-size: 1em;
    margin-bottom: 0.75em;
}

.value-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 0.75em;
    background-color: #f9fafb;
    border-left: 0.25em solid #667eea;
    margin-bottom: 0.375em;
    border-radius: 0.25em;
}

.value-item.no-vote {
    border-left-color: #d1d5db;
}

.value-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75em;
}

.value-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9375em;
    flex-shrink: 0;
}

.value-number {
    color: #667eea;
    font-size: 1em;
    font-weight: bold;
    text-align: right;
}

.empty-state {
    text-align: center;
    padding: 1.875em;
    color: #999;
}

/* Bar chart styling */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 1.25em;
    margin-bottom: 1.25em;
}

.chart-story-points {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25em;
    font-size: 1.125em;
    color: #667eea;
    padding: 1.5em;
    background-color: #f0f4ff;
    border-radius: 0.5em;
    cursor: pointer;
    border: 0.125em solid #667eea;
}

.chart-story-points:hover {
    background-color: #e8eef8;
}

.story-points-value {
    font-weight: bold;
    color: #667eea;
    font-size: 3em;
}

.vote-list {
    margin-top: 0.625em;
}

/* Modal styling */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.75em;
    padding: 1.875em;
    max-width: 25em;
    width: 90%;
    box-shadow: 0 1.25em 3.75em rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-content h2 {
    color: #333;
    margin-bottom: 1.25em;
    text-align: center;
}

.modal-content input {
    width: 100%;
    padding: 0.75em;
    border: 0.125em solid #e5e7eb;
    border-radius: 0.375em;
    font-size: 0.875em;
    margin-bottom: 1.25em;
    font-family: inherit;
    transition: border-color 0.2s, outline 0.2s;
}

.modal-content input:focus {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
    border-color: #667eea;
}

.modal-content input:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

.modal-content label {
    display: block;
    margin-bottom: 0.5em;
    color: #333;
    font-weight: 500;
}

.modal-content button {
    width: 100%;
}

.modal-buttons {
    display: flex;
    gap: 0.625em;
    margin-top: 1.25em;
}

.set-name-btn {
    flex: 1;
}

/* Points buttons styling */
.points-buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625em;
    flex: 1;
}

.points-button-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.points-radio {
    display: none;
}

.points-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625em 1em;
    border: 0.125em solid #e5e7eb;
    border-radius: 0.375em;
    background-color: white;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 3.125em;
}

.points-button:hover {
    border-color: #667eea;
    background-color: #f9f9f9;
}

.points-radio:checked + .points-button {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.points-radio:disabled + .points-button {
    cursor: not-allowed;
    background-color: #f5f5f5;
    color: #999;
    border-color: #d1d5db;
}

.points-radio:checked:disabled + .points-button {
    background-color: #a8b5d9;
    color: white;
    border-color: #a8b5d9;
}

.points-radio:focus-visible + .points-button {
    outline: 0.25em solid #667eea;
    outline-offset: 0.125em;
}

/* Slider styling */
.slider-container {
    display: flex;
    align-items: flex-start;
    gap: 0.625em;
}

.slider-label {
    font-size: 0.75em;
    color: #666;
    width: 3.125em;
}

.slider-label.left {
    text-align: left;
}

.slider-label.right {
    text-align: right;
}

.slider-input-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
    justify-content: flex-start;
}

.slider-input {
    width: 100%;
    height: 0.375em;
    cursor: pointer;
    margin: 0.1875em 0;
    transition: outline 0.2s;
}

.slider-input:focus {
    outline: 0.25em solid #667eea;
    outline-offset: 0.25em;
}

.slider-input:focus-visible {
    outline: 0.25em solid #667eea;
    outline-offset: 0.25em;
}

.slider-value {
    text-align: center;
    font-weight: 600;
    font-size: 0.875em;
    margin-top: -0.125em;
}

#roundingAffinityInput {
    margin-bottom: 0.1875em;
}

/* Info section styling */
.info-section h2 {
    margin-top: 1.875em;
    margin-bottom: 0.9375em;
}

.info-section h3 {
    margin-top: 1.5625em;
    margin-bottom: 0.9375em;
}

.info-section h4 {
    margin-top: 0.9375em;
    margin-bottom: 0.5em;
}

.info-section ol {
    margin-top: 0.9375em;
    margin-bottom: 1.25em;
}

.setting-item {
    margin-bottom: 0.9375em;
}

/* Calculation Modal Styles */
.calculation-modal {
    max-width: 37.5em;
    max-height: 80vh;
    overflow-y: auto;
}

.calculation-details {
    font-size: 0.875em;
    line-height: 1.6;
    color: #333;
}

.calc-section {
    margin-bottom: 1.5625em;
    padding-bottom: 1.25em;
    border-bottom: 0.0625em solid #e5e7eb;
}

.calc-section:last-of-type {
    border-bottom: none;
}

.calc-section h3 {
    color: #667eea;
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 0.75em;
}

.calc-value {
    font-weight: 600;
    color: #333;
    font-size: 0.9375em;
    word-break: break-all;
}

.calc-highlight {
    background-color: #fef3c7;
    padding: 0.125em 0.375em;
    border-radius: 0.1875em;
    font-weight: 600;
    color: #b45309;
}

.calc-highlight-large {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    text-align: center;
    padding: 1.25em 0;
}

.calculation-details p {
    margin-bottom: 0.75em;
}

.calculation-details ul {
    list-style: none;
    margin: 0.625em 0 0.75em 0;
    padding-left: 0;
}

.calculation-details li {
    margin-bottom: 0.5em;
    position: relative;
}

.calculation-details li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.final-result {
    background-color: #f3f4f6;
    padding: 1.25em;
    border-radius: 0.5em;
    text-align: center;
    border-bottom: none !important;
    margin-bottom: 0;
}

/* Modal close button */
.modal-close-btn {
    position: sticky;
    top: 0;
    right: 0;
    background: none !important;
    border: none !important;
    font-size: 1.75em;
    color: #999 !important;
    cursor: pointer;
    padding: 0 !important;
    width: 2em !important;
    height: 2em !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    margin-left: auto;
    z-index: 10;
}

.modal-close-btn:hover {
    color: #333 !important;
}

@media (max-width: 600px) {
    body {
        padding: 0.5em 0.125em;
    }

    h1 {
        font-size: 1.125em;
    }

    .logo {
        height: 2.5em !important;
        margin-right: 0.5em !important;
    }
}

@media (max-width: 440px) {
    .container {
        padding: 0.3125em;
        border-radius: 0.5em;
    }

    .join-form-visible, .recent-rooms {
        padding: 0.25em;
    }

    .points-buttons-group {
        gap: 0.4em;
    }

    .points-button {
        padding: 0.15em 0.5em;
        min-width:2em;
    }

    ol, ul {
        margin-left: 1em;
    }
}

/* Keystroke match highlight for voting buttons */
.keystroke-match-highlight .points-button {
    background-color: #ffd700 !important;
    border-color: #ffa500 !important;
    box-shadow: 0 0 0.375em rgba(255, 165, 0, 0.4) !important;
    color: #333 !important;
}
