:root {
    --serif: 'Crimson Text', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --black: #0a0a0a;
    --white: #fefefe;
    --gray: #666;
    --light-gray: #e5e5e5;
    --accent: #ff4500;
    
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--serif);
    color: var(--black);
    background-color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
}

.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg) var(--space-md);
    max-width: 100vw;
}

.masthead {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.title {
    font-size: clamp(4rem, 15vw, 12rem);
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.02em;
    line-height: 0.85;
    margin-left: -0.05em;
    color: var(--black);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tagline {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 300;
    color: var(--gray);
    letter-spacing: 0.1em;
    text-transform: lowercase;
    margin-top: var(--space-md);
    opacity: 0.8;
}

.room-entry {
    margin-top: var(--space-xl);
    max-width: 32rem;
}

.room-input {
    width: 100%;
    font-family: var(--serif);
    font-size: 2.5rem;
    font-weight: 600;
    border: none;
    border-bottom: 2px solid var(--black);
    padding: var(--space-sm) 0;
    background: transparent;
    transition: border-color 0.2s ease;
}

.room-input::placeholder {
    color: var(--light-gray);
    font-style: italic;
}

.room-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.room-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.button {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--black);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(10, 10, 10, 0.1);
}

.button:hover {
    background: var(--black);
    color: var(--white);
}

.button-primary {
    background: var(--black);
    color: var(--white);
}

.button-primary:hover {
    background: var(--white);
    color: var(--black);
}

.estimation-chamber {
    min-height: 100vh;
    padding: var(--space-md);
    display: grid;
    grid-template-areas: 
        "header header"
        "participants content"
        "participants cards";
    grid-template-columns: 1fr 3fr;
    grid-template-rows: auto 1fr auto;
    gap: var(--space-md);
}

@media (max-width: 768px) {
    .landing {
        padding: var(--space-md) var(--space-sm);
    }
    
    .title {
        font-size: clamp(3rem, 12vw, 8rem);
        line-height: 0.8;
    }
    
    .tagline {
        font-size: 0.8rem;
        margin-top: var(--space-sm);
    }
    
    .room-entry {
        margin-top: var(--space-lg);
        max-width: 100%;
    }
    
    .room-input {
        font-size: 2rem;
    }
    
    .room-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .estimation-chamber {
        grid-template-areas: 
            "header"
            "participants"
            "content"
            "cards";
        grid-template-columns: 1fr;
        padding: var(--space-sm);
        gap: var(--space-sm);
    }
    
    .chamber-header {
        text-align: center;
    }
    
    .current-ticket {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .ticket-input {
        font-size: 1rem;
    }
    
    .participants-list {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs);
        justify-content: center;
        margin-bottom: var(--space-sm);
    }
    
    .participant {
        background: var(--light-gray);
        padding: var(--space-xs) var(--space-sm);
        border-radius: 2rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .participant.voted {
        background: var(--accent);
        color: var(--white);
        padding-left: var(--space-sm);
    }
    
    .participant.voted::before {
        left: var(--space-xs);
        color: var(--white);
    }
    
    .voting-area {
        justify-content: center;
        gap: var(--space-xs);
    }
    
    .vote-card {
        width: 3.5rem;
        height: 5rem;
        font-size: 1.8rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(255, 69, 0, 0.3);
    }
    
    .reveal-button {
        font-size: 2rem;
        padding: var(--space-sm) var(--space-md);
        margin: var(--space-sm) 0;
    }
    
    .consensus {
        font-size: clamp(6rem, 15vw, 10rem);
        margin: var(--space-sm) 0;
    }
    
    .results-view {
        flex-direction: column;
        align-items: center;
        gap: var(--space-sm);
    }
    
    .result-card {
        margin-bottom: var(--space-xs);
    }
    
    .result-value {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: clamp(2.5rem, 10vw, 6rem);
    }
    
    .room-input {
        font-size: 1.5rem;
    }
    
    .vote-card {
        width: 3rem;
        height: 4rem;
        font-size: 1.5rem;
    }
    
    .reveal-button {
        font-size: 1.5rem;
    }
    
    .consensus {
        font-size: clamp(4rem, 12vw, 8rem);
    }
}

.chamber-header {
    grid-area: header;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: var(--space-sm);
}

.room-code {
    font-family: var(--sans);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gray);
}

.current-ticket {
    font-size: 2rem;
    font-weight: 600;
    margin-top: var(--space-xs);
    line-height: 1.2;
}

.ticket-input-area {
    margin-top: var(--space-md);
}

.ticket-input {
    width: 100%;
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 400;
    border: none;
    border-bottom: 1px solid var(--light-gray);
    padding: var(--space-xs) 0;
    background: transparent;
    transition: border-color 0.2s ease;
    resize: vertical;
    min-height: 3rem;
}

.ticket-input::placeholder {
    color: var(--light-gray);
    font-style: italic;
}

.ticket-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.ticket-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.button-small {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--gray);
    background: var(--white);
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-small:hover {
    background: var(--gray);
    color: var(--white);
}

.participants-list {
    grid-area: participants;
    list-style: none;
}

.participant {
    font-family: var(--sans);
    font-size: 1.125rem;
    font-weight: 300;
    padding: var(--space-xs) 0;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0.7;
}

.participant.voted {
    font-weight: 500;
    padding-left: var(--space-md);
    opacity: 1;
    color: var(--accent);
}

.participant.voted::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 600;
}

.voting-area {
    grid-area: cards;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: flex-end;
}

.vote-card {
    width: 5rem;
    height: 7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 2.5rem;
    font-weight: 600;
    font-style: italic;
    border: 2px solid var(--black);
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.vote-card:hover {
    transform: translateY(-0.5rem) rotate(1deg);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15);
    border-color: var(--accent);
}

.vote-card.selected {
    background: var(--black);
    color: var(--white);
    transform: translateY(-1rem) rotate(-3deg);
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.vote-card.selected::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--accent);
    z-index: -1;
    border-radius: 2px;
}

.reveal-button {
    grid-area: content;
    align-self: center;
    justify-self: center;
    font-family: var(--serif);
    font-size: 3rem;
    font-style: italic;
    font-weight: 400;
    padding: var(--space-md) var(--space-lg);
    background: var(--accent);
    color: var(--white);
    border: none;
    transition: all 0.3s ease;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    animation: pulse-attention 2s infinite;
}

.reveal-button:hover {
    background: var(--black);
    transform: scale(1.05);
}

@keyframes pulse-attention {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 69, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 0 1rem rgba(255, 69, 0, 0);
    }
}

.results-view {
    grid-area: content;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    justify-content: center;
}

.result-card {
    text-align: center;
}

.result-value {
    font-size: 6rem;
    font-weight: 600;
    line-height: 1;
}

.result-name {
    font-family: var(--sans);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
    color: var(--gray);
}

.consensus {
    grid-area: content;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(8rem, 20vw, 16rem);
    font-weight: 600;
    font-style: italic;
    color: var(--accent);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: consensus-reveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes consensus-reveal {
    0% {
        transform: scale(0.5) rotate(-5deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}