body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f0f0;
    color: #333;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    background-color: #ccc;
    border-radius: 10px;
    margin: 20px 0;
    width: clamp(300px, 90vw, 800px);
}

.grid-cell {
    aspect-ratio: 2 / 3;
    background-color: #fff;
    border: 1px solid #999;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    user-select: none;
    -webkit-user-select: none; /* Safari用 */
    -moz-user-select: none; /* Firefox用 */
    touch-action: none; /* スマートフォンでのドラッグ中のスクロールを防止 */
    -webkit-touch-callout: none; /* iOS Safari用 */
    transition: transform 0.2s;
}

.grid-cell:hover {
    transform: scale(1.05);
}

/* --- Card Colors --- */
.card-ssr { background-color: #e89deb; color: #333; } /* 薄紫色 */
.card-sr { background-color: #ffd700; color: #333; } /* 黄色 */
.card-r { background-color: #9dc3ec; color: #333; }  /* 青色 */
.card-n { background-color: #bec4c9; color: #333; }  /* 白色 */
.card-empty { background-color: #e0e0e0; }

#reset-button {
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    background-color: #f44336;
    color: white;
    border-radius: 5px;
    margin-top: 10px;
}

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

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 90%;
    max-width: 100%;
}

#modal-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 10px;
}

.modal-option {
    padding: 5px 10px; /* パディングを調整 */
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-align: center;
    display: flex; /* Flexboxを有効にする */
    flex-direction: column; /* 縦方向にアイテムを並べる */
    justify-content: center; /* 垂直方向中央揃え */
    align-items: center; /* 水平方向中央揃え */
    min-height: 60px; /* 最小高さを設定して見た目を統一 */
}
.modal-option.remove {
    background-color: #f8d7da;
}
.modal-main-text {
    font-size: 1.6rem; /* メインテキストを大きく */
    font-weight: bold;
    line-height: 1; /* 行の高さを調整 */
}
.modal-rarity-text {
    font-size: 0.7rem; /* レアリティテキストを小さく */
    line-height: 1; /* 行の高さを調整 */
}

/* --- Drag and Drop Styles --- */
.dragging {
    opacity: 0.6;
    z-index: 10;
    border: 2px dashed #333;
    transition: none;
}

.drop-target {
    background-color: #d4edda; /* 薄い緑色でハイライト */
    border-style: dashed;
}

/* --- Keyboard Navigation --- */
#grid-container:focus-visible .grid-cell.focused-cell {
    outline: 3px solid #007bff;
    outline-offset: -3px;
}
