/* 回転しりとり21 - スタイルシート */

/* リセット・ベーススタイル */
.shiritori21-game * {
    box-sizing: border-box;
}

.shiritori21-game {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic Medium', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #fff8f5 0%, #ffe4e1 100%);
    padding: 20px;
    border-radius: 20px;
    margin: 20px 0;
}

/* ゲームコンテナ */
.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    gap: 20px;
    border: 2px solid rgba(255, 182, 193, 0.3);
}

.game-main {
    flex: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.game-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 300px;
    max-width: 400px;
}

/* タイトル */
.game-title {
    color: #d6336c;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.game-title::before,
.game-title::after {
    content: "🌸";
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* プログレスバー */
.progress-container {
    width: 100%;
    background: rgba(255, 182, 193, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    height: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff69b4, #ff1493);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

/* 円形配置コンテナ */
.circle-container {
    position: relative;
    width: min(380px, 85vmin);
    height: min(380px, 85vmin);
    margin: 15px auto;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 240, 245, 0.4) 0%, transparent 70%);
    flex-shrink: 0;
    border: 3px dashed rgba(255, 105, 180, 0.3);
}

/* 円形アイテム */
.circle-item {
    position: absolute;
    width: min(45px, 9vmin);
    height: min(45px, 9vmin);
    line-height: min(45px, 9vmin);
    border-radius: 50%;
    background: linear-gradient(135deg, #ffe4e1 0%, #ffb6c1 100%);
    color: #c71585;
    font-weight: bold;
    border: 3px solid #f08080;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    text-align: center;
    font-size: clamp(14px, 3.5vmin, 18px);
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    cursor: pointer;
}

.circle-item:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.circle-item.filled {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    transform: scale(1.1);
    animation: fillAnimation 0.5s ease-out;
}

@keyframes fillAnimation {
    0% { transform: scale(0) rotate(180deg); }
    50% { transform: scale(1.3) rotate(90deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

/* 中央の残り数表示 */
.center-count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(20px, 6vmin, 32px);
    font-weight: bold;
    background: linear-gradient(135deg, #fff 0%, #f8f8ff 100%);
    border-radius: 50%;
    width: min(90px, 20vmin);
    height: min(90px, 20vmin);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #ff69b4;
    color: #ff1493;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

/* 入力エリア */
.input-area {
    margin: 15px 0;
    padding: 20px;
    background: rgba(255, 240, 245, 0.5);
    border-radius: 15px;
    border: 2px solid rgba(255, 105, 180, 0.3);
    flex-shrink: 0;
}

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

.input-field {
    font-size: clamp(16px, 4vw, 20px);
    padding: 12px 16px;
    flex: 1;
    border-radius: 25px;
    border: 3px solid #f08080;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: #ff69b4;
    box-shadow: 0 0 12px rgba(255, 105, 180, 0.4);
    transform: scale(1.02);
}

.input-field::placeholder {
    color: #999;
    font-style: italic;
}

/* ボタン共通スタイル */
.btn {
    font-size: clamp(14px, 3vw, 16px);
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 60px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

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

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.btn:active::before {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff85c1 0%, #ff69b4 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 105, 180, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #87ceeb 0%, #4682b4 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(135, 206, 235, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #b0e0e6 0%, #87ceeb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(135, 206, 235, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff8787 0%, #ff6b6b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 107, 107, 0.4);
}

/* 履歴エリア */
.history-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    background: rgba(255, 240, 245, 0.5);
    border-radius: 15px;
    border: 2px solid rgba(255, 105, 180, 0.3);
}

.history-title {
    width: 100%;
    color: #d6336c;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.history-placeholder {
    color: #999;
    font-style: italic;
    width: 100%;
    text-align: center;
}

.history-card {
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e1 100%);
    border: 2px solid #f08080;
    border-radius: 15px;
    padding: 6px 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    overflow: hidden;
    font-size: clamp(12px, 3vw, 14px);
    min-width: 60px;
}

.history-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.history-card:hover {
    background: linear-gradient(135deg, #ffb6c1 0%, #ff69b4 100%);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.history-card:hover::before {
    left: 100%;
}

/* ヘルプエリア */
.help-area {
    padding: 15px;
    background: rgba(255, 240, 245, 0.5);
    border-radius: 15px;
    border: 2px solid rgba(255, 105, 180, 0.3);
    max-height: 300px;
    overflow-y: auto;
}

.help-title {
    color: #d6336c;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.help-content-mini {
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
}

.help-content-mini h4 {
    color: #d6336c;
    margin: 10px 0 5px 0;
    font-size: 14px;
}

.help-content-mini ul {
    margin: 5px 0;
    padding-left: 15px;
}

.help-content-mini li {
    margin: 3px 0;
}

/* メッセージエリア */
.message-area {
    font-size: clamp(14px, 3.5vw, 16px);
    color: #d6336c;
    min-height: 80px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 15px;
    background: rgba(255, 240, 245, 0.5);
    border: 2px solid rgba(255, 105, 180, 0.3);
    line-height: 1.5;
}

.message-area.error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    animation: shake 0.5s ease-in-out;
}

.message-area.success {
    color: #32cd32;
    background: rgba(50, 205, 50, 0.1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #fff 0%, #f8f8ff 100%);
    margin: 10% auto;
    padding: 30px;
    border-radius: 20px;
    width: min(400px, 90vw);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    border: 3px solid rgba(255, 105, 180, 0.3);
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    margin-bottom: 25px;
}

.modal-header h2 {
    color: #d6336c;
    font-size: clamp(20px, 5vw, 28px);
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.emoji {
    font-size: clamp(28px, 7vw, 40px);
    display: inline-block;
    animation: bounce 1s infinite;
}

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

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-sidebar {
        min-width: auto;
        max-width: none;
    }
    
    .help-area {
        max-height: 200px;
    }
    
    .history-area {
        max-height: 150px;
    }
    
    .input-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .input-field {
        margin-bottom: 8px;
    }
    
    .btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-height: 600px) {
    .game-container {
        padding: 10px;
    }
    
    .game-title {
        margin-bottom: 8px;
    }
    
    .circle-container {
        width: min(300px, 70vmin);
        height: min(300px, 70vmin);
        margin: 8px auto;
    }
    
    .input-area {
        margin: 8px 0;
    }
    
    .history-area {
        max-height: 100px;
    }
    
    .help-area {
        max-height: 150px;
    }
    
    .message-area {
        min-height: 60px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .game-container {
        flex-direction: row;
        align-items: stretch;
        gap: 20px;
    }
    
    .circle-container {
        width: min(350px, 60vh);
        height: min(350px, 60vh);
        margin: 0;
    }
}