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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.create-room, .room-list {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.create-room h2, .room-list h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.room-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.room-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.room-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.room-id {
    font-weight: 600;
}

.room-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.room-status.waiting {
    background: #ffeaa7;
    color: #d63031;
}

.room-status.playing {
    background: #55efc4;
    color: #00b894;
}

.room-status.ended {
    background: #dfe6e9;
    color: #636e72;
}

.footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    opacity: 0.8;
}

.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.room-id, .room-status, .timer {
    font-weight: 600;
    font-size: 1.1rem;
}

.timer {
    color: #e74c3c;
    font-size: 1.5rem;
}

.game-main {
    flex: 1;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.players-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    height: fit-content;
}

.players-panel h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.player-item {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-item.current-turn {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.turn-indicator {
    font-size: 1.2rem;
}

.game-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
}

.input-section-top {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.previous-text-display h4, .current-turn-display h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.previous-text-content {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    margin-bottom: 20px;
}

.current-turn-display {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.input-area-top {
    background: white;
    color: #333;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.input-area-top h4 {
    color: #667eea;
    margin-bottom: 15px;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2rem;
}

.gojuon-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
}

.gojuon-panel h3 {
    margin-bottom: 20px;
    color: #667eea;
}

.gojuon-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gojuon-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.gojuon-char {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.3s;
}

.gojuon-char.used {
    background: #dfe6e9;
    color: #95a5a6;
    border-color: #b2bec3;
}

.gojuon-char.empty {
    border: none;
    background: transparent;
}

#textInput {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 10px;
}

.validation-message {
    color: #e74c3c;
    margin-bottom: 10px;
    font-weight: 600;
}

.input-actions {
    display: flex;
    gap: 10px;
}

.history-panel {
    border-top: 2px solid #e0e0e0;
    padding-top: 20px;
}

.history-panel h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.history-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.history-player {
    font-weight: 600;
    color: #667eea;
    min-width: 100px;
}

.history-text {
    flex: 1;
}

.waiting-screen, .ended-screen {
    text-align: center;
    padding: 40px;
}

.waiting-screen h2, .ended-screen h2 {
    margin-bottom: 30px;
    color: #667eea;
}

#waitingPlayers {
    margin-bottom: 30px;
}

#hostControls {
    max-width: 500px;
    margin: 0 auto;
}

.result-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
}

.result-summary {
    text-align: center;
    margin-bottom: 40px;
}

.result-summary h2 {
    color: #667eea;
    margin: 30px 0 15px;
}

.topic-display, .final-text {
    font-size: 1.5rem;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.history-section {
    margin-bottom: 40px;
}

.history-timeline {
    max-width: 800px;
    margin: 0 auto;
}

.topic-item {
    background: #667eea;
    color: white;
}

.vote-section {
    margin-bottom: 40px;
}

.vote-section h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.vote-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.vote-count {
    font-weight: 600;
    color: #667eea;
}

.vote-form {
    max-width: 400px;
    margin: 30px auto;
}

.vote-form select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.result-actions {
    text-align: center;
    margin-top: 40px;
}

.loading, .no-rooms {
    text-align: center;
    color: #999;
    padding: 20px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .game-main {
        grid-template-columns: 1fr;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .forbidden-grid {
        max-height: 200px;
    }
}
