/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b69 50%, #000000 100%);
    min-height: 100vh;
    color: #e5e5e5;
    overflow-x: hidden;
}

/* App Container */
#app {
    position: relative;
    min-height: 100vh;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    /* transform: translateY(20px); */
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Loading Screen */
#loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b69 50%, #000000 100%);
}

.loading-content {
    text-align: center;
    color: #e5e5e5;
}

.logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Headers */
.app-header {
    text-align: center;
    color: #e5e5e5;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
}

.app-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.app-header a {
    color: inherit
}

.screen-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    color: #e5e5e5;
    position: relative;
}

.screen-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.btn-back {
    background: rgba(139, 92, 246, 0.3);
    border: none;
    color: #e5e5e5;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    position: absolute;
    left: 0;
}

.btn-back:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Buttons */
.btn {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 56px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: #e5e5e5;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #e5e5e5;
    border: 1px solid #8b5cf6;
}

.btn-secondary {
    background: #1f1f1f;
    color: #8b5cf6;
    border: 2px solid #8b5cf6;
}

.btn-secondary:hover {
    background: #8b5cf6;
    color: #e5e5e5;
}

.btn-tertiary {
    background: #1f1f1f;
    color: #10b981;
    border: 2px solid #10b981;
}

.btn-tertiary:hover {
    background: #10b981;
    color: #e5e5e5;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: auto;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 2rem 0;
}

/* Join Session Section */
.join-session-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.join-label {
    color: #e5e5e5;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

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

.join-code-input {
    flex: 1;
    padding: 16px;
    border: 2px solid #444;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: #2a2a2a;
    color: #e5e5e5;
    transition: all 0.2s ease;
}

.join-code-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #1f1f1f;
}

.join-code-input::placeholder {
    color: #666;
    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
}

.join-btn {
    min-width: 100px;
    flex-shrink: 0;
}

/* Last Session Section */
.last-session-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #444;
}

.last-session-section.hidden {
    display: none;
}

/* No match message for modal */
.no-match-message {
    padding: 20px;
    text-align: center;
    color: #b0b0b0;
    font-style: italic;
    background: #1f1f1f;
    border-radius: 8px;
    border: 1px solid #444;
}

/* Generating spinner for create session */
.generating-spinner {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.generating-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 92, 246, 0.3);
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Info Section */
.info-section {
    background: rgba(42, 42, 42, 0.95);
    padding: 24px;
    border-radius: 16px;
    margin-top: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid #444;
}

.info-section p {
    margin-bottom: 0.5rem;
}

.info-section h3 {
    color: #8b5cf6;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.info-section ol {
    list-style: none;
    counter-reset: step-counter;
}

.info-section li {
    counter-increment: step-counter;
    margin-bottom: 12px;
    padding-left: 40px;
    position: relative;
    line-height: 1.5;
}

.info-section li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: #8b5cf6;
    color: #e5e5e5;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Session Setup */
.session-setup {
    background: rgba(42, 42, 42, 0.95);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    flex: 1;
    border: 1px solid #444;
}

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #444;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.step.active {
    background: #8b5cf6;
    color: #e5e5e5;
}

.step-line {
    width: 60px;
    height: 2px;
    background: #444;
    margin: 0 16px;
}

.setup-step {
    text-align: center;
}

.setup-step.hidden {
    display: none;
}

.setup-step h3 {
    color: #8b5cf6;
    margin-bottom: 16px;
    font-size: 1.3rem;
}

.setup-step p {
    margin-bottom: 24px;
    color: #b0b0b0;
    line-height: 1.6;
}

/* Code Display and Input */
.code-display, .code-input {
    display: flex;
    gap: 12px;
    margin: 24px 0;
    align-items: center;
}

.code-display input, .code-input input {
    flex: 1;
    padding: 16px;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: #2a2a2a;
    color: #e5e5e5;
}

.code-display input:focus, .code-input input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #1f1f1f;
}

.help-text {
    font-size: 0.9rem;
    color: #b0b0b0;
    margin-top: 12px;
}

/* QR Code Section */
.qr-code-section {
    margin: 2rem 0;
    text-align: center;
}

.qr-code-section h4 {
    color: #8b5cf6;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.qr-code-container img {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid #444;
}

/* Waiting Section */
.waiting-section {
    margin-top: 2rem;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 12px;
    border: 2px solid #444;
}

.waiting-section h4 {
    color: #8b5cf6;
    margin-bottom: 16px;
}

.partner-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fbbf24;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #10b981;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #e5e5e5;
}

/* Activity Categories */
.activity-intro {
    text-align: center;
    margin-bottom: 2rem;
    color: #e5e5e5;
}

.activity-intro p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.activity-categories {
    background: rgba(42, 42, 42, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
    border: 1px solid #444;
}

.activity-category {
    margin-bottom: 2rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #444;
}

.category-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e5e5e5;
}

.category-items {
    display: grid;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #1f1f1f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.activity-item:hover {
    background: #2a2a2a;
    transform: translateY(-1px);
}

.activity-item.selected {
    background: #2d1b69;
    border-color: #8b5cf6;
}

.activity-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #666;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.activity-checkbox .checkmark {
    visibility: hidden;
}

.activity-item.selected .activity-checkbox {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #e5e5e5;
}

.activity-item.selected .activity-checkbox .checkmark {
    visibility: visible;
}
.activity-label {
    flex: 1;
    font-weight: 500;
    color: #e5e5e5;
}

/* Common Activities - Read-only styles */
.activity-item.readonly {
    cursor: default;
    background: #1a2e1a;
    border-color: #10b981;
}

.activity-item.readonly:hover {
    background: #1a2e1a;
    transform: none;
}

.activity-item.readonly .activity-checkbox {
    background: #10b981;
    border-color: #10b981;
    color: #e5e5e5;
}

.activity-item.readonly .activity-label {
    color: #10b981;
}

/* Slider Components */
.slider-item {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
}

.slider-container {
    margin-top: 12px;
}

.activity-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #444;
    outline: none;
    margin-bottom: 12px;
    -webkit-appearance: none;
    appearance: none;
}

.activity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    border: 2px solid #e5e5e5;
    transition: all 0.2s ease;
}

.activity-slider::-webkit-slider-thumb:hover {
    background: #7c3aed;
    transform: scale(1.1);
}

.activity-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    border: 2px solid #e5e5e5;
    transition: all 0.2s ease;
}

.activity-slider::-moz-range-thumb:hover {
    background: #7c3aed;
    transform: scale(1.1);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.slider-label {
    font-size: 0.8rem;
    color: #b0b0b0;
    text-align: center;
    padding: 4px 8px;
    border-radius: 4px;
    background: #1f1f1f;
    border: 1px solid #444;
    transition: all 0.2s ease;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.slider-label.active {
    color: #8b5cf6;
    background: #2d1b69;
    border-color: #8b5cf6;
    font-weight: 600;
}

.slider-label:hover {
    background: #2a2a2a;
    border-color: #666;
}

.slider-label.active:hover {
    background: #2d1b69;
    border-color: #8b5cf6;
}

/* Common Level Display */
.common-level {
    margin-top: 8px;
}

.level-indicator {
    display: inline-block;
    padding: 4px 12px;
    background: #1a2e1a;
    color: #10b981;
    border: 1px solid #10b981;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Selection Summary */
.selection-summary {
    text-align: center;
    color: #e5e5e5;
    margin-bottom: 1rem;
}

.selection-summary p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Waiting Screen */
.waiting-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #e5e5e5;
    flex: 1;
}

.waiting-animation {
    position: relative;
    margin-bottom: 2rem;
}

.pulse-circle {
    width: 120px;
    height: 120px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.waiting-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.waiting-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.waiting-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

/* Results Screen */
.results-content {
    background: rgba(42, 42, 42, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    flex: 1;
    border: 1px solid #444;
}

.match-summary {
    text-align: center;
    margin-bottom: 2rem;
}

.match-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.match-count span:first-child {
    font-size: 3rem;
    font-weight: 700;
    color: #10b981;
}

.match-count span:last-child {
    font-size: 1.1rem;
    color: #b0b0b0;
    font-weight: 500;
}

.matched-activities {
    margin-bottom: 2rem;
}

.matched-activity {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #1a2e1a;
    border: 2px solid #10b981;
    border-radius: 12px;
    margin-bottom: 12px;
}

.match-icon {
    font-size: 1.5rem;
}

.match-details {
    flex: 1;
}

.match-activity {
    font-weight: 600;
    color: #10b981;
    margin-bottom: 4px;
}

.match-category {
    font-size: 0.9rem;
    color: #059669;
    opacity: 0.8;
}

.no-matches {
    text-align: center;
    padding: 2rem;
}

.no-matches-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-matches h3 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.no-matches p {
    color: #b0b0b0;
    line-height: 1.6;
}

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

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #2a2a2a;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #444;
}

.modal-header h3 {
    color: #e5e5e5;
    font-size: 1.3rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #b0b0b0;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.btn-close:hover {
    background: #444;
}

.modal-body {
    padding: 24px;
}

.selections-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.selection-column h4 {
    color: #e5e5e5;
    margin-bottom: 16px;
    text-align: center;
}

.selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selection-item {
    padding: 12px;
    background: #1f1f1f;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #e5e5e5;
}

.selection-item.matched {
    background: #1a2e1a;
    border: 1px solid #10b981;
    color: #10b981;
}

/* Modal Activity Structure */
.modal-activity-category {
    margin-bottom: 1.5rem;
}

.modal-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #444;
}

.modal-category-title {
    font-size: 1rem;
    font-weight: 600;
    color: #e5e5e5;
}

.modal-category-items {
    display: grid;
    gap: 8px;
}

.modal-activity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #1f1f1f;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.modal-activity-item.selected {
    background: #2d1b69;
    border-color: #8b5cf6;
}

.modal-activity-item.matched {
    background: #1a2e1a;
    border-color: #10b981;
    color: #10b981;
}

.modal-activity-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid #666;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.modal-activity-item.selected .modal-activity-checkbox {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #e5e5e5;
}

.modal-activity-item.matched .modal-activity-checkbox {
    background: #10b981;
    border-color: #10b981;
    color: #e5e5e5;
}

.modal-activity-label {
    flex: 1;
    color: #e5e5e5;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    transition: all 0.3s ease;
    max-width: 400px;
    width: calc(100% - 40px);
    border: 1px solid #444;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: #e5e5e5;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #b0b0b0;
    cursor: pointer;
    margin-left: auto;
}

#error-toast .toast-content {
    border-left: 4px solid #ef4444;
}

#success-toast .toast-content {
    border-left: 4px solid #10b981;
}

/* Terms and Conditions Modal */
.terms-content {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 2rem;
}

.terms-placeholder {
    background: #1f1f1f;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.terms-placeholder h4 {
    color: #8b5cf6;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.terms-placeholder h5 {
    color: #e5e5e5;
    margin: 16px 0 8px 0;
    font-size: 1rem;
}

.terms-placeholder p {
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: 12px;
}

.terms-placeholder em {
    color: #fbbf24;
    font-style: italic;
}

.terms-placeholder ul {
    margin-left: 20px;
    color: #e5e5e5;
}

.terms-placeholder li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.consent-section {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.consent-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.consent-checkbox-wrapper:last-child {
    margin-bottom: 0;
}

.consent-checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #8b5cf6;
    cursor: pointer;
}

.consent-checkbox-wrapper label {
    color: #e5e5e5;
    cursor: pointer;
    line-height: 1.5;
    font-size: 0.95rem;
}

.terms-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.terms-actions .btn {
    min-width: 120px;
}

/* Terms Link in Info Section */
.info-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #444;
    text-align: center;
}

.terms-link {
    color: #8b5cf6;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.terms-link:hover {
    color: #7c3aed;
    text-decoration: underline;
}

/* Coin Flip Confirmation Modal */
.coin-flip-explanation {
    text-align: center;
    margin-bottom: 2rem;
}

.coin-flip-explanation p {
    color: #e5e5e5;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.coin-flip-explanation p:last-child {
    color: #fbbf24;
    font-weight: 600;
}

.coin-flip-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

#agree-coin-flip-btn {
    min-width: 150px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .app-header h1 {
        font-size: 2rem;
    }

    .logo {
        font-size: 3rem;
    }

    .selections-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .code-display, .code-input {
        flex-direction: column;
    }

    .code-display input, .code-input input {
        width: 100%;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .container {
        padding: 12px;
    }

    .app-header {
        margin-bottom: 1.5rem;
    }

    .info-section {
        margin-top: 1rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .btn:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    }
}

/* Nickname and Role Preference Screen */
.profile-setup {
    background: rgba(42, 42, 42, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    flex: 1;
    border: 1px solid #444;
}

.nickname-section {
    margin-bottom: 2rem;
}

.input-label {
    display: block;
    color: #8b5cf6;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.nickname-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #444;
    border-radius: 12px;
    font-size: 1.1rem;
    background: #2a2a2a;
    color: #e5e5e5;
    transition: all 0.2s ease;
}

.nickname-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #1f1f1f;
}

.nickname-input::placeholder {
    color: #666;
}

.role-section h3 {
    color: #8b5cf6;
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.role-description {
    color: #b0b0b0;
    margin-bottom: 20px;
    line-height: 1.5;
}

.role-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2rem;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #1f1f1f;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-option:hover {
    background: #2a2a2a;
    transform: translateY(-1px);
}

.role-option.selected {
    background: #2d1b69;
    border-color: #8b5cf6;
}

.role-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.role-info {
    flex: 1;
}

.role-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e5e5e5;
    margin-bottom: 4px;
}

.role-desc {
    font-size: 0.9rem;
    color: #b0b0b0;
    line-height: 1.4;
}

.role-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #666;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.role-checkbox .checkmark {
    visibility: hidden;
}

.role-option.selected .role-checkbox {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #e5e5e5;
}

.role-option.selected .role-checkbox .checkmark {
    visibility: visible;
}

.second-preference {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #444;
}

.second-preference h4 {
    color: #8b5cf6;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.second-pref-desc {
    color: #b0b0b0;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.second-role-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.second-role-option {
    padding: 8px 16px;
    background: #1f1f1f;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #e5e5e5;
}

.second-role-option:hover {
    background: #2a2a2a;
    border-color: #666;
}

.second-role-option.selected {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #e5e5e5;
}

/* Handshake Result Screen */
.handshake-content {
    background: rgba(42, 42, 42, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    flex: 1;
    border: 1px solid #444;
}

.handshake-content > .hidden {
    display: none;
}

.handshake-result {
    text-align: center;
    margin-bottom: 2rem;
}

.handshake-result h3 {
    color: #8b5cf6;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.handshake-result p {
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: 12px;
}

.coin-flip-section {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background: #1a1a1a;
    border-radius: 12px;
    border: 2px solid #444;
}

.coin-flip-section h3 {
    color: #fbbf24;
    margin-bottom: 2rem;
}

.coin-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.coin {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: coinFlip 2s ease-in-out;
}

@keyframes coinFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(1800deg); }
    100% { transform: rotateY(1800deg); }
}

.coin-side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    backface-visibility: hidden;
}

.coin-side.heads {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a1a1a;
}

.coin-side.tails {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #e5e5e5;
    transform: rotateY(180deg);
}

.coin-result-text {
    color: #fbbf24;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1rem;
}

.final-roles {
    background: #1a2e1a;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 20px;
    margin: 2rem 0;
}

.final-roles h3 {
    color: #10b981;
    text-align: center;
    margin-bottom: 16px;
}

.role-assignment {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #059669;
}

.role-assignment:last-child {
    border-bottom: none;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-nickname {
    font-weight: 600;
    color: #e5e5e5;
}

.assigned-role {
    font-weight: 600;
    color: #10b981;
    text-transform: capitalize;
}

.role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.top {
    background: #ef4444;
    color: #e5e5e5;
}

.role-badge.btm {
    background: #059669;
    color: #e5e5e5;
}

/* Error state for handshake */
.handshake-error {
    background: #2d1b1b;
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 2rem 0;
}

.handshake-error h3 {
    color: #ef4444;
    margin-bottom: 12px;
}

.handshake-error p {
    color: #fca5a5;
    line-height: 1.6;
}

/* Responsive adjustments for new screens */
@media (max-width: 480px) {
    .role-options {
        gap: 8px;
    }

    .role-option {
        padding: 12px;
    }

    .role-icon {
        font-size: 1.5rem;
        width: 40px;
    }

    .second-role-options {
        flex-direction: column;
    }

    .coin {
        width: 80px;
        height: 80px;
    }

    .coin-side {
        font-size: 1.5rem;
    }
}